towhee.engine.graph_context.GraphContext

class towhee.engine.graph_context.GraphContext(ctx_idx: int, graph_repr: GraphRepr)[source]

Bases: object

GraphContext is a data processing network with one or multiple Operator. Each row of a Pipeline’s inputs will be processed individually by a GraphContext.

Parameters:
  • ctx_idx – (int) The index of this GraphContext.

  • graph_repr – (towhee.dag.GraphRepr) The DAG representation this GraphContext will implement.

Methods

gc

join

result

slow_down

Slow down the op whose df name it.

speed_up

spped up the op whose df name it.

stop

Attributes

dataframes

inputs

Returns the graph's input DataFrame.

op_ctxs

outputs

Returns the graph's output DataFrame.

__call__(inputs: Tuple)[source]

Call self as a function.

__init__(ctx_idx: int, graph_repr: GraphRepr)[source]
property inputs: DataFrame

Returns the graph’s input DataFrame.

Returns:

(towhee.dataframe.DataFrame)

The input DataFrame.

property outputs: DataFrame

Returns the graph’s output DataFrame.

Returns:

(towhee.dataframe.DataFrame)

The output DataFrame.

slow_down(df_name: str, time_sec: int)[source]

Slow down the op whose df name it.

speed_up(df_name: str)[source]

spped up the op whose df name it.