The custom_operator.py module#

Summary#

CustomOperatorBase

Base class interfacing CPython Custom Operators which can be used as regular DPF Operators in any API.

update_virtual_environment_for_custom_operators

Update the dpf-site.zip file used to start a venv for Python custom operators to run in.

record_operator

Add an operator (with its name, run callback, and specification) to the DPF core registry.

Description#

Custom Operator Base.

Contains utilities allowing you to implement and record custom Python operators.

Module detail#

custom_operator.update_virtual_environment_for_custom_operators(restore_original: bool = False)#

Update 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 for future restoration.

Note

This feature is only available InProcess to ensure compatibility of the current venv client-side with the machine where the server is run.

Parameters:

restore_original – If True, restores the original dpf-site.zip.

custom_operator.record_operator(operator_type, *args) None#

Add an operator (with its name, run callback, and specification) to the DPF core registry.

Parameters:
  • operator_type (type, CustomOperatorBase) – Class type inheriting from CustomOperatorBase. name and specification properties are called and run method callback is given to DataProcessingCore.

  • *args – Forwarded arguments passed in load_operators method