Skip to content

Conversation

@djarecka
Copy link
Collaborator

@djarecka djarecka commented Aug 17, 2019

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary

Checklist

  • All tests passing
  • I have added tests to cover my changes
  • I have updated documentation (if necessary)
  • My code follows the code style of this project
    (we are using black: you can pip install pre-commit,
    run pre-commit install in the pydra directory
    and black will be run automatically with each commit)

Acknowledgment

  • I acknowledge that this contribution will be available under the Apache 2 license.

… it in Task.results(), removing self.results_dict
@djarecka djarecka changed the title changes in checksums/results and some fixes (fixes#107) [wip] changes in checksums/results and some fixes (fixes#107) Aug 17, 2019
…after the workflow is addded to another workflow, fixing nipype#107
@codecov
Copy link

codecov bot commented Aug 17, 2019

Codecov Report

Merging #130 into master will decrease coverage by <.01%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #130      +/-   ##
==========================================
- Coverage   87.08%   87.08%   -0.01%     
==========================================
  Files          16       16              
  Lines        2339     2354      +15     
  Branches      574      580       +6     
==========================================
+ Hits         2037     2050      +13     
- Misses        207      208       +1     
- Partials       95       96       +1
Flag Coverage Δ
#unittests 87.08% <93.33%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pydra/engine/submitter.py 91.17% <ø> (-0.17%) ⬇️
pydra/engine/state.py 94.95% <100%> (+0.02%) ⬆️
pydra/engine/core.py 87.56% <93.1%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f5c43ec...5bdbb62. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 17, 2019

Codecov Report

Merging #130 into master will increase coverage by 0.01%.
The diff coverage is 93.93%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #130      +/-   ##
=========================================
+ Coverage   87.08%   87.1%   +0.01%     
=========================================
  Files          16      16              
  Lines        2339    2358      +19     
  Branches      574     583       +9     
=========================================
+ Hits         2037    2054      +17     
- Misses        207     208       +1     
- Partials       95      96       +1
Flag Coverage Δ
#unittests 87.1% <93.93%> (+0.01%) ⬆️
Impacted Files Coverage Δ
pydra/engine/submitter.py 91.34% <100%> (ø) ⬆️
pydra/engine/state.py 94.95% <100%> (+0.02%) ⬆️
pydra/engine/core.py 87.62% <93.33%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f5c43ec...2ec3b7f. Read the comment docs.


def _run(self, **kwargs):
self.inputs = dc.replace(self.inputs, **kwargs)
# self.inputs = dc.replace(self.inputs, **kwargs) don't need it?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was there to ensure that inputs could be set via the run command (when it was not a private function) or as a function call. as long as this is the case within __call__ it would be ok to remove this. i.e. a user should be able to set inputs during the call to a task (much like a python function).

if **kwargs is not being used, it should be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, i see, we have kwargs in the __call__ that is passing to _run, but had no tests for it, so I couldn't find who is using this. will keep it and add a test

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a test

"""adding a task to the workflow"""
if not is_task(task):
raise ValueError("Unknown workflow element: {!r}".format(task))
task._reset()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to happen at every add call? or could this be done just prior to run or perhaps more preferably at the end of a run?


async def _run(self, submitter=None, **kwargs):
self.inputs = dc.replace(self.inputs, **kwargs)
# self.inputs = dc.replace(self.inputs, **kwargs) don't need it?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as before.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not allow running a workflow without a submitter, so I believe this can't be used

@satra
Copy link
Contributor

satra commented Aug 18, 2019

overall looks good. the only question i have is whether the reset can be called at the end of a run by the submitter, instead of during add. if so it may also help with the checksum issue.

checksum1  = task.checksum
result = task(param1=2, param2=3)
checksum2 = task.checksum
assert checksum1 == checksum2

@djarecka
Copy link
Collaborator Author

@satra - I'm just working on moving the reset to Submitter, so running workflow twice doesn't create a new output_dir, but other tests just started failing... might be related to asyncio, will try to think about it a bit more

…firm that worflowas that run twice do not create additional output_dir
…ly is set only at the beginning of execution after the graph is sorted) and adding it if needed
@djarecka
Copy link
Collaborator Author

@satra - at the end I just moved wf._reset to the end of Submitter.__call__. Wanted to put in more specific place but was having some issues.

about comparing the checksum, in addition to the issue with resetting the connections, there was one more thing - we added _graph_checksums to inputs, and this is usually created in the submitter when the graph has all the nodes and it can sort it.
I've added a line to checksum that allow to set this before running.

@djarecka djarecka changed the title [wip] changes in checksums/results and some fixes (fixes#107) changes in checksums/results and some fixes (fixes#107) Aug 18, 2019
Copy link
Contributor

@satra satra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thank you for tracking this down.

@satra satra merged commit 7ffa49d into nipype:master Aug 18, 2019
@djarecka djarecka deleted the checksum_resets branch December 30, 2022 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

workflow_as_node does not update the input (if it was run already)

2 participants