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
1a2577d7
Commit
1a2577d7
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Implement cmdonly in run.run, rather than in wrappers, so e.g. $FSLDIR is
correctly prepended.
parent
1f305dc9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/utils/run.py
+8
-0
8 additions, 0 deletions
fsl/utils/run.py
fsl/wrappers/wrapperutils.py
+10
-13
10 additions, 13 deletions
fsl/wrappers/wrapperutils.py
with
18 additions
and
13 deletions
fsl/utils/run.py
+
8
−
0
View file @
1a2577d7
...
...
@@ -151,6 +151,10 @@ def run(*args, **kwargs):
the :func:`.fslsub.submit` function. May also be a
dictionary containing arguments to that function.
:arg cmdonly: Defaults to ``False``. If ``True``, the command is not
executed, but rather is returned directly, as a list of
arguments.
:arg log: Must be passed as a keyword argument. An optional ``dict``
which may be used to redirect the command
'
s standard output
and error. The following keys are recognised:
...
...
@@ -181,6 +185,7 @@ def run(*args, **kwargs):
returnStderr
=
kwargs
.
pop
(
'
stderr
'
,
False
)
returnExitcode
=
kwargs
.
pop
(
'
exitcode
'
,
False
)
submit
=
kwargs
.
pop
(
'
submit
'
,
{})
cmdonly
=
kwargs
.
pop
(
'
cmdonly
'
,
False
)
log
=
kwargs
.
pop
(
'
log
'
,
None
)
args
=
prepareArgs
(
args
)
...
...
@@ -207,6 +212,9 @@ def run(*args, **kwargs):
raise
ValueError
(
'
submit must be a mapping containing
'
'
options for fsl.utils.fslsub.submit
'
)
if
cmdonly
:
return
args
if
DRY_RUN
:
return
_dryrun
(
submit
,
returnStdout
,
returnStderr
,
returnExitcode
,
*
args
)
...
...
This diff is collapsed.
Click to expand it.
fsl/wrappers/wrapperutils.py
+
10
−
13
View file @
1a2577d7
...
...
@@ -172,9 +172,7 @@ def genxwrapper(func, runner):
- ``exitcode``: Passed to ``runner``. Defaults to ``False``.
- ``submit``: Passed to ``runner``. Defaults to ``None``.
- ``log``: Passed to ``runner``. Defaults to ``{
'
tee
'
:True}``.
- ``cmdonly``: Defaults to ``False``. If ``True``, the return
value of ``func`` is returned directly, instead of it being passed
to ``runner``,
- ``cmdonly``: Passed to ``runner``. Defaults to ``False``.
:arg func: A function which generates a command line.
:arg runner: Either :func:`.run.run` or :func:`.run.runfsl`.
...
...
@@ -184,20 +182,19 @@ def genxwrapper(func, runner):
stdout
=
kwargs
.
pop
(
'
stdout
'
,
True
)
stderr
=
kwargs
.
pop
(
'
stderr
'
,
True
)
exitcode
=
kwargs
.
pop
(
'
exitcode
'
,
False
)
cmdonly
=
kwargs
.
pop
(
'
cmdonly
'
,
False
)
submit
=
kwargs
.
pop
(
'
submit
'
,
None
)
cmdonly
=
kwargs
.
pop
(
'
cmdonly
'
,
False
)
log
=
kwargs
.
pop
(
'
log
'
,
{
'
tee
'
:
True
})
cmd
=
func
(
*
args
,
**
kwargs
)
if
cmdonly
:
return
cmd
else
:
return
runner
(
cmd
,
stderr
=
stderr
,
log
=
log
,
submit
=
submit
,
stdout
=
stdout
,
exitcode
=
exitcode
)
return
runner
(
cmd
,
stderr
=
stderr
,
log
=
log
,
submit
=
submit
,
cmdonly
=
cmdonly
,
stdout
=
stdout
,
exitcode
=
exitcode
)
return
_update_wrapper
(
wrapper
,
func
)
...
...
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