Skip to content

Commit

Permalink
YDA-5829 - Work in progress for troubleshooting publications.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaur16 committed Sep 22, 2024
1 parent 4e6f83d commit 2c793da
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 123 deletions.
3 changes: 2 additions & 1 deletion meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,8 @@ def vault_metadata_matches_schema(ctx, coll_name, schema_cache, report_name):
try:
metadata = jsonutil.read(ctx, metadata_path)
except Exception as exc:
# TODO write_stdout?
log.write(ctx, "{} skips {}, because of exception while reading metadata file {}: {}".format(report_name, coll_name, metadata_path, str(exc)))
log.write_stdout(ctx, "vault_metadata_matches_schema: Error while reading metadata file {} of data package {}: {}".format(metadata_path, coll_name, str(exc)))
return None

# Determine schema
Expand All @@ -834,5 +834,6 @@ def vault_metadata_matches_schema(ctx, coll_name, schema_cache, report_name):
if not match_schema:
errors_formatted = [meta_form.humanize_validation_error(e).encode('utf-8') for e in error_list]
log.write(ctx, "{}: metadata {} did not match schema {}: {}".format(report_name, metadata_path, schema_shortname, str(errors_formatted)))
log.write_stdout(ctx, "vault_metadata_matches_schema: Metadata {} of data package {} did not match the schema {}. Error list: {}".format(metadata_path, coll_name, schema_shortname, str(errors_formatted)))

return {"schema": schema_shortname, "match_schema": match_schema}
6 changes: 3 additions & 3 deletions tools/troubleshoot-published-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
python3 troubleshoot-published-data.py -p research-initial[1725262507]
To put results into a json lines log file:
python3 troubleshoot-published-data.py -l /etc/irods/yoda-ruleset/troubleshoot-pub-log.jsonl
python3 troubleshoot-published-data.py -f true
"""
import argparse
import subprocess
Expand All @@ -20,8 +20,8 @@ def parse_args():
prog="troubleshoot-published-data.py",
description=__doc__,
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("-l", "--log-file", type=str, required=False,
help="If write to json lines log file, location to write to")
parser.add_argument("-f", "--log-file", type=str, required=False,
help="If log file parameter is true then write to log at: /var/lib/irods/log/troubleshoot_publications.log")
parser.add_argument("-p", "--package", type=str, required=False,
help="Troubleshoot a specific data package by name (default: troubleshoot all packages)")
# TODO argument to optionally add an avu with json status info: time of check and was it a success
Expand Down
Loading

0 comments on commit 2c793da

Please sign in to comment.