datajoint/admin.py: add unsafe dj.kill option, expand display to include host#741
Merged
Merged
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.
dimitri-yatsenko
requested changes
Mar 11, 2020
| 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 |
Member
There was a problem hiding this comment.
a better name would be interactive than safemode
Author
There was a problem hiding this comment.
agree - though this is consistent with 'delete'... not sure what's best
Member
There was a problem hiding this comment.
delete does not have a safemode argument. It has verbose.
I think this can be implemented more intuitively as a separate method kill_quick.
Author
There was a problem hiding this comment.
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.
added 2 commits
March 11, 2020 17:24
…unction Also correctly document TIME>600 example.
dimitri-yatsenko
approved these changes
Mar 16, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.