Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verbose flag to the "bundle deploy" command #1774

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

ilia-db
Copy link
Contributor

@ilia-db ilia-db commented Sep 17, 2024

Changes

  • Extract sync output logic from cmd/sync into lib/sync
  • Add hidden verbose flag to the bundle deploy command, it's false by default and hidden from the --help output
  • Pass output handler to the deploy/files/upload mutator if the verbose option is true

The was an idea to use in-place output overriding each past file sync event in the output, bit that wont work for the extension, since it doesn't display deploy logs in the terminal.

Example output:

~/tmp/defpy: ~/cli/cli bundle deploy --sync-progress
Building defpy...
Uploading defpy-0.0.1+20240917.112755-py3-none-any.whl...
Uploading bundle files to /Users/ilia.babanov@databricks.com/.bundle/defpy/dev/files...
Action: PUT: requirements-dev.txt, resources/defpy_pipeline.yml, pytest.ini, src/defpy/main.py, src/defpy/__init__.py, src/dlt_pipeline.ipynb, tests/main_test.py, src/notebook.ipynb, setup.py, resources/defpy_job.yml, .vscode/extensions.json, .vscode/settings.json, fixtures/.gitkeep, .vscode/__builtins__.pyi, README.md, .gitignore, databricks.yml
Uploaded tests
Uploaded resources
Uploaded fixtures
Uploaded .vscode
Uploaded src/defpy
Uploaded requirements-dev.txt
Uploaded .gitignore
Uploaded fixtures/.gitkeep
Uploaded src/defpy/__init__.py
Uploaded databricks.yml
Uploaded README.md
Uploaded setup.py
Uploaded .vscode/__builtins__.pyi
Uploaded .vscode/extensions.json
Uploaded src/dlt_pipeline.ipynb
Uploaded .vscode/settings.json
Uploaded resources/defpy_job.yml
Uploaded pytest.ini
Uploaded src/defpy/main.py
Uploaded tests/main_test.py
Uploaded resources/defpy_pipeline.yml
Uploaded src/notebook.ipynb
Initial Sync Complete
Deploying resources...
Updating deployment state...
Deployment complete!

Output example in the extension:
Screenshot 2024-09-19 at 11 07 48

Tests

Manually for the sync and bundle deploy commands + vscode extension sync and deploy flows

@ilia-db ilia-db changed the title Show file sync progress in bundle deploy Add verbose flag to the "bundle deploy" command Sep 19, 2024
@ilia-db ilia-db marked this pull request as ready for review September 19, 2024 09:26
bundle/deploy/files/upload.go Outdated Show resolved Hide resolved
bundle/deploy/files/upload.go Show resolved Hide resolved
seq int
notifier EventNotifier
outputWaitGroup *stdsync.WaitGroup
seq int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the outputWaitGroup below with its own comment.

The sync type didn't spawn its own routine before, and it was possible to call Events(), then RunOnce(), then Close(), and repeat. This is no longer possible now that we construct the events channel from the constructor. I suspect calling Events() will actually be problematic now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the Events completely, as it's not used now

@@ -34,6 +37,8 @@ type SyncOptions struct {
CurrentUser *iam.User

Host string

OutputHandler OutputHandler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see how this is necessary in the current setup (where we have no good means to pass this information from both the sync command and the deploy command). In some future we'll want to decouple this again and deal with output from the caller, passing only the channel with events.

Copy link
Contributor Author

@ilia-db ilia-db Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, although output handler accepts a channel with events and it's set by the caller, so the caller is in control on how to deal with events. We can turn things around and create events channel on the caller side, passing it to the sync logic, not sure if there are any practical benefits of that

bundle/deploy/files/upload.go Outdated Show resolved Hide resolved
@ilia-db ilia-db added this pull request to the merge queue Sep 23, 2024
Merged via the queue into main with commit ac80d3d Sep 23, 2024
5 checks passed
@ilia-db ilia-db deleted the ilia-db/deploy-with-sync-progress branch September 23, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants