Skip to content

[fix] fix for output that are numpy.array (closes #270, #339) #340

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

Closed
wants to merge 1 commit into from

Conversation

djarecka
Copy link
Collaborator

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

yet another place that should be fixed for numpy.array as an output (test added)

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.

@codecov
Copy link

codecov bot commented Sep 10, 2020

Codecov Report

Merging #340 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #340   +/-   ##
=======================================
  Coverage   85.80%   85.80%           
=======================================
  Files          20       20           
  Lines        3713     3713           
  Branches     1000     1000           
=======================================
  Hits         3186     3186           
  Misses        337      337           
  Partials      190      190           
Flag Coverage Δ
#unittests 85.80% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pydra/engine/helpers.py 84.40% <100.00%> (ø)

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 79573fd...89c1f45. Read the comment docs.

@@ -156,7 +156,7 @@ def copyfile_workflow(wf_path, result):
for field in attr_fields(result.output):
value = getattr(result.output, field.name)
new_value = _copyfile_single_value(wf_path=wf_path, value=value)
if new_value != value:
if not (new_value is value or new_value == value):

Choose a reason for hiding this comment

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

I am afraid that this won't work for numpy arrays new_value and value that are different from each other.

It will result in a boolean array (same size results in elementwise comparison) or raises an exception in the future (elementwise comparison is deprecated for arrays of different sizes).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is why I added new_value is value part for numpy arrays.
Do you have an example that doesn't work with it? Could you please post it. I believe the one you send in #270 should work (added very similar test)

Copy link

@daniel-ge daniel-ge Sep 10, 2020

Choose a reason for hiding this comment

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

Sorry, I was wrong I guess. Because of _copyfile_single_value a case like value = np.array([1,2,3]) and new_value = np.array([4,5,6]) will never happen, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@daniel-ge - sorry, but I've missed the main problem that the numpy arrays should not be here at all. I will review the code more carefully and post a new PR

@djarecka
Copy link
Collaborator Author

open a new pr: #344

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.

2 participants