feat(sparql-anything): report each chunk as it is converted - #808
Open
ddeboer wants to merge 1 commit into
Open
Conversation
A conversion says nothing for as long as it takes: a quarter of an hour over eighteen chunks for the GeoNames dumps, with the first sign of life being the output file or a rejection naming one chunk. onChunkConverted is called as each chunk finishes, with its position, how many there are in all, the chunk and the query that converted it. Once per chunk, in the order they finish rather than the order they were given, and not at all for a chunk that failed – that arrives as the rejection. A plain callback rather than a reporter interface. @lde/pipeline's ProgressReporter is shaped around datasets and distributions, so chunk progress has no event to be; taking one would couple this package to the pipeline, which its plugins depend on and this is not. A callback is also what a configurable runtime would inject: options are data a document can hold, collaborators are wiring the runtime supplies, and this is wiring.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A conversion says nothing for as long as it takes – a quarter of an hour over eighteen chunks for the GeoNames dumps – and the first sign of life is either the output file or a rejection naming one chunk. That is the one thing the port cannot work around from outside, because only the converter knows how many chunks there are and when each finishes.
Called once per chunk, in the order they finish rather than the order they were given, and not at all for a chunk that failed – that arrives as the rejection. A callback that throws aborts the run, like any other failure.
Why a callback, and not
ProgressReporterEvery event in
@lde/pipeline'sProgressReporteris dataset-shaped:datasetsSelected,datasetStart,distributionProbed,importStarted,distributionValidated. There is no "progress within a unit of work" event, so chunk progress has nothing to be – it would mean inventing a pipeline event for a package the pipeline does not know about.The dependency also runs the wrong way. This package depends on
@lde/task-runnerandtslib; taking aProgressReporterwould either couple it to@lde/pipeline– which pipeline plugins depend on, and this is not one – or duplicate that interface, which is the same coupling with a second copy to drift.A callback is also the shape a configurable runtime wants. Options split into configuration, which is plain data a YAML or TS document can hold (
queryFile,chunks,load,heap,cliArgs,concurrency), and collaborators and wiring, which only a runtime can supply. This package has exactly one collaborator today,taskRunner, and progress reporting is the second piece of wiring – injected, never declared. Keeping that split means a runtime needs one rule rather than a bespoke deserialiser per component.If #18 ever makes SPARQL Anything a pipeline stage, that stage adapts: it knows the dataset, so it maps chunk progress onto whatever event the pipeline gains then. Three lines, in the place whose job is translation.