Skip to content

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

Merged
dimitri-yatsenko merged 3 commits into
datajoint:masterfrom
ixcat:djkill-unsafe
Mar 16, 2020
Merged

datajoint/admin.py: add unsafe dj.kill option, expand display to include host#741
dimitri-yatsenko merged 3 commits into
datajoint:masterfrom
ixcat:djkill-unsafe

Conversation

@ixcat

@ixcat ixcat commented Mar 4, 2020

Copy link
Copy Markdown

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.
Comment thread datajoint/admin.py Outdated
Comment thread 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

Copy link
Copy Markdown
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
Copy Markdown
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

@dimitri-yatsenko dimitri-yatsenko Mar 12, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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