Do not allow the copy or deepcopy of Node, except for Data #1705
Conversation
63db99b to
24ca54e
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1705 +/- ##
===========================================
+ Coverage 56.4% 56.41% +0.01%
===========================================
Files 275 275
Lines 33931 33912 -19
===========================================
- Hits 19139 19132 -7
+ Misses 14792 14780 -12
Continue to review full report at Codecov.
|
|
Why is this blocked Seb? Do you want a review or should it wait? |
|
It was blocked by #1704 but that is now merged, so I will rebase and then it is ready for review |
24ca54e to
6e332b9
Compare
6e332b9 to
80cca3b
Compare
There was a problem hiding this comment.
Can we raise on is_stored asking the user to use clone instead.
|
@muhrin I have addressed the issue and its ready for review |
9abe1c7 to
ced9d11
Compare
We explicitly disallow calling the functions copy and deepcopy from the python copy module on a Node instance. The reason is that the behavior of this for a Calculation node, with respect to what should be returned and how this would affect the graph, is not clear. Rather, to clone a Calculation, the caching mechanism should be used or a new ProcessBuilder could be generated from a completed Process that would recreate the necessary inputs that could then easily be relaunched. For Data nodes, the behavior can be defined a bit better. Therefore we allow to call deepcopy on a Data node, which will call the internal clone method, which will return an identical, but unstored, clone of the original Data node. The clone will have no links and a newly generated UUID.
Deep copying an unstored node is fine however and just pipes through to the clone method.
ced9d11 to
220c3ea
Compare
|
@giovannipizzi could you please give this a look so it can be merged. It can be quite a problem for people running |
giovannipizzi
left a comment
There was a problem hiding this comment.
Good for me!
Does this need also @muhrin's review to get unlocked?
|
He already was agreed provided I made the one update, which I did, so I am pretty sure he is on board_ |
Fixes #1699
We explicitly disallow calling the functions copy and deepcopy
from the python copy module on a Node instance. The reason is that
the behavior of this for a Calculation node, with respect to what
should be returned and how this would affect the graph, is not clear.
Rather, to clone a Calculation, the caching mechanism should be
used or a new ProcessBuilder could be generated from a completed
Process that would recreate the necessary inputs that could then
easily be relaunched.
For Data nodes, the behavior can be defined a bit better. Therefore
we allow to call deepcopy on a Data node, which will call the internal
clone method, which will return an identical, but unstored, clone of
the original Data node. The clone will have no links and a newly
generated UUID.