Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/ansys/dpf/core/custom_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,31 @@
from ansys.dpf.gate import object_handler, capi, dpf_vector, integral_types


def update_virtual_environment_for_custom_operators(restore_original: bool = False):
"""Updates the dpf-site.zip file used to start a venv for Python custom operators to run in.
It updates the site-packages in dpf-site.zip with the site-packages of the current venv.
It stores the original dpf-site.zip in the users files.
Parameters
----------
restore_original:
If ``True``, restores the original dpf-site.zip.
"""
# Get the path to the dpf-site.zip in the current DPF server
current_dpf_site_zip_path = None
# Get the path to where we store the original dpf-site.zip
original_dpf_site_zip_path = None
# Restore the original dpf-site.zip
if restore_original:
return
# Otherwise get the path to the site_packages of the current virtual environment
current_site_packages_path = None
# Zip it
# Store original dpf-site.zip for this DPF Server
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand what this code is doing, sorry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cbellot000, updated to a working version, tested locally

# Update with new


def record_operator(operator_type, *args) -> None:
"""
Add an operator (with its name, run callback, and specification) to the DPF core registry.
Expand Down