mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 20:35:02 -02:30
Fix some issues starting the callback receiver workers
This commit is contained in:
@@ -36,7 +36,7 @@ def run_subscriber(consumer_port, queue_port, use_workers=True):
|
|||||||
if use_workers:
|
if use_workers:
|
||||||
workers = []
|
workers = []
|
||||||
for idx in range(4):
|
for idx in range(4):
|
||||||
w = Worker(queue_port)
|
w = Process(target=callback_worker, args=(queue_port,))
|
||||||
w.start()
|
w.start()
|
||||||
workers.append(w)
|
workers.append(w)
|
||||||
|
|
||||||
@@ -85,23 +85,14 @@ def process_job_event(data):
|
|||||||
logger.error('Failed to save job event after %d retries.',
|
logger.error('Failed to save job event after %d retries.',
|
||||||
retry_count)
|
retry_count)
|
||||||
|
|
||||||
|
def callback_worker(port):
|
||||||
class Worker(Process):
|
print("Starting worker")
|
||||||
'''
|
pool_context = zmq.Context()
|
||||||
Process to validate and store save job events received via zeromq
|
pool_subscriber = pool_context.socket(zmq.PULL)
|
||||||
'''
|
pool_subscriber.connect(port)
|
||||||
|
while True:
|
||||||
def __init__(self, port):
|
message = pool_subscriber.recv_json()
|
||||||
self.port = port
|
process_job_event(message)
|
||||||
|
|
||||||
def run(self):
|
|
||||||
print("Starting worker")
|
|
||||||
pool_context = zmq.Context()
|
|
||||||
pool_subscriber = pool_context.socket(zmq.PULL)
|
|
||||||
pool_subscriber.connect(self.port)
|
|
||||||
while True:
|
|
||||||
message = pool_subscriber.recv_json()
|
|
||||||
process_job_event(message)
|
|
||||||
|
|
||||||
class Command(NoArgsCommand):
|
class Command(NoArgsCommand):
|
||||||
'''
|
'''
|
||||||
|
|||||||
Reference in New Issue
Block a user