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

void Impala::Core::VideoJob::Reporter::WriteReportStatus (  )  const [inline]

Definition at line 107 of file Reporter.h.

References Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CPB(), Impala::Job::State::CREATED, Impala::Core::VideoJob::Data::VideoMeta::discarded, ILOG_ERROR, Impala::Core::VideoJob::Data::VideoMeta::jobs, Impala::Core::VideoJob::Data::mAllJobs, mData, Impala::Core::VideoJob::Data::mPort, Impala::Core::VideoJob::Data::mProcessDef, Impala::Core::VideoJob::Data::mProcessDefFile, Impala::Core::VideoJob::Data::mServerName, mStatusImage, mStatusImageColWidth, mStatusImageRowHeight, Impala::Core::VideoJob::Data::mVideos, Impala::Core::VideoJob::Data::mVideoSetName, Impala::Core::VideoJob::Data::mVideoSetSize, Impala::Core::Array::Pattern::PtrWrite(), Impala::Job::State::RESCHEDULED, Impala::Job::State::RUNNING, Impala::Job::State::SCHEDULED, Impala::Core::VideoJob::ProcessDefinition::StepCount(), Impala::Job::State::SUBMITTED, Impala::Job::State::TERMINATED_ABNRM, Impala::Job::State::TERMINATED_NRM, Impala::Core::VideoJob::Data::VideoSetSize(), Impala::Core::VideoJob::Data::WasInitiallyMaskedOut(), and Impala::Core::Array::WritePng().

Referenced by Impala::Core::VideoJob::Manager::ReportState().

00108     {
00109         // write status overview image
00110 
00111         static const Vec3Int32 colorStateExcluded(128, 128, 128); // dk grey
00112         static const Vec3Int32 colorStateInitial(190, 190, 190); // lt grey
00113         static const Vec3Int32 colorStateScheduled(128, 128, 0);
00114         static const Vec3Int32 colorStateRunning(255, 255, 0); // gold
00115         static const Vec3Int32 colorStateCompleted(0, 255, 0); // lt green
00116         static const Vec3Int32 colorStateFailed(255, 0, 0); // red
00117         static const Vec3Int32 colorStateUnknown(0, 0, 255); 
00118 
00119         const Vec3Int32* color = 0;
00120 
00121         for (int stepID = 0; stepID < mData.mProcessDef->StepCount(); stepID++)
00122         {
00123             for (int vidID = 0; vidID < mData.VideoSetSize(); vidID++)
00124             {
00125                 // determine status color 
00126                 if (mData.WasInitiallyMaskedOut(vidID))
00127                 {
00128                     color = &colorStateExcluded;
00129                 }
00130                 else 
00131                 {
00132                     const VideoMeta& video = mData.mVideos.find(vidID)->second;
00133                     if (stepID >= video.jobs.size())
00134                     {
00135                         if (video.discarded)
00136                             color = &colorStateExcluded;
00137                         else
00138                             color = &colorStateInitial;
00139                     }
00140                     else
00141                     {
00142                         VideoJob* const job = video.jobs[stepID];
00143                         switch (job->state)
00144                         {
00145                             case Job::State::CREATED:
00146                             case Job::State::SUBMITTED:
00147                             case Job::State::SCHEDULED:
00148                             case Job::State::RESCHEDULED:
00149                                 color = &colorStateScheduled;
00150                                 break;
00151                             case Job::State::RUNNING:
00152                                 color = &colorStateRunning;
00153                                 break;
00154                             case Job::State::TERMINATED_NRM:
00155                                 if (job->exitCode != 0)
00156                                     color = &colorStateFailed;
00157                                 else
00158                                     color = &colorStateCompleted;
00159                                 break;
00160                             case Job::State::TERMINATED_ABNRM:
00161                                 color = &colorStateFailed;
00162                                 break;
00163                             default:
00164                                 ILOG_ERROR("Reporting unexpected job state: "
00165                                            << job->state);
00166                                 color = &colorStateUnknown;
00167                         }
00168                     }
00169                 }
00170 
00171                 // set color to relevant status pixels
00172                 int xOffset = vidID * mStatusImageColWidth + 1;
00173                 int yOffset = stepID * mStatusImageRowHeight + 1;
00174                 for (int x = 0; x < mStatusImageColWidth-1; x++)
00175                 {
00176                     int xAbs = xOffset + x;
00177                     for (int y = 0; y < mStatusImageRowHeight-1; y++)
00178                     {
00179                        int yAbs = yOffset + y;
00180                        Array::Pattern::PtrWrite(mStatusImage->CPB(xAbs, yAbs),
00181                                                 *color);
00182                     }
00183                 }
00184             }
00185         }
00186 
00187         CString imageFileName = "status.png";
00188         {
00189             Util::IOBufferFile buffer(imageFileName, false, false);
00190             Core::Array::WritePng(mStatusImage, &buffer);
00191         }
00192 
00193 
00194         // Write data to xml
00195 
00196         std::ofstream output("vpdata.xml");
00197         if (!output.is_open())
00198         {
00199             ILOG_ERROR("unable to write report");
00200             return;
00201         }
00202 
00203         output << "<?xml version=\"1.0\" encoding=\"utf-8\"?>" << std::endl;
00204         output << "<?xml-stylesheet type=\"text/xsl\" href=\"videojobmanager.xslt\"?>" << std::endl;
00205 
00206         output << "<vpdata>" << std::endl << std::endl;
00207 
00208         output << "<infos>" << std::endl;
00209         output << "  <info label=\"video set file" << "\" text=\""
00210                << mData.mVideoSetName << "\"/>" << std::endl;
00211         output << "  <info label=\"number of videos" << "\" text=\""
00212                << mData.mVideoSetSize << "\"/>" << std::endl;
00213         output << "  <info label=\"process definition file" << "\" text=\""
00214                << mData.mProcessDefFile << "\"/>" << std::endl;
00215         output << "  <info label=\"number of process steps" << "\" text=\""
00216                << mData.mProcessDef->StepCount() << "\"/>" << std::endl;
00217         output << "  <info label=\"job server address" << "\" text=\""
00218                << mData.mServerName << ':' << mData.mPort << "\"/>" << std::endl;
00219         //output << "  <info label=\"" << ".." << "\" text=\"" << ".."
00220         // << "\"/>" << std::endl;
00221         output << "</infos>" << std::endl << std::endl;
00222 
00223         output << "<jobs>" << std::endl;
00224         for (int j = 0; j < mData.mAllJobs.size(); j++)
00225         {
00226             VideoJob* job = mData.mAllJobs[j];
00227             output << "  <job id=\"" << job->id << "\" video=\""
00228                    << job->videoNr << "\" step=\"" << job->stepNr
00229                    << "\" state=\"" << job->state << "\" exit=\""
00230                    << job->exitCode << "\"/>" << std::endl;
00231         }
00232         output << "</jobs>" << std::endl << std::endl;
00233 
00234         output << "</vpdata>" << std::endl;
00235 
00236         output.close();
00237     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:27:58 2010 for ImpalaSrc by  doxygen 1.5.1