pipelines.templatetags.pipelines module#

pipelines.templatetags.pipelines.duration(delta_or_start: timedelta | datetime | None, end: datetime | None = None)#

Converts a time delta into a formatted string.

The total number of seconds is used to decide how many parts the string should be broken down into.

For example, the string may look like:

  • 35s (35 seconds)

  • 3m 2s (3 minutes and 2 seconds)

  • 1d 9h (1 day and 9 hours exactly)

Returns None if delta_or_start is None

If delta_or_start is a timedelta object it will be used to generate the duration string.

If delta_or_start is a datetime object it will be with end to calculate a timedelta object. If end is None, now is used.

Parameters:
  • delta_or_start – The timedelta to format or the start time for the duration

  • end – The end time of the duration

pipelines.templatetags.pipelines.lookup(value, key)#

Fetches the value for the provided key from a dict like structure.

Parameters:
  • value – The object to lookup a value from

  • key – The key of the value to lookup

pipelines.templatetags.pipelines.status_class(status: str | PipelineTaskStatus)#

Converts a pipeline status to a css class.

Parameters:

status – Either a PipelineTaskStats or its string representation to convert

pipelines.templatetags.pipelines.status_text(status: str | PipelineTaskStatus)#

Converts a pipeline status to a human friendly string.

Parameters:

status – Either a PipelineTaskStats or its string representation to convert