pimlico.core.modules.multistage module

exception pimlico.core.modules.multistage.MultistageModulePreparationError[source]

Bases: exceptions.Exception

class pimlico.core.modules.multistage.InternalModuleConnection(input_name, output_name=None, previous_module=None)[source]

Bases: pimlico.core.modules.multistage.ModuleConnection

Connection between the output of one module in the multi-stage module and the input to another.

May specify the name of the previous module that a connection should be made to. If this is not given, the previous module in the sequence will be assumed.

If output_name=None, connects to the default output of the previous module.

class pimlico.core.modules.multistage.ModuleConnection[source]

Bases: object

class pimlico.core.modules.multistage.ModuleInputConnection(stage_input_name=None, main_input_name=None)[source]

Bases: pimlico.core.modules.multistage.ModuleConnection

Connection of a sub-module’s input to an input to the multi-stage module.

If main_input_name is not given, the name for the input to the multistage module will be identical to the stage input name. This will lead to an error if multiple inputs end up with the same name, so you can specify a different name if necessary to avoid clashes.

If stage_input_name is not given, the module’s default input will be connected.

class pimlico.core.modules.multistage.ModuleOutputConnection(stage_output_name=None, main_output_name=None)[source]

Bases: object

Specifies the connection of a sub-module’s output to the multi-stage module’s output. Works in a similar way to ModuleInputConnection.

class pimlico.core.modules.multistage.ModuleStage(name, module_info_cls, connections=None, output_connections=None)[source]

Bases: object

A single stage in a multi-stage module.

If no explicit input connections are given, the default input to this module is connected to the default output from the previous.

Connections can be given as a list of `ModuleConnection`s.

Output connections specify that one of this module’s outputs should be used as an output from the multi-stage module. Optional outputs for the multi-stage module are not currently supported (though could in theory be added later). This should be a list of `ModuleOutputConnection`s. If none are given for any of the stages, the module will have a single output, which is the default output from the last stage.

class pimlico.core.modules.multistage.MultistageModuleInfo(module_name, pipeline, **kwargs)[source]

Bases: pimlico.core.modules.base.BaseModuleInfo

Base class for multi-stage modules. You almost certainly don’t want to override this yourself, but use the factory method instead. It exists mainly for providing a way of identifying multi-stage modules.

check_ready_to_run()[source]
get_detailed_status()[source]
get_input_software_dependencies()[source]
classmethod get_key_info_table()[source]

Add the stages into the key info table.

get_next_stage()[source]

If there are more stages to be executed, returns a pair of the module info and stage definition. Otherwise, returns (None, None)

get_software_dependencies()[source]
is_locked()[source]
reset_execution()[source]
typecheck_inputs()[source]

Overridden to check internal output-input connections as well as the main module’s inputs.

module_executable = True
stages = None
status
pimlico.core.modules.multistage.multistage_module(multistage_module_type_name, module_stages)[source]

Factory to build a multi-stage module type out of a series of stages, each of which specifies a module type for the stage.

The outputs to the multi-stage module are given by outputs, which should be a list of (stage name, output name) pairs, where the stage name represents one of the stages and the output name is one of its outputs. If the outputs are not pairs, but just strings, they are taken to refer to the last stage. If no outputs are given, the default output of the last stage is the multi-stage module’s output.