-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip troubleshoot change to stdout, configurable log
- Loading branch information
Showing
6 changed files
with
180 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
"""This script collects all published packages and checks that they have all the required info. | ||
Example: | ||
To check all published packages: | ||
python3 troubleshoot-published-data.py | ||
To check one specific package by name: | ||
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 | ||
""" | ||
import argparse | ||
import subprocess | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser( | ||
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("-p", "--package", type=str, required=False, | ||
help="Troubleshoot a specific data package by name (default: troubleshoot all packages)") | ||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
rule_name = "/etc/irods/yoda-ruleset/tools/troubleshoot_data.r" | ||
# rule_name = "rule_batch_troubleshoot_published_data_packages" | ||
# TODO handle packages with spaces in the name | ||
data_package = f"*data_package={args.package}" | ||
log_loc = f"*log_loc={args.log_file if args.log_file else ''}" | ||
subprocess.call(['irule', '-r', 'irods_rule_engine_plugin-python-instance', '-F', | ||
rule_name, data_package, log_loc]) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.