Fix worker exit cleanup (#6450)

* working but ugly

* comments

* proper but hanging in grpc server destructor

* grpc server shutdown deadline

* fix disconnect

* lint

* shutdown_only in test

* replace shutdown
This commit is contained in:
Edward Oakes
2019-12-13 16:52:50 -08:00
committed by GitHub
parent 3cb499632e
commit e2b7459bfc
8 changed files with 40 additions and 47 deletions
+3 -6
View File
@@ -688,6 +688,8 @@ cdef execute_task(
# If we've reached the max number of executions for this worker, exit.
task_counter = manager.get_task_counter(job_id, function_descriptor)
if task_counter == execution_info.max_calls:
# Intentionally disconnect so the raylet doesn't print an error.
# TODO(edoakes): we should handle max_calls in the core worker.
worker.core_worker.disconnect()
sys.exit(0)
@@ -737,11 +739,6 @@ cdef CRayStatus check_signals() nogil:
return CRayStatus.OK()
cdef void exit_handler() nogil:
with gil:
sys.exit(0)
cdef shared_ptr[CBuffer] string_to_buffer(c_string& c_str):
cdef shared_ptr[CBuffer] empty_metadata
if c_str.size() == 0:
@@ -787,7 +784,7 @@ cdef class CoreWorker:
raylet_socket.encode("ascii"), job_id.native(),
gcs_options.native()[0], log_dir.encode("utf-8"),
node_ip_address.encode("utf-8"), node_manager_port,
task_execution_handler, check_signals, exit_handler, True))
task_execution_handler, check_signals, True))
def disconnect(self):
self.destory_event_loop_if_exists()