General
Pipelines in the bookkeeping system refer to different module sequences that are selected based on previous workflow status for a publication and the processing intention. There are currently four types of pipelines envisioned. The pipeline's name is the journal's ISSN followed by suffixes for the non-default pipelines.
- default pipeline (no suffix): Pipeline that is started if the publication is either unknown or previous processing has not reached the long term archiving state
- in long term archiving pipeline (suffix -inLTA): Pipeline that is started if updated metadata for a publication is supplied but the publication has previously been ingested in the long term archive (startup logic only partially implemented)
- Reconversion pipeline (suffix -reconvert): Pipeline that is executed upon request to repeat conversion from the input data to the TEI XML target format (startup logic not yet implemented)
- Reclassification pipeline (suffix -reclassify): Pipeline that is executed upon request to repeat classification of the publication, e.g. by annif (startup logic not yet implemented)
Selection mechanism between the default and the "in long term archiving" pipeline
Pipeline selection for a publication is deliberately postponed until the startup module returns its job with ProcessingInterface.return_startup_job(). At that point the startup module has obtained the publication metadata, including the provider publication identifiers needed to look up the publication in bookkeeping.
Startup behavior
obtain_startup_identifier() only hands the startup module identifiers from the default pipeline. It skips pipeline identifiers ending in -inLTA, because the LTA status is publication-specific and is not known while iterating over a journal or processing group. The startup module therefore creates its job in the context of the default pipeline; this does not yet determine the pipeline in which the resulting processing location will continue.
Selection is only performed for a startup job that will be registered. return_startup_job() discards the job before the lookup when no usable output location exists, specifically when:
- neither
article_dirnorjob.article_diris set; processed_dirisNone; orprocessed_dirstill starts with the temporary-directory prefix.
In these cases no processing location or pipeline assignment is written to bookkeeping.
LTA-status lookup
For a job that is not discarded, return_startup_job() calls BookkeepingHandler.check_publication_has_location_with_flag() with:
- the provider publication identifiers stored on the job's new location;
- location type
wdmvoc:NASProcessingFiles; and - flag
wdmvoc:InLTA.
The resulting SPARQL ASK is true when a bookkeeping publication identified by at least one of the supplied provider identifiers has at least one location that is both a wdmvoc:NASProcessingFiles location and marked with wdmvoc:InLTA. The lookup is made in the graph for the current source. Merely finding the publication, another kind of location, or another LTA-related flag does not select the inLTA pipeline.
Routing decision
| Result of the LTA lookup | Selected pipeline identifier | Initial flag on the new processing location | Next module |
|---|---|---|---|
False |
The current default pipeline identifier | wdmvoc:Active |
next_module from the default pipeline context |
True |
The default identifier plus the case-sensitive suffix -inLTA |
wdmvoc:Queued |
next_module from the -inLTA pipeline context |
After making this decision, the method builds the selected pipeline IRI, assigns it to job.pipeline_iri, and assigns the selected context's next_module to job.next_module. It then delegates to return_job(), which registers the new processing location and its pipeline controller in bookkeeping. If the caller supplied additional flags through add_flags, the method retains them and adds Active or Queued if the selected routing flag is not already present.
In pseudocode, the selection is:
base_pipeline = current default pipeline identifier
if publication has NASProcessingFiles flagged InLTA:
selected_pipeline = base_pipeline + "-inLTA"
routing_flag = Queued
else:
selected_pipeline = base_pipeline
routing_flag = Active
job.pipeline_iri = IRI of selected_pipeline
job.next_module = selected pipeline's next_module
Configuration requirements and operational implications
Both the default and -inLTA contexts must be available to the startup module. In practice, the startup module must be included in the configured module lists used to build both contexts, and inLTA_workflow_jobs must not disable loading the inLTA context. Otherwise a positive LTA lookup cannot resolve the selected pipeline's next_module and raises a KeyError instead of falling back to the default pipeline.
The queued state for an inLTA job is intentional: a new metadata delivery for an already archived publication must wait if another workflow for that publication is active. Queue management can activate it when processing is available. A new job on the default pipeline is made active immediately.
The suffix spelling is case-sensitive in the implementation: configuration loading and return_startup_job() use -inLTA. Configuration keys and any code that examines the selected identifier must use the same spelling.