Commit f6477811 authored by Jameson Rollins's avatar Jameson Rollins

system manager user code variable

This allows for specifying a "GRD_MANAGER" variable in the user code that
will be used to set the initial MANAGER record, with an initial MODE of
MANAGED.
parent dde2d1fc
Pipeline #47248 passed with stages
in 34 seconds
......@@ -101,7 +101,7 @@ parser.add_argument('-o', '--op', metavar='<op>', dest='dop',
choices=DAEMON_OP_INIT, default='EXEC',
help="set initial daemon OP ({}|{})".format(*DAEMON_OP_INIT))
parser.add_argument('-m', '--mode', metavar='<mode>', dest='dmode',
choices=DAEMON_MODE_INIT, default='AUTO',
choices=DAEMON_MODE_INIT,
help="set initial daemon MODE ({}|{}|{})".format(*DAEMON_MODE_INIT))
cgroup = parser.add_mutually_exclusive_group()
......
......@@ -40,7 +40,7 @@ class Daemon(object):
"""
def __init__(self, system, logger,
initial_op='EXEC',
initial_mode='AUTO',
initial_mode=None,
initial_state=None,
initial_request=None,
single_shot=False,
......@@ -98,7 +98,13 @@ class Daemon(object):
# set initial values
self['TIME_INIT'] = int(time.time())
self['OP'] = initial_op
self['MODE'] = initial_mode
if initial_mode is not None:
self['MODE'] = initial_mode
elif self.system.manager:
self['MANAGER'] = self.system.manager
self['MODE'] = 'MANAGED'
else:
self['MODE'] = 'AUTO'
self['LOGLEVEL'] = self.default_loglevel
self['STATE'] = initial_state or 'INIT'
self['TARGET'] = self['STATE']
......@@ -123,6 +129,8 @@ class Daemon(object):
self.log.info("initial request: %s" % self['REQUEST'])
if not self.single_shot:
self.log.info("nominal state: %s" % self['NOMINAL'])
if self.system.manager:
self.log.info("initial manager: %s" % self['MANAGER'])
self.log.info("CA setpoint monitor: %s" % self['SPM_MONITOR'])
self.log.info("CA setpoint monitor notify: %s" % self['SPM_MONITOR_NOTIFY'])
......
......@@ -128,6 +128,7 @@ class GuardSystem(object):
# reset parameters loaded from module
self._initial_request = None
self._nominal_state = None
self._manager = None
self._node_managers = {}
# don't recorgnize ca_prefix changes on reset
self._ca_monitor = False
......@@ -477,6 +478,12 @@ class GuardSystem(object):
else:
self._nominal_state = None
# set manager
if hasattr(module, 'GRD_MANAGER'):
self._manager = module.GRD_MANAGER
else:
self._manager = None
# add specified edges
if hasattr(module, 'edges'):
# verify states
......@@ -584,7 +591,7 @@ class GuardSystem(object):
@property
def related_displays(self):
"""MEDM related displays.
"""User code specified MEDM related displays.
List of (label, name, args) string tuples.
"""
......@@ -592,14 +599,19 @@ class GuardSystem(object):
@property
def request(self):
"""Initial REQUEST state."""
"""User code specified REQUEST state."""
return self._initial_request
@property
def nominal(self):
"""Initial NOMINAL state."""
"""User code specified NOMINAL state."""
return self._nominal_state
@property
def manager(self):
"""User code specified MANAGER."""
return self._manager
@property
def graph(self):
"""System state graph object."""
......
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