diff --git a/fsl/utils/fslsub.py b/fsl/utils/fslsub.py index 713826a8c26637cc99159abeda423b2b6e1fba82..2037a87a901904fe8d964c90066aba7974632c1a 100644 --- a/fsl/utils/fslsub.py +++ b/fsl/utils/fslsub.py @@ -55,7 +55,7 @@ import importlib log = logging.getLogger(__name__) -def submit(command, +def submit(*command, minutes=None, queue=None, architecture=None, @@ -70,9 +70,12 @@ def submit(command, flags=False, multi_threaded=None, verbose=False): - """Submits a given command to the cluster + """ + Submits a given command to the cluster + + You can pass the command and arguments as a single string, or as a regular or unpacked sequence. - :arg command: single string with the job command + :arg command: string or regular/unpacked sequence of strings with the job command :arg minutes: Estimated job length in minutes, used to auto-set queue name :arg queue: Explicitly sets the queue name @@ -101,7 +104,7 @@ def submit(command, :return: string of submitted job id """ - from fsl.utils.run import runfsl + from fsl.utils.run import runfsl, prepareArgs base_cmd = ['fsl_sub'] @@ -132,7 +135,7 @@ def submit(command, base_cmd.append('-s') base_cmd.extend(multi_threaded) - base_cmd.append(command) + base_cmd.extend(prepareArgs(command)) return runfsl(*base_cmd).strip() diff --git a/fsl/utils/run.py b/fsl/utils/run.py index 3fb7d979eb9848ed8c4a878a53edd6b0c39eb052..12cc036067d7c502afbca6cd90153c38ced00859 100644 --- a/fsl/utils/run.py +++ b/fsl/utils/run.py @@ -72,7 +72,7 @@ def dryrun(*args): DRY_RUN = oldval -def _prepareArgs(args): +def prepareArgs(args): """Used by the :func:`run` function. Ensures that the given arguments is a list of strings. """ @@ -179,7 +179,7 @@ def run(*args, **kwargs): logStdout = log .get('stdout', None) logStderr = log .get('stderr', None) logCmd = log .get('cmd', None) - args = _prepareArgs(args) + args = prepareArgs(args) if not bool(submit): submit = None @@ -345,7 +345,7 @@ def runfsl(*args, **kwargs): if not prefixes: raise FSLNotPresent('$FSLDIR is not set - FSL cannot be found!') - args = _prepareArgs(args) + args = prepareArgs(args) for prefix in prefixes: cmdpath = op.join(prefix, args[0]) if op.isfile(cmdpath):