Skip to content
Snippets Groups Projects
Commit 59515b7a authored by Matthew K Defenderfer's avatar Matthew K Defenderfer
Browse files

better arg handling

parent 69c7beda
No related branches found
No related tags found
1 merge request!8Automate conversion of GPFS policy outputs to parquet without Jupyter
......@@ -21,9 +21,9 @@ def parse_args():
parser = argparse.ArgumentParser(description=desc,
formatter_class=argparse.RawTextHelpFormatter
)
parser.add_argument('-p','--policy',help="Print the policy the script uses as a template and exit")
parser.add_argument('-p','--policy',help="Print the policy the script uses as a template and exit",action='store_true')
parser.add_argument('-o','--output-dir',help="Directory to store the output parquet. The parquet file will have the same name as the input. Defaults to input_file_dir/parquet")
parser.add_argument('-f','--file',required=True,help="Log file from mmlspolicy run to be converted to parquet. Can be either a full log or just a part")
parser.add_argument('-f','--file',help="Log file from mmlspolicy run to be converted to parquet. Can be either a full log or just a part")
args = parser.parse_args()
return args
......@@ -96,11 +96,15 @@ def main():
print_policy()
exit()
file = PurePath(args.file)
outdir = PurePath(args.output_dir)
if args.file:
file = PurePath(args.file)
else:
exit('Error: must specify a file to convert')
if not outdir:
if not args.output_dir:
outdir = file.parent.joinpath('parquet')
else:
outdir = PurePath(args.output_dir)
os.makedirs(outdir,exist_ok=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment