Example #1
0
 def start_worker(self, image, tenant, worker_id):
     ch = WorkerChannel()
     # start an actor executor container and wait for a confirmation that image was pulled.
     worker_dict = run_worker(image, ch.name, worker_id)
     worker = Worker(tenant=tenant, **worker_dict)
     print(
         "worker started successfully, waiting on ack that image was pulled..."
     )
     result = ch.get()
     if result.get('status') == 'error':
         # there was a problem pulling the image; put the actor in an error state:
         msg = "got an error back from the worker. Message: {}", format(
             result)
         print(msg)
         if 'msg' in result:
             raise SpawnerException(message=result['msg'])
         else:
             raise SpawnerException(
                 message="Internal error starting worker process.")
     elif result['value']['status'] == 'ok':
         print("received ack from worker.")
         return ch, result['reply_to'], worker
     else:
         msg = "Got an error status from worker: {}. Raising an exception.".format(
             str(result))
         print(msg)
         raise SpawnerException(msg)
Example #2
0
 def start_worker(self, image):
     ch = WorkerChannel()
     # start an actor executor container and wait for a confirmation that image was pulled.
     worker = run_worker(image, ch._name)
     print("worker started successfully, waiting on ack that image was pulled...")
     result = ch.get()
     if result['value']['status'] == 'ok':
         print("received ack from worker.")
         return ch, result['reply_to'], worker
     else:
         print("Got an error status from worker: {}. Raising an exception.".format(str(result)))
         raise SpawnerException()
Example #3
0
 def start_worker(self, image, tenant):
     ch = WorkerChannel()
     # start an actor executor container and wait for a confirmation that image was pulled.
     worker_dict = run_worker(image, ch.name)
     worker = Worker(tenant=tenant, **worker_dict)
     print("worker started successfully, waiting on ack that image was pulled...")
     result = ch.get()
     if result["value"]["status"] == "ok":
         print("received ack from worker.")
         return ch, result["reply_to"], worker
     else:
         print("Got an error status from worker: {}. Raising an exception.".format(str(result)))
         raise SpawnerException()