-
Notifications
You must be signed in to change notification settings - Fork 84
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
datajoint/admin.py: add unsafe dj.kill option, expand display to include host #741
Conversation
…ude host Unsafe dj.kill() added to facillitate usage by automatic scripts (e.g. job runners which need to terminate stuck/old jobs forcefully) Changes: - add 'safemode' argument to dj.kill Value defaults to Null which implies reading the value from current dj.config['safemode'] option, falling back to True if this is not present. - add safemode=False dj.kill operation mode This will apply the given restriction to the processlist query and kill all matching processes. Number of killed processes will be returned if no errors are encountered.
datajoint/admin.py
Outdated
""" | ||
view and kill database connections. | ||
:param restriction: restriction to be applied to processlist | ||
:param connection: a datajoint.Connection object. Default calls datajoint.conn() | ||
:param safemode: use interactive menu or programmatically terminate processes |
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.
a better name would be interactive
than safemode
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.
agree - though this is consistent with 'delete'... not sure what's best
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.
delete
does not have a safemode
argument. It has verbose
.
I think this can be implemented more intuitively as a separate method kill_quick
.
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.
ah yes - got the argument confused with the configuration - either way, we use a term 'safemode' to denote 'prompting' elswhere in the codebase.
separating to 'kill quick' would also 'do' & be consistent elsewhere - will adjust.
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.
updated.
…unction Also correctly document TIME>600 example.
Minimal extension of existing dj.kill() to support #740 -
other more extensive reimplementation might be possible (e.g. making a full 'table' of information_schema.processlist) but would require more development effort.
Unsafe dj.kill() added to facillitate usage by automatic scripts
(e.g. job runners which need to terminate stuck/old jobs forcefully)
Also, add HOST field to display to improve usability in multi-host environments
Changes:
add 'safemode' argument to dj.kill
Value defaults to Null which implies reading the value from current
dj.config['safemode'] option, falling back to True if this is not present.
add safemode=False dj.kill operation mode
This will apply the given restriction to the processlist query
and kill all matching processes. Number of killed processes will
be returned if no errors are encountered.