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

hydra clean-resources for Azure for a user in dry-run mode doesn't show existing resources #8582

Open
dimakr opened this issue Sep 6, 2024 · 3 comments

Comments

@dimakr
Copy link
Contributor

dimakr commented Sep 6, 2024

Even though resources exist on Azure backend, the hydra clean-resources --dry-run command for a user doesn't list them.
For other backends (aws, gce, etc.) the resources are listed when hydra clean-resources --dry-run command is executed for the backend for a user.

Ex.:

  • list resources for user
❯ hydra list-resources --user dmytro.kruglov
...
Checking Azure instances...
+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|                                                                     Instances used on Azure                                                                      |
+-------------------------------------------------+-----------+----------------+--------------------------------------+----------------+---------------------------+
| Name                                            | Region-AZ | PublicIP       | TestId                               | RunByUser      | LaunchTime                |
+-------------------------------------------------+-----------+----------------+--------------------------------------+----------------+---------------------------+
| pr-provision-test-dmitriy-db-node-eastus-1      | eastus    | 52.149.152.138 | 3fae68fd-5b9a-4278-acc0-be3f72db7b79 | dmytro.kruglov | 2024-09-06 13:51:42+00:00 |
| pr-provision-test-dmitriy-db-node-eastus-2      | eastus    | 52.149.152.168 | 3fae68fd-5b9a-4278-acc0-be3f72db7b79 | dmytro.kruglov | 2024-09-06 13:51:45+00:00 |
| pr-provision-test-dmitriy-db-node-eastus-3      | eastus    | 52.149.152.171 | 3fae68fd-5b9a-4278-acc0-be3f72db7b79 | dmytro.kruglov | 2024-09-06 13:51:49+00:00 |
| pr-provision-test-dmitriy-loader-node-eastus-1  | eastus    | 52.255.140.93  | 3fae68fd-5b9a-4278-acc0-be3f72db7b79 | dmytro.kruglov | 2024-09-06 14:02:02+00:00 |
| pr-provision-test-dmitriy-monitor-node-eastus-1 | eastus    | 52.255.138.240 | 3fae68fd-5b9a-4278-acc0-be3f72db7b79 | dmytro.kruglov | 2024-09-06 14:04:24+00:00 |
+-------------------------------------------------+-----------+----------------+--------------------------------------+----------------+---------------------------+
  • run clean-resources command for the user in dry-run mode
❯ hydra clean-resources --user dmytro.kruglov -b azure --dry-run
...
Cleaning everything for test id: 65e7ae16-5e9e-41cc-bcb6-9c22735c1829 in region: eastus
test id b0111597-eef5-4501-8863-b7a8e8c85783 from eastus - instances to clean: []
test id b1611080-4440-472a-9c5a-9e61b1728d80 from eastus - instances to clean: []
Cleaning everything for test id: 3fae68fd-5b9a-4278-acc0-be3f72db7b79 in region: eastus
test id eb5f5de5-0272-4dfe-8852-81ffef108e5b from eastus - instances to clean: []
Cleanup for the {'RunByUser': 'dmytro.kruglov', 'CreatedBy': 'SCT'} resources has been finished

The issue is rather cosmetic, but can sometimes confuse a user, when the list of resources available for cleanup in Azure is requested and it doesn't return any items.

@dimakr dimakr removed their assignment Sep 6, 2024
@soyacz
Copy link
Contributor

soyacz commented Sep 9, 2024

see

Cleaning everything for test id: 3fae68fd-5b9a-4278-acc0-be3f72db7b79 in region: eastus

In that case it's not showing individual resources.

@dimakr
Copy link
Contributor Author

dimakr commented Sep 9, 2024

It differs from how it performs for other backends, e.g.:

hydra clean-resources --user dmytro.kruglov -b gce --dry-run
...
Done. Found total of 20 instances.
Going to delete: rolling-upgrade-artifacts--centos-9-db-node-46746c79-0-1 (gcp-sct-project-1 project)
Going to delete: rolling-upgrade-artifacts--centos-9-db-node-46746c79-0-2 (gcp-sct-project-1 project)

The same for aws.

So when a person would expect the same behavior for azure as well, it can confuse (it was with me, I understood that azure backend has my resources alive only when listed them directly, not when executed clean-resources --dry-run).

@dimakr dimakr changed the title hydra clean-resources for Azure in dry-run mode doesn't show existing resources hydra clean-resources for Azure for a user in dry-run mode doesn't show existing resources Sep 9, 2024
@soyacz
Copy link
Contributor

soyacz commented Sep 9, 2024

dry-run for clean resources shows the action taken for cleaning resources. In terms of azure it would delete everything (meaning whole resource group) and dry-run shows exactly that - I don't see an issue with discrepancy between list-resources and clean-resources dry-run.
In my opinion if someone wants to list resources should use list-resources, if wants to clean them, then clean-resources.
But I could be wrong, and should be easily fixable I suppose.

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

No branches or pull requests

2 participants