Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To achieve this goal, follow these steps:

  1. Define Decide which version image flavour of the Python engine to run.

  2. For your partition, request a new Calculation Engine of the type Python via PlatformManager. (The engine is then executed through a Job Trigger Calculation.)

  3. Write your logic, script and test it.

...

Code Block
languagegroovy
// These parameters will be available to the python job using `pyfx.get_context().parameters()`
def params = [
        foo: 1234,
        bar: "'baz"',
]

// The python script you want to run
def script = """'''
import pyfx
foo = pyfx.get_context().parameters()["foo"]
print(f'Hello {foo}')
"""''')

model.startJobTriggerCalculation(
        "'cregistry.pricefx.eu/engineering/pricefx-python-engine/datascience"',
        "'latest"', // NOTE for production you *should* change this to a specific version to avoid unexpected breakage
        api.jsonEncode([script: script, parameters: params]),
        "'py"'
)

Example Logic

You can find a complete sample logic using the Python engine at https://gitlab.pricefx.eu/logic/python-engine-samples-logic.

...