The eoworkflow module, together with eotask and eodata, provides core building blocks for specifying and executing workflows.

A workflow is a directed (acyclic) graph composed of instances of EOTask objects. Each task may take as input the results of other tasks and external arguments. The external arguments are passed anew each time the workflow is executed. The workflow builds the computational graph, performs dependency resolution, and executes the tasks. If the input graph is cyclic, the workflow raises a CyclicDependencyError.

The result of a workflow execution is an immutable mapping from tasks to results. The result contains tasks with zero out-degree (i.e. terminal tasks).

The workflow can be exported to a DOT description language and visualized.

exception eolearn.core.eoworkflow.CyclicDependencyError[source]

Bases: ValueError

This error is raised when trying to initialize EOWorkflow with a cyclic dependency graph

class eolearn.core.eoworkflow.EOWorkflow(dependencies, task_names=None)[source]

Bases: object

A basic eo-learn object for building workflows from a list of task dependencies


workflow = EOWorkflow([  # task1, task2, task3 are initialized EOTasks
    (task1, [], 'My first task'),
    (task2, []),
    (task3, [task1, task2], 'Task that depends on previous 2 tasks')

dependencies (list(tuple or Dependency)) – A list of dependencies between tasks, specifying the computational graph.


Creates a directed graph from dependencies


dependencies (list(Dependency)) – A list of Dependency objects


A directed graph of the workflow

Return type


execute(input_args=None, monitor=False)[source]

Executes the workflow

  • input_args (dict(EOTask: dict(str: object) or tuple(object))) – External input arguments to the workflow. They have to be in a form of a dictionary where each key is an EOTask used in the workflow and each value is a dictionary or a tuple of arguments.

  • monitor (bool) – If True workflow execution will be monitored


An immutable mapping containing results of terminal tasks

Return type


static parse_input_args(input_args)[source]

Parses EOWorkflow input arguments provided by user and raises an error if something is wrong. This is done automatically in the process of workflow execution


Returns an ordered dictionary {task_name: task} of all tasks within this workflow


Ordered dictionary with key being task_name (str) and an instance of a corresponding task from this workflow. The order of tasks is the same as in which they will be executed.

Return type



Generates the DOT description of the underlying computational graph


The DOT representation of the computational graph

Return type



Visualize the computational graph


filename (str) – Filename of the output image together with file extension. Supported formats: png, jpg, pdf, … . Check graphviz Python package for more options


The DOT representation of the computational graph, with some more formatting

Return type


class eolearn.core.eoworkflow.LinearWorkflow(*tasks, **kwargs)[source]

Bases: eolearn.core.eoworkflow.EOWorkflow

A linear version of EOWorkflow where each tasks only gets results of the previous task


workflow = LinearWorkflow(task1, task2, task3)

tasks (EOTask or (EOTask, str)) – Tasks in the order of execution. Each entry can either be an instance of EOTask or a tuple of an EOTask instance and a custom task name.

class eolearn.core.eoworkflow.Dependency(task=None, inputs=NOTHING, name=None)[source]

Bases: object

Class representing a node in EOWorkflow graph

  • task (EOTask) – An instance of EOTask

  • inputs (list(EOTask) or EOTask) – A list of EOTask instances which are dependencies of the given task

  • name (str or None) – Name of the Dependency node

Method generated by attrs for class Dependency.


Sets a new name


Provides custom task name according to given number. E.g. FooTask -> FooTask

class eolearn.core.eoworkflow.WorkflowResults(results)[source]

Bases: collections.abc.Mapping

The result of a workflow is an (immutable) dictionary mapping [1] from EOTasks to results of the workflow.

When an EOTask is passed as an index, its UUID, assigned during workflow execution, is used as the key (as opposed to the result of invoking __repr__ on the EO task). This ensures that indexing by task works even after pickling, and makes dealing with checkpoints more convenient.

[1] https://docs.python.org/3.6/library/collections.abc.html#collections-abstract-base-classes


Returns dictionary keys


Returns dictionary values


Returns dictionary items

get(key, default=None)[source]

Dictionary get method


Return the EOPatch from the workflow result