def _create_worker_runtime(port, name='', executor=None): args = set_pod_parser().parse_args([]) args.port = port args.name = name if executor: args.uses = executor with WorkerRuntime(args) as runtime: runtime.run_forever()
def start_runtime(args, cancel_event, handler_closed_event): with WorkerRuntime(args, cancel_event=cancel_event) as runtime: runtime._data_request_handler.handle = lambda *args, **kwargs: time.sleep( slow_executor_block_time) runtime._data_request_handler.close = ( lambda *args, **kwargs: handler_closed_event.set()) runtime.run_forever()
def worker_runtime(args: 'Namespace'): """ Starts a WorkerRuntime :param args: arguments coming from the CLI. """ from jina.serve.runtimes.worker import WorkerRuntime with WorkerRuntime(args) as runtime: runtime.logger.info( f'Executor {runtime._data_request_handler._executor.metas.name} started' ) runtime.run_forever()
def start_runtime(args, cancel_event): with WorkerRuntime(args, cancel_event=cancel_event) as runtime: runtime.run_forever()