Here is an example of a script as a local native Python task: This example shows that we can still take advantage of pre-processing and variable substitution. This will work on the manual and comments section, these will also be pre-processed.
There are several ways of doing this. The following are examples.
- There are two ways of accessing the ecFlow child commands (init, event, meter, label, abort, complete).
We can either call the child commands directly using ecFlow extension, or we can call system command to access ecflow_client.
The following examples will use the ecFlow Python extension. This requires that the PYTHONPATH is set to the directory where ecflow.so extension was installed.
definition file:
The default ECF_MICRO is %, this may interfere with your Python scripts. In this case you either redefine it, in the task definition or directly in the Python script.task python edit ECF_EXTN .py. # search for python.py edit ECF_MICRO '$' edit ECF_JOB_CMD 'python $ECF_JOB$ > $ECF_JOBOUT$ 2>&1' label info "none" meter step -1 100 100 event my_event
Notice that the ECF_JOB_CMD calls Python. This allows us to change the Python version, within the viewer. Alternatively it can be omitted, providing we add "#!/usr/bin/env python" as the first line of our Python script.
Header: head.py
task wrapper: