diff --git a/fsl/utils/fslsub.py b/fsl/utils/fslsub.py index 46bc0466ddb7c767491ffe3ab99ed369e6e25b2f..eb8bf971ce81cb40b007246408124d8fcac60465 100644 --- a/fsl/utils/fslsub.py +++ b/fsl/utils/fslsub.py @@ -68,7 +68,8 @@ def submit(*command, output=None, flags=False, multi_threaded=None, - verbose=False): + verbose=False, + env=None): """ Submits a given command to the cluster @@ -99,6 +100,7 @@ def submit(*command, - <threads>: number of threads to run :arg verbose: If True, use verbose mode + :arg env: Dict containing environment variables :return: string of submitted job id """ @@ -136,7 +138,7 @@ def submit(*command, base_cmd.extend(prepareArgs(command)) - return runfsl(*base_cmd).strip() + return runfsl(*base_cmd, env=env).strip() def info(job_id): diff --git a/fsl/utils/run.py b/fsl/utils/run.py index 7211965d773f03d6c3abd583e3a4776bebaf7c2c..70915cf2dea6d0adcc68cd733283382c634153d1 100644 --- a/fsl/utils/run.py +++ b/fsl/utils/run.py @@ -168,7 +168,7 @@ def run(*args, **kwargs): All other keyword arguments are passed through to the ``subprocess.Popen`` object (via :func:`_realrun`), unless ``submit=True``, in which case they - are ignored. + are passed through to the :func:`.fslsub.submit` function. :returns: If ``submit`` is provided, the return value of :func:`.fslsub` is returned. Otherwise returns a single @@ -208,7 +208,7 @@ def run(*args, **kwargs): # submit - delegate to fslsub if submit is not None: - return fslsub.submit(' '.join(args), **submit) + return fslsub.submit(' '.join(args), **submit, **kwargs) # Run directly - delegate to _realrun stdout, stderr, exitcode = _realrun(