Definition at line 133 of file Runner.h. References ILOG_ERROR, ILOG_INFO, ILOG_WARN, mJobCmdLineList, mJobServerProxy, mMaxIdleTimeSec, mSleepIntervalSec, Impala::Util::ChannelProxy::Send(), and Sleep(). Referenced by RunJobs(). 00134 { 00135 jobId = 0; 00136 int secWaiting = 0; 00137 String response = ""; 00138 bool reportedWaiting = false; 00139 while (true) 00140 { 00141 response = mJobServerProxy->Send("ProvideJob"); 00142 if (response == "NoJob") 00143 { 00144 if (mMaxIdleTimeSec > 0 && secWaiting >= mMaxIdleTimeSec) 00145 { 00146 ILOG_INFO("Maximum idle time reached (" << secWaiting << 00147 ")"); 00148 return false; 00149 } 00150 if (!reportedWaiting) 00151 { 00152 ILOG_INFO(mJobCmdLineList.size() << 00153 " job(s) done; waiting for new job"); 00154 reportedWaiting = true; 00155 } 00156 Sleep(mSleepIntervalSec); 00157 secWaiting += mSleepIntervalSec; 00158 } 00159 else if (response.substr(0, 7) == "RunJob:") 00160 { 00161 if (response.substr(7, 6) == "jobId=") 00162 { 00163 Util::StringParser parser(response, 13); 00164 jobId = parser.GetInt(';'); 00165 if (jobId > 0) 00166 { 00167 String rest = parser.GetString(';'); 00168 if (rest.substr(0, 8) == "cmdLine=") 00169 { 00170 cmdLine = rest.substr(8); 00171 if (!cmdLine.empty()) 00172 return true; 00173 } 00174 } 00175 } 00176 ILOG_WARN("Received invalid job specification: " << response); 00177 return false; 00178 } 00179 else if (response.substr(0, 6) == "Poison") 00180 { 00181 // exit the job runner 00182 return false; 00183 } 00184 else 00185 { 00186 ILOG_ERROR("Unexpected job request response: " << response); 00187 return false; 00188 } 00189 } 00190 }
Here is the call graph for this function:
|