Permalink
Browse files

Fix bug when terminating processes with same name.

Terminate process was looking up the pyon process id by pyon name
(which is not unique), rather than process name.
  • Loading branch information...
1 parent 22e1d8d commit c61bfff772e7b00a41ddc16e69ba50d8485d06bf @oldpatricka oldpatricka committed Sep 6, 2012
Showing with 14 additions and 15 deletions.
  1. +12 −12 pidantic/pyon/pidpyon.py
  2. +2 −3 pidantic/pyon/pyon.py
View
@@ -144,7 +144,7 @@ def sm_state_changed(self, new_state):
self._pyon._pyon_db.db_commit()
def sm_starting(self):
- self._log.info("%s Starting" % (self._program_object.pyon_name))
+ self._log.info("%s Starting" % (self._program_object.process_name))
self._pyon.run_process(self._program_object)
def sm_request_canceled(self):
@@ -156,35 +156,35 @@ def sm_started(self):
self._program_object.pyon_name))
def sm_start_canceled(self):
- self._pyon.terminate_process(self._program_object.pyon_name)
+ self._pyon.terminate_process(self._program_object.process_name)
def sm_start_fault(self):
- self._log.info("%s Start fault" % (self._program_object.pyon_name))
+ self._log.info("%s Start fault" % (self._program_object.process_name))
def sm_exited(self):
- self._log.log(logging.INFO, "%s Exited" % (self._program_object.pyon_name))
+ self._log.log(logging.INFO, "%s Exited" % (self._program_object.process_name))
def sm_stopping(self):
- self._pyon.terminate_process(self._program_object.pyon_name)
+ self._pyon.terminate_process(self._program_object.process_name)
def sm_kill(self):
- self._pyon.terminate_process(self._program_object.pyon_name)
+ self._pyon.terminate_process(self._program_object.process_name)
def sm_run_fault(self):
- self._log.info("%s run fault" % (self._program_object.pyon_name))
+ self._log.info("%s run fault" % (self._program_object.process_name))
def sm_stopped(self):
- self._log.info("%s Stopped" % (self._program_object.pyon_name))
+ self._log.info("%s Stopped" % (self._program_object.process_name))
def sm_restarting(self):
- self._log.log(logging.INFO, "%s Restarting" % (self._program_object.pyon_name))
- self._pyon.terminate_program(self._program_object.pyon_name)
+ self._log.log(logging.INFO, "%s Restarting" % (self._program_object.process_name))
+ self._pyon.terminate_program(self._program_object.process_name)
def sm_stopping_fault(self):
- self._log.log(logging.INFO, "%s Stopping fault" % (self._program_object.pyon_name))
+ self._log.log(logging.INFO, "%s Stopping fault" % (self._program_object.process_name))
def sm_restart_fault(self):
- self._log.log(logging.INFO, "%s Re-Starting fault" % (self._program_object.pyon_name))
+ self._log.log(logging.INFO, "%s Re-Starting fault" % (self._program_object.process_name))
def get_result_code(self):
return self._exit_code
View
@@ -123,7 +123,6 @@ def load_module(self, module_file, module):
try:
load_source(module_name, module_file)
except:
- #TODO throw right exception
msg = "Unable to load code module %s" % module
self._log.exception(msg)
raise PIDanticExecutionException(msg)
@@ -144,16 +143,16 @@ def getState(self):
@proc_manager_lock
def terminate_process(self, name):
-
pyon_id = self._get_pyon_process_id(name)
terminate_result = self._container.terminate_process(pyon_id)
+
return terminate_result
def _get_pyon_process_id(self, name):
process_object = None
data_object = self._data_object
for p in data_object.processes:
- if p.pyon_name == name:
+ if p.process_name == name:
process_object = p
break
if not process_object:

0 comments on commit c61bfff

Please sign in to comment.