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

change outfile to log_prefix for clarity

parent f78e856e
No related branches found
No related tags found
1 merge request!12Run policy minor edits
......@@ -20,10 +20,8 @@ def parse_args():
parser.add_argument('-o','--outdir', type=str,
help="Directory to store the policy output in",
default='/data/rc/gpfs-policy/data')
parser.add_argument('-f','--outfile', type=str,
help="Base name of the output file. Defaults to 'list-policy_[device-id]' where 'device-id'"
"is the device stem when device is a path or just device when it is a fileset. The final"
"file name will have the policy type, the job ID, and the run date tagged on the end")
parser.add_argument('-f','--log-prefix', type=str,
help="Prefix for the policy output file. Defaults to 'list-policy_[device-id]' where 'device-id' is the device stem when device is a path or just device when it is a fileset. The final file name will have the policy type, the job ID, and the run date tagged on the end")
parser.add_argument('--with-dirs', action='store_true',
help="Include directories as entries in the policy output (Default: false)")
......@@ -107,12 +105,12 @@ def validate_output_directory(outdir):
raise ValueError(f"{p} is not a valid output directory")
return p
def create_default_outfile(device):
def create_default_log_prefix(device):
if device.match('/data/user'):
outfile = 'list-policy_data_user'
log_prefix = 'list-policy_data_user'
else:
outfile = f'list-policy_{device.stem}'
return outfile
log_prefix = f'list-policy_{device.stem}'
return log_prefix
def main():
args = parse_args()
......@@ -126,15 +124,15 @@ def main():
args['outdir'] = validate_output_directory(args['outdir'])
if args['outfile'] is None:
args['outfile'] = create_default_outfile(args['device'])
if args['log_prefix'] is None:
args['log_prefix'] = create_default_log_prefix(args['device'])
if args['with_dirs']:
args['policy'] = './policy-def/list-path-dirplus'
else:
args['policy'] = './policy-def/list-path-external'
cmd = "./submit-pol-job -o {outdir} -f {outfile} -P {policy} -N {nodes} -c {cores} -p {partition} -t {time} -m {mem_per_cpu} {device}".format(**args)
cmd = "./submit-pol-job -o {outdir} -f {log_prefix} -P {policy} -N {nodes} -c {cores} -p {partition} -t {time} -m {mem_per_cpu} {device}".format(**args)
print(f"Command: {cmd}")
subprocess.run(cmd,shell=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