Skip to content

Commit 70d679b

Browse files
committed
Added unit tests for --commandsFile option.
1 parent 8beaaee commit 70d679b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

scripts/smart-dispatch

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def parse_arguments():
151151
parser.add_argument('-c', '--coresPerCommand', type=int, required=False, help='How many cores a command needs.', default=1)
152152
parser.add_argument('-g', '--gpusPerCommand', type=int, required=False, help='How many gpus a command needs.', default=1)
153153
# parser.add_argument('-m', '--memPerCommand', type=float, required=False, help='How much memory a command needs (in Gb).')
154-
parser.add_argument('-f', '--commandsFile', type=str, required=False, help='File containing commands to launch. Each command must be on a seperate line. (Replaces commandAndOptions)')
154+
parser.add_argument('-f', '--commandsFile', type=argparse.FileType('r'), required=False,
155+
help='File containing commands to launch. Each command must be on a seperate line. (Replaces commandAndOptions)')
155156

156157
parser.add_argument('-l', '--modules', type=str, required=False, help='List of additional modules to load.', nargs='+')
157158
parser.add_argument('-x', '--doNotLaunch', action='store_true', help='Creates the QSUB files without launching them.')
@@ -175,9 +176,6 @@ def parse_arguments():
175176
if args.queueName not in AVAILABLE_QUEUES and ((args.coresPerNode is None and args.gpusPerNode is None) or args.walltime is None):
176177
parser.error("Unknown queue, --coresPerNode/--gpusPerNode and --walltime must be set.")
177178

178-
if args.commandsFile is not None and not os.path.isfile(args.commandsFile):
179-
parser.error("Command file does not exist: '{0}'.".format(args.commandsFile))
180-
181179
return args
182180

183181

0 commit comments

Comments
 (0)