Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Add passthrough for heartbeat in eeagent config
Browse files Browse the repository at this point in the history
  • Loading branch information
oldpatricka committed Aug 17, 2012
1 parent a228664 commit 363b5eb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions epuharness/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def start(self, deployment_file=None, deployment_str=None):
logfile=eeagent.get('logfile'),
slots=eeagent.get('slots'),
system_name=eeagent.get('system_name'),
supd_directory=os.path.join(self.pidantic_dir, eeagent_name))
supd_directory=os.path.join(self.pidantic_dir, eeagent_name),
heartbeat=eeagent.get('heartbeat'))

# Start Pyon Process Dispatchers
self.pyon_process_dispatchers = deployment.get('pyon-process-dispatchers', {})
Expand Down Expand Up @@ -558,7 +559,7 @@ def _build_process_dispatcher_config(self, exchange, name, config,

def _start_eeagent(self, name, process_dispatcher, launch_type,
pyon_directory=None, logfile=None, exe_name="eeagent", slots=None,
system_name=None, supd_directory=None):
system_name=None, supd_directory=None, heartbeat=None):
"""Starts an eeagent with SupervisorD
@param name: Name of process dispatcher to start
Expand All @@ -570,21 +571,22 @@ def _start_eeagent(self, name, process_dispatcher, launch_type,
@param exe_name: the name of the eeagent executable
@param slots: the number of slots available for processes
@param system_name: pyon system name
@param heartbeat: how often heartbeat is sent
"""
log.info("Starting EEAgent '%s'" % name)

config_file = self._build_eeagent_config(self.exchange, name,
process_dispatcher, launch_type, pyon_directory,
logfile=logfile, slots=slots, supd_directory=supd_directory,
system_name=system_name)
system_name=system_name, heartbeat=heartbeat)
cmd = "%s %s" % (exe_name, config_file)
pid = self.factory.get_pidantic(command=cmd, process_name=name,
directory=self.pidantic_dir, autorestart=True)
pid.start()

def _build_eeagent_config(self, exchange, name, process_dispatcher,
launch_type, pyon_directory=None, logfile=None, supd_directory=None,
slots=None, system_name=None):
slots=None, system_name=None, heartbeat=None):
"""Builds a yaml config file to feed to the eeagent
@param exchange: the AMQP exchange the service should be on
Expand All @@ -596,6 +598,7 @@ def _build_eeagent_config(self, exchange, name, process_dispatcher,
@param logfile: the log file for the eeagent
@param slots: the number of slots available for processes
@param system_name: pyon system name
@param heartbeat: how often heartbeat is sent
"""
if not logfile:
logfile = "/dev/null"
Expand All @@ -613,6 +616,9 @@ def _build_eeagent_config(self, exchange, name, process_dispatcher,
if not slots:
slots = 8

if not heartbeat:
heartbeat = 30

try:
os.makedirs(supd_directory)
except OSError:
Expand All @@ -625,6 +631,7 @@ def _build_eeagent_config(self, exchange, name, process_dispatcher,
'eeagent': {
'name': name,
'slots': slots,
'heartbeat': heartbeat,
'launch_type': {
'name': launch_type,
'supd_directory': supd_directory,
Expand Down

0 comments on commit 363b5eb

Please sign in to comment.