Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
adcd481c
Commit
adcd481c
authored
3 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: fsl.utils.run now uses fsl.wrappers.fsl_sub instead of fsl.utils.fslsub
parent
30a56372
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/run.py
+22
-15
22 additions, 15 deletions
fsl/utils/run.py
with
22 additions
and
15 deletions
fsl/utils/run.py
+
22
−
15
View file @
adcd481c
...
...
@@ -31,10 +31,10 @@ import os.path as op
import
os
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsl.utils.fslsub
as
fslsub
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.path
as
fslpath
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -146,7 +146,7 @@ def run(*args, **kwargs):
:arg submit: Must be passed as a keyword argument. Defaults to ``None``.
If ``True``, the command is submitted as a cluster job via
the :
func
:`
.
fsl
sub.submit
` function. May also be a
the :
mod
:`fsl
.wrappers.fsl_sub
` function. May also be a
dictionary containing arguments to that function.
:arg cmdonly: Defaults to ``False``. If ``True``, the command is not
...
...
@@ -173,10 +173,10 @@ def run(*args, **kwargs):
object (via :func:`_realrun`), unless ``submit=True``, in which case they
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
value or a
tuple, based on the based on the ``stdout``,
``stderr``, and
``exitcode`` arguments.
:returns: If ``submit`` is provided, the
ID of the submitted job is
returned as a string
. Otherwise returns a single
value or a
tuple, based on the based on the ``stdout``,
``stderr``, and
``exitcode`` arguments.
"""
returnStdout
=
kwargs
.
pop
(
'
stdout
'
,
True
)
...
...
@@ -217,9 +217,12 @@ def run(*args, **kwargs):
return
_dryrun
(
submit
,
returnStdout
,
returnStderr
,
returnExitcode
,
*
args
)
# submit - delegate to fslsub
# submit - delegate to fsl_sub. This will induce a nested
# call back to this run function, which is a bit confusing,
# but harmless, as we've popped the "submit" arg above.
if
submit
is
not
None
:
return
fslsub
.
submit
(
'
'
.
join
(
args
),
**
submit
,
**
kwargs
)
from
fsl.wrappers
import
fsl_sub
# pylint: disable=import-outside-toplevel # noqa: E501
return
fsl_sub
(
*
args
,
**
submit
,
**
kwargs
)[
0
].
strip
()
# Run directly - delegate to _realrun
stdout
,
stderr
,
exitcode
=
_realrun
(
...
...
@@ -438,13 +441,17 @@ def wslcmd(cmdpath, *args):
def
hold
(
job_ids
,
hold_filename
=
None
):
"""
Waits until all jobs have finished
"""
Waits until all jobs have finished
:param job_ids: possibly nested sequence of job ids. The job ids
themselves should be strings.
:param job_ids: possibly nested sequence of job ids. The job ids themselves should be strings.
:param hold_filename: filename to use as a hold file.
The containing directory should exist, but the file itself should not.
Defaults to a ./.<random characters>.hold in the current directory.
:return: only returns when all the jobs have finished
:param hold_filename: filename to use as a hold file. The
containing directory should exist, but the
file itself should not. Defaults to a
./.<random characters>.hold in the current
directory. :return: only returns when all
the jobs have finished
"""
import
fsl.utils.fslsub
as
fslsub
# pylint: disable=import-outside-toplevel # noqa: E501
fslsub
.
hold
(
job_ids
,
hold_filename
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment