From 15836eb98e3ab96d6467bcc4acdcd8271d7edd02 Mon Sep 17 00:00:00 2001 From: tqchen Date: Mon, 22 Dec 2014 04:17:23 -0800 Subject: [PATCH] add task id --- src/allreduce_base.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/allreduce_base.cc b/src/allreduce_base.cc index 859d0b5f3..418b0fd66 100644 --- a/src/allreduce_base.cc +++ b/src/allreduce_base.cc @@ -34,6 +34,9 @@ void AllreduceBase::Init(void) { // setup from enviroment variables {// handling for hadoop const char *task_id = getenv("mapred_tip_id"); + if (task_id == NULL) { + task_id = getenv("mapreduce_task_id"); + } if (hadoop_mode != 0) { utils::Check(task_id != NULL, "hadoop_mode is set but cannot find mapred_task_id"); } @@ -45,7 +48,7 @@ void AllreduceBase::Init(void) { if (attempt_id != 0) { const char *att = strrchr(attempt_id, '_'); int num_trial; - if (att != NULL && sscanf(att+1, "%d", &num_trial) == 1) { + if (att != NULL && sscanf(att + 1, "%d", &num_trial) == 1) { this->SetParam("rabit_num_trial", att + 1); } }