towhee.runtime.operator_manager.operator_action.OperatorAction

class towhee.runtime.operator_manager.operator_action.OperatorAction[source]

Bases: object

Action wrapper.

Different types of operations are loaded into this wrapper for the DAG, each operators can be loaded and run in different ways.

Methods

from_callable

Create an Action for callable op.

from_hub

Create an Action for hub op.

from_lambda

Create an Action for lambda op.

serialize

Attributes

type

__init__()[source]
static from_callable(fn)[source]

Create an Action for callable op.

Parameters:

fn (callable) – The callable function for op.

Returns:

The action.

Return type:

Action

static from_hub(name, args, kwargs)[source]

Create an Action for hub op.

Parameters:
  • name (str) – The op name or the path to an op.

  • args (list) – The op args.

  • kwargs (dict) – The op kwargs.

Returns:

The action.

Return type:

Action

static from_lambda(fn)[source]

Create an Action for lambda op.

Parameters:

fn (lambda) – The lambda function for op.

Returns:

The action.

Return type:

Action