Skip to content

Commit f52aa29

Browse files
committed
if --wait is passed into gufi_query_distributed, print output files
1 parent 8c3cd15 commit f52aa29

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

scripts/gufi_query_distributed

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ def schedule_top(args, jobids):
114114

115115
cmd = [args.sbatch, '--nodes=1']
116116
cmd += gufi_distributed.depend_on_slurm_jobids(jobids)
117+
if args.wait:
118+
cmd += ['--wait']
117119
cmd += [
118120
args.gufi_query,
119121
'-n', str(args.threads),
@@ -127,6 +129,10 @@ def parse_args():
127129
'Script for distributing gufi_query across nodes')
128130

129131
parser.add_argument('--dry-run', action='store_true')
132+
parser.add_argument('-W', '--wait',
133+
actions='store_true',
134+
help='wait until all jobs complete and print results')
135+
130136
parser.add_argument('--gufi_query', metavar='path',
131137
type=str,
132138
default='gufi_query.sbatch')
@@ -155,9 +161,15 @@ def main():
155161
lambda idx, start, end: schedule_work(args, idx, start, end),
156162
lambda jobids: schedule_top(args, jobids))
157163

158-
print('cat the following slurm job output files to get complete results:')
159-
for jobid in jobids:
160-
print(' {0}'.format(jobid))
164+
if args.wait:
165+
for jobid in jobids:
166+
with open('slurm-{0}.out'.format(jobid), 'r') as f:
167+
for line in f:
168+
print(line)
169+
else:
170+
print('cat the following slurm job output files to get complete results:')
171+
for jobid in jobids:
172+
print(' {0}'.format(jobid))
161173

162174
if __name__ == '__main__':
163175
main()

test/regression/sbatch.no-output.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ case $key in
7676
--nodes|--dependency)
7777
shift # past count
7878
;;
79-
--nodes=*)
79+
--nodes=*|--wait)
8080
;;
8181
*) # unknown option
8282
POSITIONAL+=("$1") # save it in an array for later

test/regression/sbatch.output.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ case $key in
7676
--nodes|--dependency)
7777
shift # past count
7878
;;
79-
--nodes=*)
79+
--nodes=*|--wait)
8080
;;
8181
*) # unknown option
8282
POSITIONAL+=("$1") # save it in an array for later

0 commit comments

Comments
 (0)