Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

virtual void Impala::Job::Server::AcceptRequestForStatus ( char *  buf,
int  len,
int  bufSize,
CString  conn,
int  port 
) [inline, protected, virtual]

Definition at line 235 of file Server.h.

References Impala::Util::ChannelServer::ConnectionDescr(), FindJob(), Impala::Util::StringParser::GetInt(), Impala::Util::StringParser::GetString(), ILOG_DEBUG, ILOG_ERROR, and Impala::Job::Server::Job::state.

Referenced by AcceptRequest().

00237     {
00238         String curCon = ConnectionDescr();
00239         Util::StringParser parser(buf);
00240         parser.GetString(':');
00241         String requestKey = parser.GetString('=');
00242         if (requestKey == "jobId")
00243         {
00244             int jobId = parser.GetInt();
00245             if (jobId > 0)
00246             {
00247                 ILOG_DEBUG("Receiving request for report on job " << jobId <<
00248                            " from " << curCon);
00249                 Job* job = FindJob(jobId);
00250                 if (job)
00251                 {
00252                     sprintf(buf,
00253                             "JobStatus:jobId=%d;state=%d;exitCode=%d;errorLog=%s\0",
00254                             jobId, job->state, job->exitCode,
00255                             job->errorLog.c_str());
00256                     return;
00257                 }
00258                 else
00259                 {
00260                     ILOG_ERROR("Job ID unknown: " << jobId);
00261                 }
00262             }
00263             else
00264             {
00265                 ILOG_ERROR("No job ID specified: " << String(buf, len));
00266             }
00267         }
00268         else if (requestKey == "reference")
00269         {
00270             ILOG_DEBUG("Receiving request for job state changes from " <<
00271                        curCon);
00272             std::map<int, int> refList;
00273             int jobId = parser.GetInt(':', false, true);
00274             while (jobId > 0)
00275             {
00276                 JobStateType state = (JobStateType) parser.GetInt(' ', true,
00277                                                                   true);
00278                 refList[jobId] = state;
00279                 jobId = parser.GetInt(':', false, true);
00280             }
00281 
00282             int nrOfChanges = 0;
00283             std::ostringstream oss;
00284             std::map<int, int>::iterator iter = refList.begin();
00285             for ( ; iter != refList.end(); iter++)
00286             {
00287                 int jobId = iter->first;
00288                 Job* job = FindJob(jobId);
00289                 if (job)
00290                 {
00291                     if (job->state != iter->second)
00292                     {
00293                         oss << jobId << ':' << job->state << " ";
00294                         nrOfChanges++;
00295                     }
00296                 }
00297                 else
00298                 {
00299                     ILOG_ERROR("Job ID unknown: " << jobId);
00300                 }
00301             }
00302             if (nrOfChanges > 0)
00303                 sprintf(buf, "JobStatus:changed=%s\0", oss.str().c_str());
00304             else
00305                 sprintf(buf, "NoChange\0");
00306             return;
00307         }
00308         else
00309         {
00310            ILOG_ERROR("Invalid job report request: " << String(buf, len));
00311         }
00312 
00313         sprintf(buf, "ERROR\0");
00314     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:22:21 2011 for ImpalaSrc by  doxygen 1.5.1