-
Notifications
You must be signed in to change notification settings - Fork 59
Adding BoshTask #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding BoshTask #231
Conversation
@ValHayot @glatard, @satra - I've started creating a draft of You can see the output message I get from |
Hi @djarecka, it looks like the input files aren't mounted in the tool container. By default, |
@glatard -oh, ok, thanks! somehow I assumed that everything has to be mounted automatically (as in cwl). |
@glatard - could you please tell me what is the easiest way to get information about all the outputs that should be produced for the specific zenodo and and inputs (the invocation file) |
…s for templates with or w/o extensions
@satra - please check the tests for as we discussed yesterday I used only zenodo files to create |
Codecov Report
@@ Coverage Diff @@
## master #231 +/- ##
==========================================
- Coverage 86.70% 84.07% -2.63%
==========================================
Files 17 18 +1
Lines 2896 3008 +112
Branches 781 808 +27
==========================================
+ Hits 2511 2529 +18
- Misses 242 333 +91
- Partials 143 146 +3
Continue to review full report at Codecov.
|
@djarecka - looks reasonable for a start - for the second workflow it would be nice to use the shelltask functionality where stdout is read into a variable so you could actually compare the output of the task. |
@satra - let me know if this is what you wanted me to add |
i'm randomly(?) getting error from |
… gives me an error on travis, not able to reproduce...)
any idea why sometimes I've added retry bloc... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments. of particular note is that the interaction between state and task in this class seems very specific. any such interaction should be abstracted away to taskbase.
pydra/engine/boutiques.py
Outdated
if input_spec is None: | ||
input_spec = self._prepare_input_spec() | ||
self.input_spec = input_spec | ||
if output_spec is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems that both for input_spec
and output_spec
there is no check that these align with the bosh spec if they are provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, haven't even tested it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decided to introduce input/output_spec_names
instead of input/output_spec
, so you can provide subset of names that should be used, but type, help_string, etc. is taken from the zenodo spec file. Otherwise I wasn't sure how to deal with conflicts in types, help_strings etc.
pydra/engine/boutiques.py
Outdated
) | ||
return cmd_list | ||
|
||
def _input_file(self, state_ind, ind=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and the previous function appears to interact with state. that seems odd to me. we should not be expecting people to understand state to write a task. thus far all tasks have been somewhat independent of state, and we should keep it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't understand your comment. pydra prepares the files, this is a private function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did not understand why this function is needed and how to convey to another developer that if they were to write the boutiques task they would need this function. what is the general role of this function? and how would another developer (say a CWL developer) know that this is needed. this seems to depend on state_ind
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function creates invocation
json file with inputs that is needed for bosh exec launch
. If task has splitter and provides two files for example for infile
input, I will create two invocation
files. I'm assuming that user doesn't know that bosh
requires this file, but just provides infile
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be the kind of thing that happens inside run_task
? i.e. the creation of this file is only required when you have the inputs already set. this is not an input to the task itself but to bosh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but this is used by command_args
property that is used in run_task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably use more specific name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see that ShellCommandTask
follows a similar pattern. conceptually does command_args
need to work for tasks with State
. is it used anywhere in that form?
wouldn't it be easier if these didn't have to think about state for command_args
and would raise an Exception if called when the Task has state, but would return the appropriate thing when the Task is stateless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't answer you right now. I didn't see a problem with it, but can rethink this in a different PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and I actually do think that it's nice to have, it helps with debugging
@@ -360,9 +359,23 @@ def _field_metadata(self, fld, inputs, output_dir): | |||
if "value" in fld.metadata: | |||
return output_dir / fld.metadata["value"] | |||
elif "output_file_template" in fld.metadata: | |||
return output_dir / fld.metadata["output_file_template"].format( | |||
**inputs.__dict__ | |||
sfx_tmpl = (output_dir / fld.metadata["output_file_template"]).suffixes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you detect suffixes. for imaging files or other modalities this may need to be quite custom? for example nii.gz
, BRIK/HEAD
, etc.,.
how will pydra generalize this across domains?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my main problem was that input_1
could be filename
, filename.nii
or filename.nii.gz
and output should be always filename.nii.gz
, and the templaete is [input_1].nii.gz
...
so I decided to remove all suffixes if template has it's own, happy to hear better suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that specific to bosh or boutiques that output is always compressed nifti? also does bosh/boutiques enforce nifti as output? i don't think anything in boutiques enforces it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you see example for bet - you will see that "output-files" has "path-template": "[MASK].nii.gz", but maskfile
(that has "value-key": "[MASK]"), could be either filename
or filename.nii.gz
. For both cases output-files
is filename.nii.gz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that may be true of bet, but boutiques can support other tools as well. so there needs to be a general way of deciding what the outputs would be.
this is the part where knowing what outputs should be created given the inputs plays a role, but i don't think that's captured in boutiques yet. so as a first pass, you can simply leave inputs/outputs as separate things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understood that it's not always a case, but I thought this is a good start. Not sure how do you want me to keep it separately. From the zenodo file I have only a template that uses inputs values
…sk: this allows for providing subset of names that should be used, but type, help_string, etc. is taken from the zenodo spec file
Types of changes
Summary
adding Shell Command Task that uses boutiques descriptor and runs bosh command to execute the task
(see discussion #210)
closes #37
Checklist
(we are using
black
: you canpip install pre-commit
,run
pre-commit install
in thepydra
directoryand
black
will be run automatically with each commit)Acknowledgment