ploomber.OnlineDAG

class ploomber.OnlineDAG

Execute partial DAGs in-memory. This is an abstract class, to use it. Create a subclass and provide the required static methods.

See here for a complete example: https://github.com/ploomber/projects/blob/master/templates/ml-online/src/ml_online/infer.py

Methods

get_partial()

Must return the location of a partial dag (str or pathlib.Path)

init_dag_from_partial(partial)

Initialize partial returned by get_partial()

predict(**kwargs)

Run the DAG

terminal_params()

Must return a dictionary with parameters passed to terminal_task

terminal_task(upstream, model)

Las function to execute.

abstract static get_partial()

Must return the location of a partial dag (str or pathlib.Path)

classmethod init_dag_from_partial(partial)

Initialize partial returned by get_partial()

predict(**kwargs)

Run the DAG

Parameters:

**kwargs – One parameter per root task (task with no upstream dependencies) in the partial DAG.

Returns:

A dictionary with {task_name

Return type:

returned_value}

abstract static terminal_params()

Must return a dictionary with parameters passed to terminal_task

abstract static terminal_task(upstream, model)

Las function to execute. The upstream parameter contains the output of all tasks that have no downstream dependencies