-
Notifications
You must be signed in to change notification settings - Fork 23
Raise useful error on workflow.connect_with for wrong labels #2110
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
Raise useful error on workflow.connect_with for wrong labels #2110
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2110 +/- ##
==========================================
- Coverage 86.60% 86.58% -0.03%
==========================================
Files 90 90
Lines 10282 10284 +2
==========================================
- Hits 8905 8904 -1
- Misses 1377 1380 +3 |
src/ansys/dpf/core/workflow.py
Outdated
out.append(self._api.work_flow_output_by_index(self, i)) | ||
return out | ||
|
||
def safe_connect_with( |
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.
safe
may be misleading, as to me it would mean 'if you use this function, you can be sure that what you asked for has been checked and is valid', not 'I'll only connect what can be and ignore the rest'.
Something like soft_connect_with
maybe?
@PProfizi To answer the question in the description, the original problem is that before we were crashing in the kernel and not raisin in Python, so in any way the connection with wrong labels was not warking (the process couldn't be run end-to-end). Therefore, why having a new method? |
Because weirdly it did not crash all the time, for example in PyDPF-Post's tests I have to update calls because workflow connections with unavailable inputs or outputs are done all the time, without raising and without crashing. |
Just to sum-up:
|
Thanks for summarizing everything so clearly. I think that the followed approach (with the 2 methods) is the right one giving all the compatibility restrictions |
@rafacanton I ended-up adding the |
Solves #928
PR on PyDPF-Post will make use of new
Workflow.safe_connect_with()
.Edit: not sure about the naming. Should it rather be
Workflow.connect_with_available
, or something else? @BClappeAlso I realize that changing the behavior of
Workflow.connect_with
to now raise if an input or output is unavailable, is a breaking change of a sort. Maybe we should actually keepconnect_with
as-is or even put the filtering logic there, and create a new methodWorkflow.connect_with_error
which raises in the case of an unavailable input or output. What do you think?