Skip to content

Core Classes and Exceptions

Exceptions

pytask.PytaskError

Bases: Exception

Base exception for pytask which should be inherited by all other exceptions.

pytask.CollectionError

Bases: PytaskError

Exception during collection.

pytask.ConfigurationError

Bases: PytaskError

Exception during the configuration.

pytask.ExecutionError

Bases: PytaskError

Exception during execution.

pytask.ResolvingDependenciesError

Bases: PytaskError

Exception during resolving dependencies.

pytask.NodeNotCollectedError

Bases: PytaskError

Exception for nodes which could not be collected.

pytask.NodeNotFoundError

Bases: PytaskError

Exception for missing dependencies.

Core Classes

pytask.Session dataclass

The session of pytask.

Parameters:

Name Type Description Default
config dict[str, Any]

Configuration of the session.

dict()
collection_reports list[CollectionReport]

Reports for collected items.

list()
dag DAG

The DAG of the project.

DAG()
hook HookRelay

Holds all hooks collected by pytask.

HookRelay()
tasks list[PTask]

List of collected tasks.

list()
dag_report DagReport | None

Report for failed dependency resolution.

None
execution_reports list[ExecutionReport]

Reports for executed tasks.

list()
n_tasks_failed int

Number of tests which have failed.

0
should_stop bool

Indicates whether the session should be stopped.

False
warnings list[WarningReport]

A list of warnings captured during the run.

list()

from_config(config) classmethod

Construct the class from a config.

pytask.DataCatalog dataclass

A data catalog.

Parameters:

Name Type Description Default
default_node type[PNode]

A default node for loading and saving values. By default, pytask.PickleNode is used to serialize any Python object with the pickle module.

PickleNode
name str

The name of the data catalog which can only contain letters, numbers, hyphens and underscores. Use it when you are working with multiple data catalogs to store data in different locations.

'default'
path Path | None

A path where automatically created files are stored. By default, it will be .pytask/data_catalogs/default.

None

add(name, node=None)

Add an entry to the data catalog.