thoth.adviser.prescription package

Subpackages

Module contents

Prescription module implementation.

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[thoth.adviser.prescription.v1.prescription.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: Generator[Dict[str, Any], None, None]

Iterate over units.

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

Validate the given prescription.

wraps_dict
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: voluptuous.schema_builder.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: Dict[str, bool] = {}
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: Dict[str, Any]

Get match part of the prescription assigned.

property name: str

Get name of the prescription instance.

pre_run() None[source]

Prepare this pipeline unit before running it.

prescription
property run_prescription: Dict[str, Any]

Get run part of the prescription assigned.

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

Set prescription to the unit.