-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: add WorkflowTopology class and workflow_to_workflow_topology operator #1902
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1902 +/- ##
==========================================
+ Coverage 86.62% 88.40% +1.77%
==========================================
Files 83 89 +6
Lines 9973 10225 +252
==========================================
+ Hits 8639 9039 +400
+ Misses 1334 1186 -148 |
849d50f
to
4ff8c4e
Compare
@@ -481,6 +482,11 @@ def _type_to_output_method(self): | |||
self._api.operator_getoutput_as_any, | |||
lambda obj, type: any.Any(server=self._server, any_dpf=obj).cast(type), | |||
), | |||
( |
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.
@Matteo-Baussart-ANSYS can a Workflow also potentially take in or output a WorkflowTopology object?
Can an operator take a WorkflowTopology as input?
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.
WorkflowTopology can be the output for an Operator and from a Workflow. Following syntaxes are tested:
# For operator outputs
workflow_to_workflow_topology_op.outputs.workflow_topology()
workflow_to_workflow_topology_op.get_output(0, WorkflowTopology)
# For workflow outputs
workflow_topology = dpf_workflow_wrapper.get_output("output", WorkflowTopology)
As for inputs, there is currently no operator requiring a CustomContainerBase
as input.
src/ansys/dpf/core/helpers/utils.py
Outdated
@@ -48,3 +48,19 @@ def _sort_supported_kwargs(bound_method, **kwargs): | |||
warnings.warn(txt) | |||
# Return the accepted arguments | |||
return kwargs_in | |||
|
|||
|
|||
def indent(text, subsequent_indent="", initial_indent=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.
@Matteo-Baussart-ANSYS this will need a docstring with description and parameters. Also typehinting?
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 added docstring and typehinting
@@ -953,6 +953,15 @@ def to_graphviz(self, path: Union[os.PathLike, str]): | |||
"""Saves the workflow to a GraphViz file.""" | |||
return self._api.work_flow_export_graphviz(self, str(path)) | |||
|
|||
def get_topology(self): |
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.
@Matteo-Baussart-ANSYS same, missing a docstring and typehinting
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 added docstring and typehinting
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
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 will need a title, reference tag and description. You can find examples of that being done in other modules.
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 added titles and descriptions
from ansys.dpf.core.custom_container_base import CustomContainerBase | ||
|
||
|
||
class DataConnection(CustomContainerBase): |
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.
@Matteo-Baussart-ANSYS again, missing docstrings and typehinting everywhere
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 added docstrings and typehinting
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.
Some specific questions, but a general request is to add docstrings, module headers, typehinting, and improve coverage.
src/ansys/dpf/core/common.py
Outdated
_derived_class_name_to_type = None | ||
|
||
|
||
def derived_class_name_to_type(): |
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.
could you please add a docstring here?
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 added a docstring and typehints
not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0, | ||
reason="Operator `workflow_to_workflow_topology` does not exist below 10.0", | ||
) | ||
def test_workflow_get_topology(workflow): |
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.
for this test, could you please replace
@pytest.mark.skipif(
not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0, by the decorator defined in conftest that checks that the error message would be meaningful if a use with a lower version uses get_topology
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 used the decorator @raises_for_servers_version_under("10.0")
, and added a raise DpfVersionNotSupported("10.0")
in Workflow.get_topology()
.
This adds the PyDPF support of the
WorkflowData
class andworkflow_to_workflow_topology
operator,