CLI command for quickly deleting local development instances#572
Conversation
|
this makes me wonder if we should have |
| ): | ||
| workspace = Workspace.get(client, instance.workspace_id) | ||
| result = all or click.confirm( | ||
| f"Delete instance [{instance.handle}] in workspace [{workspace.handle}] created {instance.created_at}" |
There was a problem hiding this comment.
Nit: Add ? to confirmation prompt?
| f"Delete instance [{instance.handle}] in workspace [{workspace.handle}] created {instance.created_at}" | ||
| ) | ||
| if result: | ||
| instance.delete() |
There was a problem hiding this comment.
try/except here, to allow deletion to continue?
There was a problem hiding this comment.
Should it continue, if it can't delete something?
There was a problem hiding this comment.
This strikes me as a "I want to clean up as much as possible" thing, I'd personally be annoyed if this failed for some reason on the first one and I had 20 other files that needed deleting.
| default=False, | ||
| help="Delete all local development instances without prompting", | ||
| ) | ||
| def delete_local_dev_instances(all: Optional[bool] = False): |
There was a problem hiding this comment.
Nit: naming differences between "delete" here vs "clean" in argument name
| workspace_id: str = None | ||
| workspace_handle: str = None | ||
| init_status: Optional[InvocableInitStatus] = None | ||
| created_at: Optional[datetime] = None |
There was a problem hiding this comment.
For instances created before this change, is this just expected to be None? I don't see where this hydration happens otherwise.
There was a problem hiding this comment.
When hydrating in from_dict, Pydantic will ignore fields that it doesn't have a slot for. The createdAt field has been passed by the engine, but ignored by Pydantic / this object until this field is added.
Yeah I struggled a bit with what the name ought to be here. The other command is |
should we make it parallel: |
I like this. PR updated. |
Per discussion on discord: https://discord.com/channels/927675537390968882/927675537390968885/1159144491450630224
Create a command
clean localwhich iterates through local development instances of the current package, across workspaces, and asks the user if they wish to delete. Using the--allflag deletes them without prompt.