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

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

Definition at line 78 of file Server.h.

References Impala::Util::ChannelServer::ConnectionDescr(), Impala::Util::StringParser::Eat(), Impala::Core::IDash::XmlJobReference::Export(), Impala::Util::IOBuffer::GetBuffer(), Impala::Util::StringParser::GetString(), ILOG_ERROR, ILOG_INFO, Impala::Core::VideoJob::ServerProxy::IsConnected(), mJobMap, mJobServer, Impala::Util::StringParser::Position(), and Impala::Core::VideoJob::ServerProxy::ScheduleJob().

Referenced by AcceptRequest().

00079     {
00080         String curCon = ConnectionDescr();
00081         ILOG_INFO("ScheduleJob from " << curCon);
00082 
00083         if (!mJobServer->IsConnected())
00084         {
00085             ILOG_ERROR("Cannot do schedule: No connection to jobserver");
00086             return;
00087         }
00088 
00089         if (strncmp(buf, "ScheduleJob:", 12) == 0)
00090         {
00091             Util::StringParser parser(String(buf, len));
00092             parser.Eat("baseUri=");
00093             String baseUri = parser.GetString(';', true);
00094             parser.Eat("job=");
00095             int jobLen = len - parser.Position();
00096             Util::IOBuffer ioBuf(jobLen);
00097             memcpy(ioBuf.GetBuffer(), buf + parser.Position(), jobLen);
00098             XmlJob job("IDashJob", &ioBuf);
00099             if (!job.Valid())
00100             {
00101                 ILOG_ERROR("Invalid job request");
00102                 return;
00103             }
00104 
00105             int dummy;
00106             if (mJobMap.Get(job.GetId(), dummy))
00107             {
00108                 ILOG_ERROR("ScheduleJob: jobId already exists");
00109                 return;
00110             }
00111 
00112             String cmdLine = "do_process ";
00113             if (job.GetAnnotationSet().empty())
00114             {
00115                 if (job.GetVideo().empty())
00116                 {
00117                     cmdLine += "queryset " + job.GetQuerySet();
00118                 }
00119                 else
00120                 {
00121                     cmdLine += "video " + job.GetVideo() + " " + job.GetQuerySet();
00122                 }
00123             }
00124             else
00125             {
00126                 cmdLine = "do_annotator " + job.GetAnnotationSet();
00127             }
00128             int serverJobId = mJobServer->ScheduleJob(cmdLine, 0);
00129             ILOG_INFO("Scheduled job: xmlJobId=" << job.GetId() <<
00130                       ", serverJobId=" << serverJobId << ", cmdLine=" <<
00131                       cmdLine);
00132             mJobMap.Add(job.GetId(), serverJobId);
00133 
00134             String hRef = baseUri + "jobs/" + job.GetId();
00135             XmlJobReference jobRef(hRef);
00136             String jobRefString = jobRef.Export();
00137             sprintf(buf, "JobAccepted:jobRef=%s\0", jobRefString.c_str());
00138         }
00139         else
00140         {
00141             ILOG_ERROR("Invalid schedule request: " << String(buf, len));
00142         }
00143     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:12:57 2010 for ImpalaSrc by  doxygen 1.5.1