From 09242e6d31b7b160ca524e67fc247951f953c920 Mon Sep 17 00:00:00 2001 From: SongGuyang Date: Tue, 9 Feb 2021 04:57:25 +0800 Subject: [PATCH] random a job id in c++ worker (#13982) --- cpp/src/ray/util/process_helper.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp/src/ray/util/process_helper.cc b/cpp/src/ray/util/process_helper.cc index 3ee6a2c34..6511b5b8b 100644 --- a/cpp/src/ray/util/process_helper.cc +++ b/cpp/src/ray/util/process_helper.cc @@ -70,7 +70,12 @@ void ProcessHelper::RayStart(std::shared_ptr config, options.store_socket = store_socket; options.raylet_socket = raylet_socket; if (options.worker_type == WorkerType::DRIVER) { - options.job_id = JobID::FromInt(0); + /// TODO(Guyang Song): Get next job id from core worker by GCS client. + /// Random a number to avoid repeated job ids. + /// The repeated job ids will lead to task hang when driver connects to a existing + /// cluster more than once. + std::srand(std::time(nullptr)); + options.job_id = JobID::FromInt(std::rand()); } options.gcs_options = gcs_options; options.enable_logging = true;