Permalink
Browse files

Moving part of init into subsystem base class. Other edits.

  • Loading branch information...
1 parent f43fe61 commit 05b599b9db0fdea47ed102f0967a4b84d421c8d5 @jaredbischof committed Mar 21, 2013
Showing with 10 additions and 17 deletions.
  1. +10 −17 mcp_modules/queue.py
View
@@ -1,37 +1,30 @@
-import time
from subsystem import subsystem
class queue(subsystem):
- actions = "start, stop"
+ actions = [ 'start', 'stop', 'log' ]
- def __init__(self, MCP_dir):
- subsystem.__init__(self, MCP_dir)
+ def __init__(self, MCP_path):
+ subsystem.__init__(self, MCP_path)
# getting status of queues
- sout, serr = self.run_cmd("/usr/local/bin/qstat -Q batch")
+ sout = self.run_cmd("/usr/local/bin/qstat -Q batch")
lines = sout.splitlines()
batch_status = 'online' if lines[len(lines)-1].split()[3] == 'yes' else 'offline'
- sout, serr = self.run_cmd("/usr/local/bin/qstat -Q fast")
+ sout = self.run_cmd("/usr/local/bin/qstat -Q fast")
lines = sout.splitlines()
fast_status = 'online' if lines[len(lines)-1].split()[3] == 'yes' else 'offline'
- self.state = { 'resource':self.__class__.__name__,
- 'updated':time.strftime("%Y-%m-%d %H:%M:%S"),
- 'url':self.json_conf['global']['apiurl'] + "/" + str(self.json_conf['mcp_api']['version']) + "/" + self.__class__.__name__,
- 'status': { 'batch': batch_status,
- 'fast': fast_status
- }
- }
+ self.state['status'] = { 'batch': batch_status, 'fast': fast_status }
def start(self):
print "Starting nagasaki pipeline:"
- sout, serr = self.run_cmd("/usr/local/bin/qstart batch")
+ sout = self.run_cmd("/usr/local/bin/qstart batch")
print "nagasaki pipeline started!"
- return 0
+ return 1
def stop(self):
print "Stopping nagasaki pipeline:"
- sout, serr = self.run_cmd("/usr/local/bin/qstop batch")
+ sout = self.run_cmd("/usr/local/bin/qstop batch")
print "nagasaki pipeline stopped!"
- return 0
+ return 1

0 comments on commit 05b599b

Please sign in to comment.