Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Don't die when termination fails#113

Open
TheNavigat wants to merge 1 commit intomasterfrom
u/amashaal/avoid-dying-on-termination
Open

Don't die when termination fails#113
TheNavigat wants to merge 1 commit intomasterfrom
u/amashaal/avoid-dying-on-termination

Conversation

@TheNavigat
Copy link
Contributor

Host could possibly be terminated for whatever reason. Just catch the exception and go on.

make test passes successfully.

Host could possibly be terminated for whatever reason. Just catch the exception and go on
try:
resource_group.terminate_instances_by_id([host.instance_id])
except Exception:
logger.error(f'Failed to terminate host: {host.hostname}, possibly already terminated.')

Choose a reason for hiding this comment

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

nit: include the actual error text instead of printing an assumption of what went wrong?

try:
resource_group.terminate_instances_by_id([host.instance_id])
except Exception:
logger.error(f'Failed to terminate host: {host.hostname}, possibly already terminated.')

Choose a reason for hiding this comment

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

nit: is this just for human user interactions? in case of use by non-humans, where do these logs go? are they monitored?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell these logs aren't processed automatically, and they stay on local host. The script is executed by machines but the logs exist for investigation and debugging if unexpected behaviour occurs. @kawaiwanyelp should have more context on this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants