Do not use whitespace separator in coordination ID
Some coordination backends, like memcached, do not support whitespaces in keys. To avoid issues with such backends let's join with underscore rather then whitespace Change-Id: I9f8b835f695575cc10675b5e0d064daaf32ce319
This commit is contained in:
parent
0d1d6cd548
commit
c4eb31490c
@ -61,14 +61,14 @@ Services Information
|
||||
+----------------------------------+------------+-------------+---------------------------+
|
||||
| Name | Process Id | Hostname | Created At |
|
||||
+----------------------------------+------------+-------------+---------------------------+
|
||||
| ApiWorker worker(0) | 1084 | my-devstack | 2019-03-13T14:31:46+00:00 |
|
||||
| EvaluatorWorker worker(0) | 1082 | my-devstack | 2019-03-13T14:31:46+00:00 |
|
||||
| MachineLearningService worker(0) | 5956 | my-devstack | 2019-03-13T10:30:54+00:00 |
|
||||
| PersistorService worker(0) | 22536 | my-devstack | 2019-03-13T14:14:15+00:00 |
|
||||
| SnmpParsingService worker(0) | 6170 | my-devstack | 2019-03-13T10:30:56+00:00 |
|
||||
| VitrageNotifierService worker(0) | 22746 | my-devstack | 2019-03-13T14:14:27+00:00 |
|
||||
| vitrageuWSGI worker 1 | 2847 | my-devstack | 2019-03-13T10:30:47+00:00 |
|
||||
| vitrageuWSGI worker 2 | 2848 | my-devstack | 2019-03-13T10:30:47+00:00 |
|
||||
| ApiWorker_worker_0 | 1084 | my-devstack | 2019-03-13T14:31:46+00:00 |
|
||||
| EvaluatorWorker_worker_0 | 1082 | my-devstack | 2019-03-13T14:31:46+00:00 |
|
||||
| MachineLearningService_worker_0 | 5956 | my-devstack | 2019-03-13T10:30:54+00:00 |
|
||||
| PersistorService_worker_0 | 22536 | my-devstack | 2019-03-13T14:14:15+00:00 |
|
||||
| SnmpParsingService_worker_0 | 6170 | my-devstack | 2019-03-13T10:30:56+00:00 |
|
||||
| VitrageNotifierService_worker_0 | 22746 | my-devstack | 2019-03-13T14:14:27+00:00 |
|
||||
| vitrageuWSGI_worker_1 | 2847 | my-devstack | 2019-03-13T10:30:47+00:00 |
|
||||
| vitrageuWSGI_worker_2 | 2848 | my-devstack | 2019-03-13T10:30:47+00:00 |
|
||||
+----------------------------------+------------+-------------+---------------------------+
|
||||
|
||||
Processes
|
||||
|
@ -1962,49 +1962,49 @@ Response Examples
|
||||
"Created At": "2019-02-10T11:07:15+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23161,
|
||||
"Name": "ApiWorker worker(0)"
|
||||
"Name": "ApiWorker_worker_0"
|
||||
},
|
||||
{
|
||||
"Created At": "2019-02-10T11:07:15+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23153,
|
||||
"Name": "EvaluatorWorker worker(0)"
|
||||
"Name": "EvaluatorWorker_worker_0"
|
||||
},
|
||||
{
|
||||
"Created At": "2019-02-10T11:07:15+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23155,
|
||||
"Name": "EvaluatorWorker worker(1)"
|
||||
"Name": "EvaluatorWorker_worker_1"
|
||||
},
|
||||
{
|
||||
"Created At": "2019-02-10T11:07:15+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23157,
|
||||
"Name": "EvaluatorWorker worker(2)"
|
||||
"Name": "EvaluatorWorker_worker_2"
|
||||
},
|
||||
{
|
||||
"Created At": "2019-02-10T11:07:15+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23158,
|
||||
"Name": "EvaluatorWorker worker(3)"
|
||||
"Name": "EvaluatorWorker_worker_3"
|
||||
},
|
||||
{
|
||||
"Created At": "2019-02-10T11:07:33+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23366,
|
||||
"Name": "MachineLearningService worker(0)"
|
||||
"Name": "MachineLearningService_worker_0"
|
||||
},
|
||||
{
|
||||
"Created At": "2019-02-10T11:07:35+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23475,
|
||||
"Name": "PersistorService worker(0)"
|
||||
"Name": "PersistorService_worker_0"
|
||||
},
|
||||
{
|
||||
"Created At": "2019-02-10T11:07:15+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23164,
|
||||
"Name": "SnmpParsingService worker(0)"
|
||||
"Name": "SnmpParsingService_worker_0"
|
||||
},
|
||||
{
|
||||
"Created At": "2019-02-10T11:14:30+00:00",
|
||||
@ -2022,7 +2022,7 @@ Response Examples
|
||||
"Created At": "2019-02-10T11:07:32+00:00",
|
||||
"Hostname": "controller-1",
|
||||
"Process Id": 23352,
|
||||
"Name": "VitrageNotifierService worker(0)"
|
||||
"Name": "VitrageNotifierService_worker_0"
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
other:
|
||||
- |
|
||||
Service ``Name`` field has changed format and now separated
|
||||
with underscores rather then whitespaces.
|
@ -30,7 +30,7 @@ LOG = log.getLogger(__name__)
|
||||
class Coordinator(object):
|
||||
def __init__(self, my_id=None):
|
||||
self.backend_url = CONF.coordination.backend_url
|
||||
self.my_id = my_id or ' '.join(psutil.Process(os.getpid()).cmdline())
|
||||
self.my_id = my_id or '_'.join(psutil.Process(os.getpid()).cmdline())
|
||||
self.coordinator = None
|
||||
if self.backend_url:
|
||||
self.coordinator = tooz.coordination.get_coordinator(
|
||||
|
@ -21,8 +21,8 @@ class Service(cotyledon.Service):
|
||||
|
||||
def __init__(self, worker_id):
|
||||
super(Service, self).__init__(worker_id)
|
||||
self.coordinator = Coordinator('%s worker(%s)' % (self.name,
|
||||
worker_id))
|
||||
self.coordinator = Coordinator('%s_worker_%s' % (self.name,
|
||||
worker_id))
|
||||
|
||||
def run(self):
|
||||
self.coordinator.start()
|
||||
|
Loading…
Reference in New Issue
Block a user