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

datajoint/admin.py: add unsafe dj.kill option, expand display to include host #741

Merged
merged 3 commits into from
Mar 16, 2020

Conversation

ixcat
Copy link
Contributor

@ixcat ixcat commented Mar 4, 2020

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.

…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 Show resolved Hide resolved
"""
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
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

@dimitri-yatsenko dimitri-yatsenko Mar 12, 2020

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

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

Successfully merging this pull request may close these issues.

2 participants