Skip to content

Commit 280ab36

Browse files
authored
adding force=False as a kwarg for Task constructor (#953)
* adding force=False as a kwarg to the constructor so it can be passed into the Task when using rest queries * bring documentation line back in * flake8
1 parent cec809d commit 280ab36

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ibllib/pipes/tasks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class Task(abc.ABC):
116116
on_error = 'continue' # whether to raise an exception on error ('raise') or report the error and continue ('continue')
117117

118118
def __init__(self, session_path, parents=None, taskid=None, one=None,
119-
machine=None, clobber=True, location='server', scratch_folder=None, on_error='continue', **kwargs):
119+
machine=None, clobber=True, location='server', scratch_folder=None, on_error='continue', force=False, **kwargs):
120120
"""
121121
Base task class
122122
:param session_path: session path
@@ -129,6 +129,7 @@ def __init__(self, session_path, parents=None, taskid=None, one=None,
129129
data required for task downloaded via one), 'AWS' (remote compute node, data required for task downloaded via AWS),
130130
or 'SDSC' (SDSC flatiron compute node)
131131
:param scratch_folder: optional: Path where to write intermediate temporary data
132+
:param force: whether to re-download missing input files on local server if not present
132133
:param args: running arguments
133134
"""
134135
self.on_error = on_error
@@ -144,6 +145,7 @@ def __init__(self, session_path, parents=None, taskid=None, one=None,
144145
self.machine = machine
145146
self.clobber = clobber
146147
self.location = location
148+
self.force = force
147149
self.plot_tasks = [] # Plotting task/ tasks to create plot outputs during the task
148150
self.scratch_folder = scratch_folder
149151
self.kwargs = kwargs
@@ -500,7 +502,7 @@ def assert_expected_inputs(self, raise_error=True, raise_ambiguous=False):
500502
_logger.warning('Some files are not ALF datasets and will not be checked for ambiguity')
501503
if any(map(len, variant_datasets.values())):
502504
# Keep those with variants and make paths relative to session for logging purposes
503-
to_frag = lambda x: x.relative_to_session().as_posix() # noqa
505+
def to_frag(x): return x.relative_to_session().as_posix() # noqa
504506
ambiguous = {
505507
to_frag(k): [to_frag(x) for x in v]
506508
for k, v in variant_datasets.items() if any(v)}

0 commit comments

Comments
 (0)