Import this package for MDW Python language support.
This package adds the Python Script activity to MDW's Toolbox. Like script activities for other languages, once dragged onto the process design canvas, its source can be edited by clicking the Edit link on the Configurator Design tab (or by right-clicking on the activity and selecting Open Python).
All process variables are implicitly available to read or assign by their name. For example, PythonTest.proc in the script autotests package. has a string variable named 'message' which is assigned a value in the A3 Python script activity like so:
message = 'Hello'
Even variables with Java types can be accessed similarly. In the same test process activity 'person', which is a Jsonable is accessed as follows:
name = person.getName()
As with other script activities, the ActivityRuntimeContext
is accessible as runtimeContext
:
runtimeContext.logDebug('Executing ' + runtimeContext.activity.name)
Although Python scripts don't ordinarily have a return value, an MDW Python activity can return a value which acts as the activity result code:
return 'onward'
You can create Python modules in MDW as assets with extension '.py'. You can import from these modules for reuse in your script activities. Here's an example from the 'Use Module' activity in PythonTest.proc that imports functions from pymodule.py via the package-qualified module name:
from com.centurylink.mdw.tests.script.pymodule import square, greet
# ...
message = greet(name, message)