SharcNet Job Kill Convenience Script - sqkillall.py

From SnOwy - Ed's Wiki Notebook

(Redirected from Sqkillall.py)
Jump to: navigation, search

sqkillall.py is a convenience script for sharcnet.

This script will terminate any integers you give it followed by a return ('\n').

To quit the script, give it an EOF (ctrl+c)

Get it here [1]

Usage

sqjobs | python sqkillall.py

Source

import sys
import re
import os

while True:
	sqline = sys.stdin.readline()
	if sqline is "\n":
		break
	reline = re.compile("[0-9]+").match(sqline)
	if not reline:
		continue
	order = "sqkill " +  sqline[reline.start():reline.end()]

	os.system(order)

Bugs

Will mistakenly interpret the number of CPUs in a given SharcNet cluster as a PID and try to terminate that integer-- just ignore it, nothing will happen.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox