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
6a91c938
Commit
6a91c938
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Plain Diff
Merge branch 'rf/submit' into 'master'
Rf/submit See merge request fsl/fslpy!208
parents
6d59ac9e
659cb752
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#5117
passed
5 years ago
Stage: test
Stage: style
Stage: doc
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.rst
+5
-2
5 additions, 2 deletions
CHANGELOG.rst
fsl/utils/fslsub.py
+4
-2
4 additions, 2 deletions
fsl/utils/fslsub.py
fsl/utils/run.py
+2
-2
2 additions, 2 deletions
fsl/utils/run.py
tests/test_run.py
+11
-7
11 additions, 7 deletions
tests/test_run.py
with
22 additions
and
13 deletions
CHANGELOG.rst
+
5
−
2
View file @
6a91c938
...
...
@@ -23,8 +23,11 @@ Changed
* The :func:`.gifti.relatedFiles` function now supports files with
BIDS-style naming conventions.
* The :func:`.run.run` and :func:`.run.runfsl` functions now pass through
any additional keyword arguments to ``subprocess.Popen``.
* The :func:`.run.run` and :func:`.run.runfsl` functions now pass through any
additional keyword arguments to ``subprocess.Popen`` or, if ``submit=True``,
to :func:`fslsub.submit`.
* The :func:`.fslsub.submit` function now accepts an ``env`` option, allowing
environment variables to be specified.
* The :func:`.run.runfsl` function now raises an error on attempts to
run a command which is not present in ``$FSLDIR/bin/`` (e.g. ``ls``).
* The :mod:`.bids` module has been updated to support files with any
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/fslsub.py
+
4
−
2
View file @
6a91c938
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/run.py
+
2
−
2
View file @
6a91c938
...
...
@@ -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
(
...
...
This diff is collapsed.
Click to expand it.
tests/test_run.py
+
11
−
7
View file @
6a91c938
...
...
@@ -306,29 +306,33 @@ def test_run_submit():
mkexec
(
op
.
expandvars
(
'
$FSLDIR/bin/fsltest
'
),
test_script
)
jid
=
run
.
run
(
'
fsltest
'
,
submit
=
True
)
assert
jid
==
'
12345
'
stdout
,
stderr
=
fslsub
.
output
(
jid
)
assert
stdout
==
'
test_script running
\n
'
assert
stderr
==
''
# or can pass submit opts as a dict
kwargs
=
{
'
name
'
:
'
abcde
'
,
'
ram
'
:
'
4GB
'
}
jid
=
run
.
run
(
'
fsltest
'
,
submit
=
kwargs
)
assert
jid
==
'
12345
'
stdout
,
stderr
=
fslsub
.
output
(
jid
)
experr
=
'
\n
'
.
join
([
'
{}: {}
'
.
format
(
k
,
kwargs
[
k
])
for
k
in
sorted
(
kwargs
.
keys
())])
+
'
\n
'
assert
stdout
==
'
test_script running
\n
'
assert
stderr
==
experr
# or can pass submit opts as kwargs
kwargs
=
{
'
name
'
:
'
abcde
'
,
'
ram
'
:
'
4GB
'
}
jid
=
run
.
run
(
'
fsltest
'
,
submit
=
True
,
**
kwargs
)
assert
jid
==
'
12345
'
stdout
,
stderr
=
fslsub
.
output
(
jid
)
experr
=
'
\n
'
.
join
([
'
{}: {}
'
.
format
(
k
,
kwargs
[
k
])
for
k
in
sorted
(
kwargs
.
keys
())])
+
'
\n
'
assert
stdout
==
'
test_script running
\n
'
assert
stderr
==
experr
def
test_run_streams
():
"""
"""
...
...
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