Add option to print task IDs to qinfo

Option to print IDs (PIDs) of running clusters added to qinfo.
This provides an easy way for scripts and process managers to fetch the PID(s) of running clusters.
This commit is contained in:
Dan Bright
2016-06-03 20:50:20 +01:00
parent 2e062a2ba9
commit d66209de29
2 changed files with 20 additions and 2 deletions
+11
View File
@@ -187,3 +187,14 @@ def info(broker=None):
term.white('{0:.4f}'.format(exec_time))
)
return True
def get_ids():
# prints id (PID) of running clusters
stat = Stat.get_all()
if stat:
for s in stat:
print(s.cluster_id)
else:
print('No clusters appear to be running.')
return True