Commit 7f12d68d authored by Paul Rich's avatar Paul Rich
Browse files

Merge branch 'master' into 21-interactive-mode

parents 74cf7853 3045a0cf
......@@ -50,6 +50,10 @@ class CrayNode(ClusterNode):
idle.
'''
#admin down wins. If an admin says it's down, it's down.
if self.admin_down:
self._status = 'down'
return
if new_status.upper() in self.CRAY_STATE_MAP.keys():
self._status = self.CRAY_STATE_MAP[new_status.upper()]
self.ALPS_status = new_status
......
......@@ -1056,8 +1056,10 @@ class CraySystem(BaseSystem):
node = self.nodes[str(node_id)]
try:
if updates.get('down', False):
node.admin_down = True
node.status = 'down'
elif updates.get('up', False):
node.admin_down = False
node.status = 'idle'
elif updates.get('queues', None):
node.queues = list(updates['queues'].split(':'))
......
......@@ -31,6 +31,7 @@ class Resource(object):
self.managed = False
self.init_actions = []
self.cleanup_actions = []
self.admin_down = False
def reset_info(self, node):
'''reset node information on restart from a stored node object'''
......@@ -39,6 +40,7 @@ class Resource(object):
self.reserved_jobid = node.reserved_jobid
self.reserved_until = node.reserved_until
self.managed = node.managed
self.admin_down = node.admin_down
def __hash__(self):
'''Hash is the hash of the string name for the resource.'''
......@@ -73,7 +75,10 @@ class Resource(object):
if value not in self.RESOURCE_STATUSES:
raise InvalidStatusError('%s status invalid. Must be one of %s' % \
(value, self.RESOURCE_STATUSES))
self._status = value
if self.admin_down:
self._status = 'down'
else:
self._status = value
@property
def available_attributes(self):
......
......@@ -15,6 +15,7 @@ from subprocess import Popen, PIPE, STDOUT
import time
import json
import logging
import logging.handlers
SUCCESS = 0
RESET_FAILURE = 3
......@@ -33,9 +34,17 @@ POLL_INT = 0.25
CAPMC_CMD = '/opt/cray/capmc/default/bin/capmc'
logging.basicConfig(format='%(asctime)s %(message)s',
datefmt='%Y-%d-%m %H:%M:%S.%f')
logger = logging.getLogger()
#syslog setup
log_datefmt = '%Y-%d-%m %H:%M:%S'
base_fmt = '%(asctime)s %(message)s'
syslog_fmt = '%(name)s[%(process)d]: %(asctime)s %(message)s'
logging.basicConfig(format=base_fmt, datefmt=log_datefmt)
logger = logging.getLogger('reset_memory_mode')
logger.setLevel(logging.INFO)
syslog = logging.handlers.SysLogHandler('/dev/log')
syslog.setFormatter(logging.Formatter(syslog_fmt, datefmt=log_datefmt))
logger.addHandler(syslog)
def expand_num_list(num_list):
'''Take a compact, comma-seperated string of integer values and ranges and
......
......@@ -15,6 +15,7 @@ from subprocess import Popen, PIPE, STDOUT
import time
import json
import logging
import logging.handlers
SUCCESS = 0
RESET_FAILURE = 3
......@@ -33,9 +34,17 @@ POLL_INT = 0.25
CAPMC_CMD = '/opt/cray/capmc/default/bin/capmc'
logging.basicConfig(format='%(asctime)s %(message)s',
datefmt='%Y-%d-%m %H:%M:%S.%f')
logger = logging.getLogger()
#syslog setup
log_datefmt = '%Y-%d-%m %H:%M:%S'
base_fmt = '%(asctime)s %(message)s'
syslog_fmt = '%(name)s[%(process)d]: %(asctime)s %(message)s'
logging.basicConfig(format=base_fmt, datefmt=log_datefmt)
logger = logging.getLogger('reset_memory_mode_default')
logger.setLevel(logging.INFO)
syslog = logging.handlers.SysLogHandler('/dev/log')
syslog.setFormatter(logging.Formatter(syslog_fmt, datefmt=log_datefmt))
logger.addHandler(syslog)
def expand_num_list(num_list):
'''Take a compact, comma-seperated string of integer values and ranges and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment