Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make assigned CEI process name same as name set in container.

Fixes bug OOIION-560
  • Loading branch information...
commit 69048375f2fa2fb51292a2645014cd60968f844e 1 parent ea9bb87
@oldpatricka oldpatricka authored
View
6 ion/services/cei/process_dispatcher_service.py
@@ -593,13 +593,13 @@ def spawn(self, process_id, definition_id, schedule, configuration, name):
else:
self._add_process(process_id, configuration, None)
- self._inner_spawn(process_id, definition, schedule, configuration)
+ self._inner_spawn(process_id, name, definition, schedule, configuration)
return process_id
- def _inner_spawn(self, process_id, definition, schedule, configuration):
+ def _inner_spawn(self, process_id, process_name, definition, schedule, configuration):
- name = definition.name
+ name = process_name
module = definition.executable['module']
cls = definition.executable['class']
View
25 ion/services/cei/test/test_process_dispatcher.py
@@ -111,7 +111,7 @@ def test_create_schedule(self):
# name should be def name followed by a uuid
name = call_kwargs['name']
- self.assertEqual(name, proc_def['name'])
+ assert name.startswith(proc_def['name'])
self.assertEqual(len(call_kwargs), 5)
self.assertEqual(call_kwargs['module'], 'my_module')
self.assertEqual(call_kwargs['cls'], 'class')
@@ -212,17 +212,20 @@ def test_schedule(self):
self.mock_backend['read_definition'].return_value = ProcessDefinition()
upid = 'myupid'
+ name = 'myname'
definition_id = 'something'
queueing_mode = 'RESTART_ONLY'
restart_mode = 'ABNORMAL'
- self.pd_dashi_handler.schedule_process(upid, definition_id, queueing_mode=queueing_mode, restart_mode=restart_mode)
+ self.pd_dashi_handler.schedule_process(upid, definition_id, queueing_mode=queueing_mode, restart_mode=restart_mode, name=name)
self.assertEqual(self.mock_backend.spawn.call_count, 1)
args, kwargs = self.mock_backend.spawn.call_args
passed_schedule = args[2]
assert passed_schedule.queueing_mode == ProcessQueueingMode.RESTART_ONLY
assert passed_schedule.restart_mode == ProcessRestartMode.ABNORMAL
+ passed_name = args[4]
+ assert passed_name == name
def test_schedule_by_name(self):
pdef = ProcessDefinition()
@@ -641,6 +644,14 @@ def count(self):
def query(self):
return self.response
+ def get_process_name(self, pid=None):
+ if pid is None:
+ return
+ proc = self.container.proc_manager.procs.get(pid)
+ if proc is None:
+ return
+ return proc._proc_name
+
class TestClient(RPCClient):
def __init__(self, to_name=None, node=None, **kwargs):
@@ -653,6 +664,9 @@ def count(self, headers=None, timeout=None):
def query(self, headers=None, timeout=None):
return self.request({}, op='query', headers=headers, timeout=timeout)
+ def get_process_name(self, pid=None, headers=None, timeout=None):
+ return self.request({'pid': pid}, op='get_process_name', headers=headers, timeout=timeout)
+
@attr('INT', group='cei')
@@ -679,11 +693,12 @@ def test_create_schedule_cancel(self):
process_schedule = ProcessSchedule()
process_schedule.queueing_mode = ProcessQueueingMode.ALWAYS
+ proc_name = 'myreallygoodname'
pid = self.pd_cli.create_process(self.process_definition_id)
self.waiter.start(pid)
pid2 = self.pd_cli.schedule_process(self.process_definition_id,
- process_schedule, configuration={}, process_id=pid)
+ process_schedule, configuration={}, process_id=pid, name=proc_name)
self.assertEqual(pid, pid2)
# verifies L4-CI-CEI-RQ141 and L4-CI-CEI-RQ142
@@ -707,6 +722,10 @@ def test_create_schedule_cancel(self):
# verifies L4-CI-CEI-RQ147
+ # check the process name was set in container
+ got_proc_name = test_client.get_process_name(pid=pid2)
+ self.assertEqual(proc_name, got_proc_name)
+
# kill the process and start it again
self.pd_cli.cancel_process(pid)
Please sign in to comment.
Something went wrong with that request. Please try again.