Skip to content

Commit 8dfce7a

Browse files
author
Chris Turner
committed
datajoint/admin.py: add order_by argument to dj.kill (#668)
1 parent 98c0a81 commit 8dfce7a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

datajoint/admin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def set_password(new_password=None, connection=None, update_config=None): # pr
2121
config.save_local(verbose=True)
2222

2323

24-
def kill(restriction=None, connection=None): # pragma: no cover
24+
def kill(restriction=None, connection=None, order_by=None): # pragma: no cover
2525
"""
2626
view and kill database connections.
2727
:param restriction: restriction to be applied to processlist
@@ -39,7 +39,8 @@ def kill(restriction=None, connection=None): # pragma: no cover
3939
connection = conn()
4040

4141
query = 'SELECT * FROM information_schema.processlist WHERE id <> CONNECTION_ID()' + (
42-
"" if restriction is None else ' AND (%s)' % restriction)
42+
"" if restriction is None else ' AND (%s)' % restriction) + (
43+
' ORDER BY %s' % (order_by if order_by else 'id'))
4344

4445
while True:
4546
print(' ID USER HOST STATE TIME INFO')

0 commit comments

Comments
 (0)