flowserv.controller.worker.code module

Execute a workflow code step.

class flowserv.controller.worker.code.CodeWorker(identifier: Optional[str] = None, volume: Optional[str] = None)

Bases: flowserv.controller.worker.base.Worker

Worker to execute workflow steps of type flowserv.model.workflow.step.CodeStep

exec(step: flowserv.model.workflow.step.CodeStep, context: Dict, store: flowserv.volume.fs.FileSystemStorage) flowserv.controller.serial.workflow.result.ExecResult

Execute a workflow step of type flowserv.model.workflow.step.CodeStep in a given context.

Captures output to STDOUT and STDERR and includes them in the returned execution result.

Note that the code worker expects a file system storage volume.

Parameters
  • step (flowserv.model.workflow.step.CodeStep) – Code step in a serial workflow.

  • context (dict) – Context for the executed code.

  • store (flowserv.volume.fs.FileSystemStorage) – Storage volume that contains the workflow run files.

Return type

flowserv.controller.serial.workflow.result.ExecResult

class flowserv.controller.worker.code.OutputStream(stream)

Bases: object

Output stream for standard output and standard error streams when executing a Python function.

close()
flush()
write(text)
writelines(iterable)