Repository navigation
Python: add status updates during automatic provisioning - #5522
Merged
helderco merged 2 commits intoJul 31, 2023
Merged
Conversation
Signed-off-by: Helder Correia <[email protected]>
Signed-off-by: Helder Correia <[email protected]>
helderco
force-pushed
the
sdk/python/provisioning-status-updates
branch
from
July 28, 2023 18:29
f5d418b to
8237b17
Compare
helderco
marked this pull request as ready for review
July 28, 2023 18:29
helderco
force-pushed
the
sdk/python/provisioning-status-updates
branch
from
July 31, 2023 12:17
8237b17 to
8993cdd
Compare
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 is the Python implementation for:
It takes a slightly different approach than Go and Node.js in:
Instead of
Message... OK!lines written only tolog_output, this change is less obtrusive, more animated and works even withoutlog_output1:log_outputif it’s interactive (e.g., pseudo terminal, not a file).log_output).log_outputit defaults tostderrand makes a last update of “Running pipelines” when the provisioning has finished. This doesn’t show onlog_outputbecause the engine logs already provide progress feedback.dagger runso that the TUI (progrock) can take over.I've tested this under multiple conditions:
dagger.Connection()log_output=sys.stderrlog_outputto write to a file (non-interactive)dagger run👇 I'm providing a sample app to easily test these multiple conditions.
Testing app
You'll need to
pip install typerand save this code in aprogress.pyfile:dagger.Connection()dagger.Connection(log_output=sys.stderr)Notice the status disappears and there's no "Running pipelines" when engine logs start.
dagger runFootnotes
Not that the same can’t be done in the other SDKs, but the library that does this was already a dependency, it was simple to implement and I already experimented with it very early on for this purpose (see https://github.com/dagger/dagger/issues/4186). ↩