Skip to content

Outcomes, Reports, and Warnings

Outcomes

pytask.ExitCode

Bases: IntEnum

Exit codes for pytask.

COLLECTION_FAILED = 3 class-attribute instance-attribute

Failed while collecting tasks.

DAG_FAILED = 4 class-attribute instance-attribute

Failed while building the DAG.

FAILED = 1 class-attribute instance-attribute

Failed while executing tasks.

OK = 0 class-attribute instance-attribute

Tasks were executed successfully.

pytask.CollectionOutcome

Bases: Enum

Outcomes of collected files or tasks.

Attributes:

Name Type Description
FAIL

Outcome for failed collected files or tasks.

SUCCESS

Outcome for task which was executed successfully.

description property

A description of an outcome used in the summary panel.

style property

Return the style of an outcome.

style_textonly property

Return the style of an outcome when only the text is colored.

pytask.TaskOutcome

Bases: Enum

Outcomes of tasks.

Attributes:

Name Type Description
FAIL

Outcome for failed tasks.

PERSISTENCE

Outcome for tasks which should persist. Even if dependencies or products have changed, skip the task, update all hashes to the new ones, mark it as successful.

SKIP

Outcome for skipped tasks.

SKIP_PREVIOUS_FAILED

Outcome for tasks where a necessary preceding task has failed and, thus, this task could not have been executed.

SKIP_UNCHANGED

Outcome for tasks which do not need to be executed since all dependencies, source files and products have not changed.

SUCCESS

Outcome for task which was executed successfully.

WOULD_BE_EXECUTED

Outcome for tasks which would be executed.

description property

A description of an outcome used in the summary panel.

style property

Return the style of an outcome.

style_textonly property

Return the style of an outcome when only the text is colored.

symbol property

The symbol of an outcome.

pytask.Exit

Bases: Exception

Raised for immediate program exits (no tracebacks/summaries).

pytask.Persisted

Bases: PytaskOutcome

Outcome if task should persist.

pytask.Skipped

Bases: PytaskOutcome

Outcome if task is skipped.

pytask.SkippedAncestorFailed

Bases: PytaskOutcome

Outcome if an ancestor failed.

pytask.SkippedUnchanged

Bases: PytaskOutcome

Outcome if task has run before and is unchanged.

pytask.count_outcomes(reports, outcome_enum)

Count how often an outcome occurred.

Examples:

>>> from _pytask.outcomes import CollectionOutcome, TaskOutcome, count_outcomes
>>> count_outcomes([], CollectionOutcome)
{<CollectionOutcome.SUCCESS: 1>: 0, <CollectionOutcome.FAIL: 2>: 0}

Reports

pytask.CollectionReport dataclass

A collection report for a task.

pytask.ExecutionReport dataclass

A report for an executed task.

from_task(task) classmethod

Create a report from a task.

from_task_and_exception(task, exc_info) classmethod

Create a report from a task and an exception.

pytask.DagReport dataclass

A report for an error during the creation of the DAG.

Tracebacks

pytask.Traceback dataclass

Warnings

pytask.WarningReport

Bases: NamedTuple

pytask.parse_warning_filter(arg, *, escape) cached

Parse a warnings filter string.

This is copied from warnings._setoption with the following changes:

  • Does not apply the filter.
  • Escaping is optional.
  • Raises UsageError so we get nice error messages on failure.

pytask.warning_record_to_str(warning_message)

Convert a warnings.WarningMessage to a string.