-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[AKS] az aks command invoke
: Add progress spinner
#30274
base: dev
Are you sure you want to change the base?
[AKS] az aks command invoke
: Add progress spinner
#30274
Conversation
️✔️AzureCLI-FullTest
|
Hi @CustardTart32, |
️✔️AzureCLI-BreakingChangeTest
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
@microsoft-github-policy-service agree company="Microsoft" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Queued live test to validate the change, test passed!
- test_aks_run_command
@@ -2058,7 +2102,8 @@ def aks_runcommand(cmd, client, resource_group_name, name, command_string="", co | |||
command_id = command_id_regex.findall(command_result_polling_url)[0] | |||
_aks_command_result_in_progess_helper(client, resource_group_name, name, command_id) | |||
return | |||
return _print_command_result(cmd.cli_ctx, command_result_poller.result(300)) | |||
|
|||
return LongRunningOperation(cmd.cli_ctx, progress_bar=PollerProgressBar(cmd.cli_ctx, command_result_poller))(command_result_poller) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this would change the command output, and this might be regarded as a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if you could add an example in the description to show the difference before and after the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, just checked and this would change the output format. I'll see if I can align the two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12712f0
to
67b9c42
Compare
75d5f38
to
7bbfe83
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
please fix the title with impacted command/parameter, e.g., |
d4f839d
to
d2f3cd6
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
please add tests for the change to verify if it meets your expectations |
progress_bar.end() | ||
return _print_command_result(cmd.cli_ctx, command_result_poller.result()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so if the operation is not completed within 300 seconds, the progress bar will end, but the polling here will continue (until it times out on the server side?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand, if the operation is not completed in 300s, the failure message will be logged and the python process (including the poller) will be terminated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a simple test based on your branch, the following command is executed and does not terminate after 5 minutes. After 5 minutes, only the progress bar is no longer displayed, and the command finally returns in 10 minutes.
az aks command invoke -g xxx -n xxx -c "sleep 600 && echo hello"
|
||
|
||
class RunCommandLocationPolling(LocationPolling): | ||
"""Extends LocationPolling but uses the body content instead of the status code for the status""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask why you want to inherit your own Poller and use this special status logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, I want the message in the progress bar to be dynamically generated based on the poller HTTP response. LocationPolling
basically checks the status code and returns a hardcoded value of InProgress
if HTTP status 201/202 hence why we have to extend the class.
BodyContentPolling
only supports PUT/PATCH methods which is not applicable here and neither does OperationResourcePolling
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git it, thanks~
e40f4dd
to
dbe98d0
Compare
Thanks @CustardTart32 , this is first step on AKS to show more details on long running operations, to improve customer experience. here I capture a gif using asciinema, you can see the Later we are going to apply this to |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
…eterminateProgressBar
dbe98d0
to
2c2b08e
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
now = datetime.datetime.now() | ||
progress_controller.begin() | ||
while not command_result_poller.done(): | ||
if datetime.datetime.now() - now >= datetime.timedelta(seconds=300): | ||
break | ||
|
||
progress_controller.add(message=command_result_poller.status()) | ||
progress_controller.update() | ||
time.sleep(0.5) | ||
|
||
progress_controller.end() | ||
return _print_command_result(cmd.cli_ctx, command_result_poller.result()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#30274 (comment)
My suggestion is to either share this timeout with both the progress bar and the poller, or not set a timeout.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az aks command invoke
Description
This PR adds a spinner and progress message to the
az aks command invoke
CLI command, which can take several minutes to complete.Testing Guide
History Notes
[AKS]
az aks command invoke
: Add progress spinnerThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.