API

Datafile

Dataset

Manifest

Analysis

Child

Child emulator

Filter containers

FilterSet

class octue.resources.filter_containers.FilterSet
filter(ignore_items_without_attribute=True, **kwargs)

Return a new instance containing only the Filterable`s to which the given filter criteria are `True.

Parameters
  • ignore_items_without_attribute (bool) – if True, just ignore any members of the container without a filtered-for attribute rather than raising an error

  • {str – any} kwargs: keyword arguments whose keys are the name of the filter and whose values are the values to filter for

Return octue.resources.filter_containers.FilterContainer

one(**kwargs)

If a single result exists for the given filters, return it. Otherwise, raise an error.

Parameters

{str – any} kwargs: keyword arguments whose keys are the name of the filter and whose values are the values to filter for

Raises

octue.exceptions.UnexpectedNumberOfResultsException – if zero or more than one results satisfy the filters

Return octue.resources.mixins.filterable.Filterable

order_by(attribute_name, check_start_value=None, check_constant_increment=None, reverse=False)

Order the Filterable`s in the container by an attribute with the given name, returning them as a new `FilterList regardless of the type of filter container begun with (`FilterSet`s and `FilterDict`s are inherently orderless).

Parameters
  • attribute_name (str) – name of attribute (optionally nested) to order by e.g. “a”, “a.b”, “a.b.c”

  • check_start_value (any) – if provided, check that the first item in the ordered container has the given start value for the attribute ordered by

  • check_constant_increment (int|float|None) – if given, check that the ordered-by attribute of each of the items in the ordered container increases by the given value when progressing along the sequence

  • reverse (bool) – if True, reverse the ordering

Raises

octue.exceptions.InvalidInputException – if an attribute with the given name doesn’t exist on any of the container’s members

Return FilterList

FilterList

class octue.resources.filter_containers.FilterList(iterable=(), /)
filter(ignore_items_without_attribute=True, **kwargs)

Return a new instance containing only the Filterable`s to which the given filter criteria are `True.

Parameters
  • ignore_items_without_attribute (bool) – if True, just ignore any members of the container without a filtered-for attribute rather than raising an error

  • {str – any} kwargs: keyword arguments whose keys are the name of the filter and whose values are the values to filter for

Return octue.resources.filter_containers.FilterContainer

one(**kwargs)

If a single result exists for the given filters, return it. Otherwise, raise an error.

Parameters

{str – any} kwargs: keyword arguments whose keys are the name of the filter and whose values are the values to filter for

Raises

octue.exceptions.UnexpectedNumberOfResultsException – if zero or more than one results satisfy the filters

Return octue.resources.mixins.filterable.Filterable

order_by(attribute_name, check_start_value=None, check_constant_increment=None, reverse=False)

Order the Filterable`s in the container by an attribute with the given name, returning them as a new `FilterList regardless of the type of filter container begun with (`FilterSet`s and `FilterDict`s are inherently orderless).

Parameters
  • attribute_name (str) – name of attribute (optionally nested) to order by e.g. “a”, “a.b”, “a.b.c”

  • check_start_value (any) – if provided, check that the first item in the ordered container has the given start value for the attribute ordered by

  • check_constant_increment (int|float|None) – if given, check that the ordered-by attribute of each of the items in the ordered container increases by the given value when progressing along the sequence

  • reverse (bool) – if True, reverse the ordering

Raises

octue.exceptions.InvalidInputException – if an attribute with the given name doesn’t exist on any of the container’s members

Return FilterList

FilterDict

class octue.resources.filter_containers.FilterDict(**kwargs)

A dictionary that is filterable by its values’ attributes. Each key can be anything, but each value must be an octue.mixins.filterable.Filterable instance.

filter(ignore_items_without_attribute=True, **kwargs)

Return a new instance containing only the Filterables for which the given filter criteria apply are satisfied.

Parameters
  • ignore_items_without_attribute (bool) – if True, just ignore any members of the container without a filtered-for attribute rather than raising an error

  • {str – any} kwargs: keyword arguments whose keys are the name of the filter and whose values are the values to filter for

Return FilterDict

order_by(attribute_name, reverse=False)

Order the instance by the given attribute_name, returning the instance’s elements as a new FilterList.

Parameters
  • attribute_name (str) – name of attribute (optionally nested) to order by e.g. “a”, “a.b”, “a.b.c”

  • reverse (bool) – if True, reverse the ordering

Raises

octue.exceptions.InvalidInputException – if an attribute with the given name doesn’t exist on any of the FilterDict’s values

Return FilterList

one(**kwargs)

If a single item exists for the given filters, return it. Otherwise, raise an error.

Parameters

{str – any} kwargs: keyword arguments whose keys are the name of the filter and whose values are the values to filter for

Raises

octue.exceptions.UnexpectedNumberOfResultsException – if zero or more than one results satisfy the filters

Return (any, octue.resources.mixins.filterable.Filterable)

Configuration

Service configuration

App configuration

Runner

Octue essential monitor messages

Octue log handler

octue.log_handlers.apply_log_handler(logger_name=None, logger=None, handler=None, log_level=20, formatter=None, include_line_number=False, include_process_name=False, include_thread_name=False)

Apply a log handler with the given formatter to the logger with the given name. By default, the default Octue log handler is used on the root logger.

Parameters
  • logger_name (str|None) – the name of the logger to apply the handler to; if this and logger are None, the root logger is used

  • logger (logging.Logger|None) – the logger instance to apply the handler to (takes precedence over a logger name)

  • handler (logging.Handler|None) – The handler to use. If None, the default StreamHandler will be attached.

  • log_level (int|str) – ignore log messages below this level

  • formatter (logging.Formatter|None) – if provided, this formatter is used and the other formatting options are ignored

  • include_line_number (bool) – if True, include the line number in the log context

  • include_process_name (bool) – if True, include the process name in the log context

  • include_thread_name (bool) – if True, include the thread name in the log context

Return logging.Handler