Commit 01ddcd4e authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rel/2.6.2' into 'v2.6'

Rel/2.6.2

See merge request fsl/fslpy!170
parents 1376293d 364434dd
Pipeline #4588 passed with stages
in 1 minute and 37 seconds
......@@ -9,7 +9,7 @@ set -e
# which gitlab CE does not currently do for us.
if [[ "$CI_PROJECT_PATH" != "$UPSTREAM_PROJECT" ]]; then
git fetch upstream;
git merge --no-commit --no-ff upstream/master;
git merge --no-commit --no-ff -s recursive -X ours upstream/master;
fi;
source /test.venv/bin/activate
......
......@@ -2,6 +2,21 @@ This document contains the ``fslpy`` release history in reverse chronological
order.
2.6.2 (Monday 7th October 2019)
-------------------------------
Changed
^^^^^^^
* Added a debugging hook in the :mod:`.idle` module.
* The :func:`.fslsub.submit` function is now more flexible in the way it
accepts the command and input arguments.
* The :func:`.run.prepareArgs` function has been renamed (from
``_prepareArgs``).
2.6.1 (Thursday 19th September 2019)
------------------------------------
......
......@@ -62,7 +62,7 @@ copyright = u'{}, Paul McCarthy, University of Oxford, Oxford, UK'.format(
# Links to other things
rst_epilog = """
.. |fsleyes_apidoc| replace:: FSLeyes
.. _fsleyes_apidoc: http://users.fmrib.ox.ac.uk/~paulmc/fsleyes_apidoc/index.html
.. _fsleyes_apidoc: http://users.fmrib.ox.ac.uk/~paulmc/fsleyes/userdoc/latest/index.html
"""
......
......@@ -4,7 +4,23 @@
The ``fslpy`` package is a collection of utilities and data abstractions used
by |fsleyes_apidoc|_.
within `FSL <https://fsl.fmrib.ox.ac.uk/fsl/fslwiki>`_ and by
|fsleyes_apidoc|_.
The top-level Python package for ``fslpy`` is called ``fsl``. It is broadly
split into the following sub-packages:
.. autosummary::
fsl.data
fsl.utils
fsl.scripts
fsl.transform
fsl.version
fsl.wrappers
.. toctree::
:hidden:
......
......@@ -55,7 +55,7 @@ import importlib
log = logging.getLogger(__name__)
def submit(command,
def submit(*command,
minutes=None,
queue=None,
architecture=None,
......@@ -70,9 +70,12 @@ def submit(command,
flags=False,
multi_threaded=None,
verbose=False):
"""Submits a given command to the cluster
"""
Submits a given command to the cluster
You can pass the command and arguments as a single string, or as a regular or unpacked sequence.
:arg command: single string with the job command
:arg command: string or regular/unpacked sequence of strings with the job command
:arg minutes: Estimated job length in minutes, used to auto-set
queue name
:arg queue: Explicitly sets the queue name
......@@ -101,7 +104,7 @@ def submit(command,
:return: string of submitted job id
"""
from fsl.utils.run import runfsl
from fsl.utils.run import runfsl, prepareArgs
base_cmd = ['fsl_sub']
......@@ -132,7 +135,7 @@ def submit(command,
base_cmd.append('-s')
base_cmd.extend(multi_threaded)
base_cmd.append(command)
base_cmd.extend(prepareArgs(command))
return runfsl(*base_cmd).strip()
......
......@@ -196,6 +196,13 @@ _idleCallRate = 200
"""
_idleAllowErrors = False
"""Used for testing/debugging. If ``True``, and a function called on the idle
loop raises an error, that error will not be caught, and the idle loop will
stop.
"""
def idleReset():
"""Reset the internal :func:`idle` queue state.
......@@ -211,6 +218,7 @@ def idleReset():
global _idleQueueDict
global _idleTimer
global _idleCallRate
global _idleAllowErrors
if _idleTimer is not None:
_idleTimer.Stop()
......@@ -221,11 +229,12 @@ def idleReset():
if queue is not None: newQueue = queue.Queue()
else: newQueue = None
_idleRegistered = False
_idleQueue = newQueue
_idleQueueDict = {}
_idleTimer = None
_idleCallRate = 200
_idleRegistered = False
_idleQueue = newQueue
_idleQueueDict = {}
_idleTimer = None
_idleCallRate = 200
_idleAllowErrors = False
# Call idleReset on exit, in
......@@ -294,6 +303,7 @@ def _wxIdleLoop(ev):
global _idleQueueDict
global _idleTimer
global _idleCallRate
global _idleAllowErrors
ev.Skip()
......@@ -342,6 +352,9 @@ def _wxIdleLoop(ev):
log.warning('Idle task {} crashed - {}: {}'.format(
taskName, type(e).__name__, str(e)), exc_info=True)
if _idleAllowErrors:
raise e
if task.name is not None:
try: _idleQueueDict.pop(task.name)
except KeyError: pass
......
......@@ -72,7 +72,7 @@ def dryrun(*args):
DRY_RUN = oldval
def _prepareArgs(args):
def prepareArgs(args):
"""Used by the :func:`run` function. Ensures that the given arguments is a
list of strings.
"""
......@@ -179,7 +179,7 @@ def run(*args, **kwargs):
logStdout = log .get('stdout', None)
logStderr = log .get('stderr', None)
logCmd = log .get('cmd', None)
args = _prepareArgs(args)
args = prepareArgs(args)
if not bool(submit):
submit = None
......@@ -345,7 +345,7 @@ def runfsl(*args, **kwargs):
if not prefixes:
raise FSLNotPresent('$FSLDIR is not set - FSL cannot be found!')
args = _prepareArgs(args)
args = prepareArgs(args)
for prefix in prefixes:
cmdpath = op.join(prefix, args[0])
if op.isfile(cmdpath):
......
......@@ -47,7 +47,7 @@ import re
import string
__version__ = '2.6.1'
__version__ = '2.6.2'
"""Current version number, as a string. """
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment