pipeline-manager: pipeline tracking#6088
Draft
snkas wants to merge 3 commits into
Draft
Conversation
This makes the following two changes. 1. (New) A new endpoint is added to track changes of a pipeline: `GET /v0/pipelines/<name>/track`. It returns a stream of NDJSON, with each line containing a dictionary of top-level field changes. The API server polls the database every second for any changes, and pushes the changes to the client. If there are no changes, it still pushes an empty dictionary to keep the connection alive. This endpoint is added in order to avoid having to add new `selector=` in the future. 2. (New) Python SDK functions `pipeline.wait_for_compilation()` and `pipeline.track()` are added. The former was needed to properly test the latter. It is also useful standalone, for instance if the user edits a compilation-relevant field and wants to wait for compilation to finish successfully. Signed-off-by: Simon Kassing <simon.kassing@feldera.com>
mythical-fred
left a comment
There was a problem hiding this comment.
Draft review — design feedback only.
The version-based change tracking approach is well thought out: partitioning pipeline state into four independently-versioned domains and only fetching the groups that actually changed is the right call for a polling-based stream. The determine_json_delta function with its unit tests is a clean way to compute the NDJSON deltas.
Two items worth fixing before this leaves draft (see inline):
test_pipeline_waiting.pyimports frombuild.lib(build artifact)- NDJSON content type should be
application/x-ndjson
Signed-off-by: Simon Kassing <simon.kassing@feldera.com>
Signed-off-by: Simon Kassing <simon.kassing@feldera.com>
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.
This makes the following two changes.
(New) A new endpoint is added to track changes of a pipeline:
GET /v0/pipelines/<name>/track. It returns a stream of NDJSON, with each line containing a dictionary of top-level field changes. The API server polls the database every second for any changes, and pushes the changes to the client. If there are no changes, it still pushes an empty dictionary to keep the connection alive. This endpoint is added in order to avoid having to add newselector=in the future.(New) Python SDK functions
pipeline.wait_for_compilation()andpipeline.track()are added. The former was needed to properly test the latter. It is also useful standalone, for instance if the user edits a compilation-relevant field and wants to wait for compilation to finish successfully.PR information
pipeline-manager/src/db/operations/pipeline_parsing.rsNot yet finished; still a draft.