Execute Python Script
Description
Execute Python Script is a step in the Scripting Plugin for Process Studio Workflows. This step is used to execute Python Script.
Recommendation: For more accurate execution results, we recommend using Python version 3.8.10 and above.
Prerequisites
-
Install Anaconda, Minimum version 4.2.0
-
No need for separate python installation, Anaconda takes care of python installation.
-
Anaconda should be in the PATH.
i. This can be conveniently achieved by enabling “Anaconda in PATH” checkbox during Anaconda installation else,
ii. Manually set Anaconda in the PATH environment variable by adding the following to the path
iii.
<ANACONDA_BASE>; <ANACONDA_BASE>\Library\mingw-w64\bin;
<ANACONDA_BASE>\Library\usr\bin; <ANACONDA_BASE>\Library\bin;
<ANACONDA_BASE>\Scripts;
Configurations
No. | Field Name | Description |
---|---|---|
1 | Step name | Specify the name of the step as it appears in the workflow workspace. This name has to be unique in a single workflow. |
Row Handling: | ||
2 | No. of rows to process | Select No. of rows to process for row handling from input steps data frames from the following, - All - Row by Row or - Batch: If batch is selected a value needs to be provided in the size field. |
3 | Reservoir Sampling | Enable checkbox to randomly sample rows from an incoming data stream. If checkbox is enabled a value needs to be provided in the size field. Random seed field is also enabled and user can provide a value. |
4 | Random seed | Random seed is enabled only if Reservoir checkbox is enabled. Provide a value to use for seeding the random number generator. Repeating a workflow with a different value for the seed will result in a different random sample being chosen. |
Options: | ||
5 | Include Input Fields as Output Fields checkbox | Enable this checkbox to include incoming fields as output fields. |
Input Frames: | ||
6 | Step name | Input step name are visible here in a dropdown list. Data from input steps is available as a Data frame. |
7 | Pandas frame name | Provide Pandas frame name for step name above. Or else use system generated name (for e.g. ps_data0) |
Field Name | Description |
---|---|
Python Script | |
Load Script from file at Runtime | Enable checkbox to load python script dynamically from a file at runtime. |
Script file Location and Browse button | Browse for the python script file. |
Manual Python Script | It is a free textbox where user can write Python Script. |
Python Variables to get | Provide output variable name or frame name from the python script. |
Continue on unset variables | Enable checkbox to specify: Don’t raise an error if specified variables are not set in python after script has executed. |
No. | Field Name | Description |
---|---|---|
Output Fields: | ||
1 | Output Fields: | |
1 | Name | Get the name of python output fields. |
2 | Type | Provide the data type of the field above. |
Buttons: | ||
1 | Vars to Fields | Click button to get Python frame. |
2 | Get Frame Fields | Click button to the Frame fields. |
3 | Include frame row index as an output field checkbox | Enable checkbox to Include frame row index as an output field. |