Versions Compared

Key

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

...

  • UDR Related Functions
  • Debug Related Functions
  • MIM Related Functions
  • Misc Functions
  • Dynamic Functions
  • Timeout Functions
  • Log Related Functions
  • Functions for Python Agents in Batch Workflows Only

UDR Related Functions

udrRoute

This function routes a UDR or bytearray to all the output routes, or a named output route.

...

Info
titleExample - udrRoute


Code Block
def consume(input):
    if isinstance(input, InstallModel):
        udrRoute(input, 'install')
    else:
        udrRoute(input) 


udrCreate

This function creates a new UDR of the specified type, and can take keyword arguments to set its fields.

...

Info
titleExample - udrCreate


Code Block
#
# The following shows six different ways of creating UDRs
#

from ultra.MyFolder.MyUltra import MyUDR

myudr1 = MyUDR(field1=33, field2=88)

myudr2 = MyUDR()
myudr2.field1 = 33
myudr2.field2 = 88

myudr3 = udrCreate(MyUDR, field1=33, field2=88)

myudr4 = udrCreate(MyUDR)
myudr4.field1 = 33
myudr4.field2 = 88

myudr5 = udrCreate("MyFolder.MyUltra.MyUDR", field1=33, field2=88)

myudr6 = udrCreate("MyFolder.MyUltra.MyUDR")
myudr6.field1 = 33
myudr6.field2 = 88


udrIsPresent

 This function returns True if the UDR field is present.

...

Info
titleExample - udrIsPresent


Code Block
if udrIsPresent(myudr, 'field1'):
    debug("The optional field 'field1' is present") 


udrUnsetPresent

 This function marks an optional attribute for a UDR as not present.

...

ParameterDescription
udrThe UDR
attrThe attribute name
ReturnsNothing

udrConsume

Note
titleNote!

This function applies for the Python Connector agent only.

...

ParameterDescription
timeoutThe timeout in seconds, which waits forever if no timeout is specified
ReturnsThe UDR or bytearray routed, or None if timed out while waiting

Debug Related Functions

debug

This function prints the supplied object to the output target specified in the Execution tab of the Workflow Properties dialog. 

...

ParameterDescription
obj

The object to write to debug output. The object can be of any type.

Note that printing a UDR type will dump all the field values, which may be a large amount of data. Similarly, the debug output for a table, map, list or bytearray type may be very large.

The output is the string representation of object.

ReturnsNothing

isDebugEnabled

This function states if debugging has been enabled for the workflow. A debug event is only sent if isDebugEnabled returns True.

...

ParameterDescription
ReturnsTrue or False depending on if debug is enabled or not

MIM Related Functions

mimGet

This function returns the value of a MIM resource available in the workflow. 

...

Info
titleExample - mimGet


Code Block
mimGet("Workflow", "Batch Count") # Retrieving a MIM resource owned by the workflow.
mimGet("Python_1", "Source File Count") # Retrieving a MIM resource owned by the agent "Python_1".


mimSet

This function assigns a value to a user defined MIM resource. The function may be called at any time. Note that it is the responsibility of the user to make sure the MIM value is available in accordance with the specified assigned type.

...

Info
titleExample - mimSet


Code Block
mimSet("My MIM", 88)


Misc Functions

abort

Note
titleNote!

This function does not apply for the Python Connector agent.

...

Info
titleExample - abort


Code Block
abort("The processing failed, aborting this workflow!")


wfStop

This function stops a running workflow. wfStop produces a single stop signal and does not wait for the workflow to stop. If it succeeds in stopping the workflow, the stop is registered in the System Log. 

...

Info
titleExample - wfStop


Code Block
wfStop("Default.MyWorkflow.workflow_1")


isStopped

Note
titleNote!

This function does not apply for the Python Connector agent.

...

Info
titleExample - isStopped


Code Block
if not isStopped():
    debug('Not stopped yet')


Dynamic Functions

dynamicFieldGet

This function retrieves the stated dynamic field from the workflow instance table. The returned value can either be a boolean, an integer, or a string. 

...

Info
titleExample - dynamicFieldGet


Code Block
dynamicFieldGet('Control', 'Filename')


Timeout Functions

Note
titleNote!

The timeout functions only apply for the Python collection and processing agents in real-time workflows.

setTimeout

A timeout can be set to trigger delayed actions, see the def timeout(obj) function block in 9.63.5.12 1.2 Function Blocks for Agents in Real-Time Workflows. The timeout is in seconds. Setting a timeout on an object sets or updates the current timeout in seconds on that object. A timeout is triggered once on the object, and then it has to be set again to be repeated.

...

ParameterDescription
objThe object can be of any type
timeoutThe timeout in seconds
ReturnsNothing

removeTimeout

A timeout can be removed, see the def timeout(obj) function block in 9.63.5.1.12 2 Function Blocks for Agents in Real-Time Workflows. The timeout is in seconds.

...

ParameterDescription
objThe same object as used in setTimeout
ReturnsNothing

Log Related Functions

logInformation

This function logs a message string to the System Log of type information.

...

ParameterDescription
messageA message appearing in the log
ReturnsNothing

logWarning

This function logs a message string to the System Log of type warning.

...

ParameterDescription
messageA message appearing in the log
ReturnsNothing

logError

This function logs a message string to the System Log of type error.

...

ParameterDescription
messageA message appaering in the log
ReturnsNothing

logException

This function logs the current exception to the System Log.

...

Info
titleExample - logException


Code Block
try:
    some_function()
except:
    # Log exception to the System Log instead of aborting the workflow.
    logException()



formatException

This function formats the current exception and returns the string.

...

ParameterDescription
ReturnsThe current exception formatted as a string

 Functions for Python Agents in Batch Workflows Only

The following functions only apply for the Python agents in batch workflows.

beginBatch

Note
titleNote!

This function only applies for Python collection agents in batch workflows.

...

Info
titleExample - beginBatch


Code Block
def execute():
    beginBatch()
    udrRoute(PulseUDR())
    endBatch()


endbatch

Note
titleNote!

This function only applies for Python collection agents in batch workflows.

...

ParameterDescription
ReturnsNothing

cancelBatch

This function emits a Cancel Batch that aborts the processing of the current batch and possibly continues with the next batch (depending on the workflow configuration).

...

Info
titleExample - cancelBatch


Code Block
cancelBatch("Cancel this batch")


splitBatch

Note
titleNote!

This function only applies for Python collection agents in batch workflows.

...

ParameterDescription
ReturnsNothing

hintEndBatch

This function sends a Hint End Batch message to the collection agent in the workflow, possibly causing a split of the current batch being processed.

...

ParameterDescription
ReturnsNothing

getTransactionId

This function returns the current transaction id, or None if there is currently no active transaction.

...