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
No related tags found
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
...
@@ -31,10 +31,10 @@ import os.path as op
import
os
import
os
from
fsl.utils.platform
import
platform
as
fslplatform
from
fsl.utils.platform
import
platform
as
fslplatform
import
fsl.utils.fslsub
as
fslsub
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.tempdir
as
tempdir
import
fsl.utils.path
as
fslpath
import
fsl.utils.path
as
fslpath
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -146,7 +146,7 @@ def run(*args, **kwargs):
...
@@ -146,7 +146,7 @@ def run(*args, **kwargs):
:arg submit: Must be passed as a keyword argument. Defaults to ``None``.
:arg submit: Must be passed as a keyword argument. Defaults to ``None``.
If ``True``, the command is submitted as a cluster job via
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.
dictionary containing arguments to that function.
:arg cmdonly: Defaults to ``False``. If ``True``, the command is not
:arg cmdonly: Defaults to ``False``. If ``True``, the command is not
...
@@ -173,10 +173,10 @@ def run(*args, **kwargs):
...
@@ -173,10 +173,10 @@ def run(*args, **kwargs):
object (via :func:`_realrun`), unless ``submit=True``, in which case they
object (via :func:`_realrun`), unless ``submit=True``, in which case they
are passed through to the :func:`.fslsub.submit` function.
are passed through to the :func:`.fslsub.submit` function.
:returns:
If ``submit`` is provided, the
return value of
:returns: If ``submit`` is provided, the
ID of the submitted job is
:func:`.fslsub` is returned
. Otherwise returns a single
returned as a string
. Otherwise returns a single
value or a
value or a
tuple, based on the based on the ``stdout``,
tuple, based on the based on the ``stdout``,
``stderr``, and
``stderr``, and
``exitcode`` arguments.
``exitcode`` arguments.
"""
"""
returnStdout
=
kwargs
.
pop
(
'
stdout
'
,
True
)
returnStdout
=
kwargs
.
pop
(
'
stdout
'
,
True
)
...
@@ -217,9 +217,12 @@ def run(*args, **kwargs):
...
@@ -217,9 +217,12 @@ def run(*args, **kwargs):
return
_dryrun
(
return
_dryrun
(
submit
,
returnStdout
,
returnStderr
,
returnExitcode
,
*
args
)
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
:
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
# Run directly - delegate to _realrun
stdout
,
stderr
,
exitcode
=
_realrun
(
stdout
,
stderr
,
exitcode
=
_realrun
(
...
@@ -438,13 +441,17 @@ def wslcmd(cmdpath, *args):
...
@@ -438,13 +441,17 @@ def wslcmd(cmdpath, *args):
def
hold
(
job_ids
,
hold_filename
=
None
):
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
:param hold_filename: filename to use as a hold file.
containing directory should exist, but the
The containing directory should exist, but the file itself should not.
file itself should not. Defaults to a
Defaults to a ./.<random characters>.hold in the current directory.
./.<random characters>.hold in the current
:return: only returns when all the jobs have finished
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
)
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