random a job id in c++ worker (#13982)

This commit is contained in:
SongGuyang 2021-02-09 04:57:25 +08:00 committed by GitHub
parent ec94214957
commit 09242e6d31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,7 +70,12 @@ void ProcessHelper::RayStart(std::shared_ptr<RayConfig> 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;