ensembl.vep.workflow.worker package#

Process-local runtimes an executor runs payloads against.

Submodules#

ensembl.vep.workflow.worker.annotation module#

The annotation worker: a payload of unparsed input records in, detached annotations out.

One worker per process, built after the process starts, holding what every track shares: the reference sequence, the synonym map, the input source turning lines into variations, and the output factory detaching what a payload produced. Which annotations are made, and from which sources, belongs to the workflow’s tracks rather than here.

The input source is what reads: the worker hands it one payload’s records and is given variations back, so which format the input is in, and what a record of it is, stays with the source.

class ensembl.vep.workflow.worker.annotation.AnnotationBufferResult(*, variants, summary_delta)[source]#

Bases: object

Ordered worker result detached from live model objects.

Variables:
summary_delta: RunSummaryDelta#
variants: tuple[AnnotatedVariant, ...]#
class ensembl.vep.workflow.worker.annotation.AnnotationBufferWorker(config)[source]#

Bases: object

Worker-local sources and workflow state for payloads of input records.

The Worker protocol’s run for annotation, which is why nothing here is constructed until the process that annotates owns it: sources are opened and caches warmed per process.

run(records)[source]#

Return detached annotations for one payload of input records.

Return type:

AnnotationBufferResult

workflow: Workflow#

ensembl.vep.workflow.worker.base module#

The worker contract: one payload in, one serialisable result out.

class ensembl.vep.workflow.worker.base.Worker[PayloadT_contra, ResultT_co](*args, **kwargs)[source]#

Bases: Protocol[PayloadT_contra, ResultT_co]

Process-local runtime that runs one payload at a time.

A worker is built once per process, after that process starts, and then reused: it holds open sources and warm caches that neither cross a process boundary nor survive a rebuild. So what the executor transports is the factory, never the worker, and the worker itself never has to be serialisable – only its payloads and its results do.

One method, because that is all an executor needs of it. What a payload holds, and what the result carries, belongs to the kind of work: AnnotationBufferWorker takes a payload of input records and answers with detached annotations.

run(payload)[source]#

Return the result of this payload, against the sources this worker holds.

Parameters:

payload (PayloadT_contra) – One unit of work, as its executor’s payloads are grouped.

Returns:

What the payload produced, serialisable enough to cross back.

Return type:

ResultT_co