Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

// -*- C++ -*-
//
// Package:     Services
// Class  :     JobReport
//
//
// Original Author:  Marc Paterno
//

#include "FWCore/Services/src/JobReportService.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

namespace edm {
  namespace service {

    JobReportService::~JobReportService() {}

    JobReportService::JobReportService(ParameterSet const&, ActivityRegistry& reg) : JobReport() {
      reg.watchPostEndJob(this, &JobReportService::postEndJob);
      reg.watchJobFailure(this, &JobReportService::frameworkShutdownOnFailure);

      // We don't handle PreProcessEvent, because we have to know *which
      // input file* was the event read from. Only the InputSource that
      // did the reading knows this.
    }

    void JobReportService::postEndJob() {
      // This will be called at end-of-job (obviously).
      // Dump information to the MessageLogger's JobSummary.

      // ... not yet implemented ...

      // Maybe we should have a member function called from both
      // postEndJob() and frameworkShutdownOnFailure(), so that common
      // elements are reported through common code.

      //
      // Any files that are still open should be flushed to the report
      //
      impl()->flushFiles();
    }

    void JobReportService::frameworkShutdownOnFailure() {
      // Dump information to the MessageLogger's JobSummary
      // about the files that aren't already closed,
      // and whatever summary information is wanted.

      // Maybe we should have a member function called from both
      // postEndJob() and frameworkShutdownOnFailure(), so that common
      // elements are reported through common code.
      impl()->flushFiles();
    }

    void JobReportService::fillDescriptions(ConfigurationDescriptions& descriptions) {
      ParameterSetDescription desc;
      desc.setComment("Enables job reports.");
      descriptions.addDefault(desc);
    }
  }  // namespace service
}  // namespace edm