Function Blocks for Agents in Real-Time Workflows
The function blocks described in this section only apply for Python agents in real-time workflows. The available function blocks are:
timeout
stopInput
timeout
This function block is called when using the setTimeout function.
UDRs may be routed in a timeout function block. When possible, always route to an asynchronous route from the timeout function block.
def timeout(obj)Example - timeout function block
sessions = {}
def consume(input):
setTimeout(input.key, 1.2)
sessions[input.key] = sessions.get(input.key, 0) + input.value
def timeout(obj):
debug('Timed out, removing %s' % obj)
del sessions[obj]stopInput
Note!
This function block only applies for the Python collection agent.
This function block is called when the workflow does not want the collector to produce any more data.
def stopInput()Example - stopInput function block
def stopInput():
debug('stopInput called')