thoth.adviser.prescription package

Subpackages

Module contents

Prescription module implementation.

class thoth.adviser.prescription.UnitPrescription(*, unit_run: bool = False, stack_info_run: bool = False, configuration: Dict[str, Any] = NOTHING, prescription: Dict[str, Any] = NOTHING)[source]

Bases: thoth.adviser.unit.Unit

A base class for implementing pipeline units based on prescription supplied.

CONFIGURATION_SCHEMA = <Schema({'package_name': <class 'str'>, 'match': <class 'object'>, 'run': <class 'object'>, 'prescription': <Schema({'run': <class 'bool'>}, extra=PREVENT_EXTRA, required=False) object>}, extra=PREVENT_EXTRA, required=False) object>
SHOULD_INCLUDE_CACHE = {}
classmethod get_unit_name() → str[source]

Get the name of the current prescription unit.

This method is a class method and MUST NOT be used when obtaining unit name on an instance. As part of the memory optimization we use class to get the current name of a prescription unit with assigned prescription. This means that the prescription unit instance would have different names reported with this method based on the current class context.

property match_prescription

Get match part of the prescription assigned.

property name

Get name of the prescription instance.

pre_run() → None[source]

Prepare this pipeline unit before running it.

prescription
property run_prescription

Get run part of the prescription assigned.

classmethod set_prescription(prescription: Dict[str, Any]) → None[source]

Set prescription to the unit.

class thoth.adviser.prescription.Prescription(*, prescriptions: List[Tuple[str, str]] = NOTHING, boots_dict: Dict[str, Dict[str, Any]] = NOTHING, pseudonyms_dict: Dict[str, Dict[str, Any]] = NOTHING, sieves_dict: Dict[str, Dict[str, Any]] = NOTHING, steps_dict: Dict[str, Dict[str, Any]] = NOTHING, strides_dict: Dict[str, Dict[str, Any]] = NOTHING, wraps_dict: Dict[str, Dict[str, Any]] = NOTHING)[source]

Bases: object

Dynamically create pipeline units based on inscription.

boots_dict
classmethod from_dict(prescription: Dict[str, Any], *, prescription_instance: Optional[Prescription] = None, prescription_name: str, prescription_release: str) → thoth.adviser.prescription.v1.prescription.Prescription[source]

Instantiate prescription from a dictionary representation.

If an instance is provided, a safe merge will be performed.

is_empty() → bool[source]

Check if no prescription units are loaded.

iter_boot_units() → Generator[Type[BootType], None, None][source]

Iterate over prescription boot units registered in the prescription supplied.

iter_pseudonym_units() → Generator[Type[PseudonymType], None, None][source]

Iterate over prescription pseudonym units registered in the prescription supplied.

iter_sieve_units() → Generator[Type[SieveType], None, None][source]

Iterate over prescription sieve units registered in the prescription supplied.

iter_step_units() → Generator[Type[StepType], None, None][source]

Iterate over prescription step units registered in the prescription supplied.

iter_stride_units() → Generator[Type[StrideType], None, None][source]

Iterate over prescription stride units registered in the prescription supplied.

iter_wrap_units() → Generator[Type[WrapType], None, None][source]

Iterate over prescription stride units registered in the prescription supplied.

classmethod load(*prescriptions: str) → thoth.adviser.prescription.v1.prescription.Prescription[source]

Load prescription from files or from their YAML representation.

prescriptions
pseudonyms_dict
sieves_dict
steps_dict
strides_dict
property units

Iterate over units.

classmethod validate(prescriptions: str) → thoth.adviser.prescription.v1.prescription.Prescription[source]

Validate the given prescription.

wraps_dict