Skip to content

Add Process name, reduced configuration ID, and ParameterSet ID to the JobReport #47548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions FWCore/Framework/src/EventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,15 @@ namespace edm {
processConfiguration_ = items.processConfiguration();
processContext_.setProcessConfiguration(processConfiguration_.get());

{
edm::Service<edm::JobReport> jr;
if (jr.isAvailable()) {
ProcessConfiguration reduced = *processConfiguration_;
reduced.reduce();
jr->reportProcess(reduced.processName(), reduced.id(), reduced.parameterSetID());
}
}

FDEBUG(2) << parameterSet << std::endl;

principalCache_.setNumberOfConcurrentPrincipals(preallocations_);
Expand Down
11 changes: 10 additions & 1 deletion FWCore/MessageLogger/interface/JobReport.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Changes Log 1: 2009/01/14 10:29:00, Natalia Garcia Nebot
*/

#include "DataFormats/Provenance/interface/RunLumiEventNumber.h"
#include "DataFormats/Provenance/interface/ParameterSetID.h"
#include "DataFormats/Provenance/interface/ProcessConfigurationID.h"
#include "FWCore/Utilities/interface/InputType.h"
#include "FWCore/Utilities/interface/get_underlying_safe.h"

Expand Down Expand Up @@ -177,8 +179,10 @@ namespace edm {
};

struct JobReportImpl {
JobReportImpl& operator=(JobReportImpl const&) = delete;
JobReportImpl(JobReportImpl const&) = delete;
JobReportImpl& operator=(JobReportImpl const&) = delete;
JobReportImpl(JobReportImpl&&) = delete;
JobReportImpl& operator=(JobReportImpl&&) = delete;

InputFile& getInputFileForToken(InputType inputType, Token t);
OutputFile& getOutputFileForToken(Token t);
Expand Down Expand Up @@ -269,6 +273,11 @@ namespace edm {

~JobReport();

// Insert information about the process
void reportProcess(std::string_view processName,
ProcessConfigurationID const& reducedProcessID,
ParameterSetID const& psetID);

/// Report that an input file has been opened.
/// The returned Token should be used for later identification
/// of this file.
Expand Down
13 changes: 13 additions & 0 deletions FWCore/MessageLogger/src/JobReport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,19 @@ namespace edm {
temporarilyCloseXML();
}

void JobReport::reportProcess(std::string_view processName,
ProcessConfigurationID const& reducedProcessID,
ParameterSetID const& psetID) {
if (impl_->ost_) {
*(impl_->ost_) << "\n<Process>\n";
*(impl_->ost_) << " <Name>" << processName << "</Name>\n";
*(impl_->ost_) << " <ReducedConfigurationID>" << reducedProcessID << "</ReducedConfigurationID>\n";
*(impl_->ost_) << " <ParameterSetID>" << psetID << "</ParameterSetID>\n";
*(impl_->ost_) << "</Process>\n";
}
temporarilyCloseXML();
}

JobReport::Token JobReport::inputFileOpened(std::string const& physicalFileName,
std::string const& logicalFileName,
std::string const& catalog,
Expand Down
8 changes: 8 additions & 0 deletions FWCore/MessageService/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@
<use name="FWCore/Framework"/>
</library>

<library file="PrintProcessInformation.cc" name="MLPrintProcessInformation">
<flags EDM_PLUGIN="1"/>
<use name="DataFormats/Provenance"/>
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ServiceRegistry"/>
</library>
</environment>
<bin file="standAloneTest.cpp" name="standAloneWithMessageLogger">
<use name="FWCore/MessageLogger"/>
Expand Down Expand Up @@ -234,6 +241,7 @@

<test name="unitTestsGroup_6" command="${value}.sh" foreach="u23,u27,u30,u31,u33"/>

<test name="TestFWCoreMessageServiceJobReport" command="testJobReport.sh"/>
<bin name="makeJobReport" file="makeJobReport.cpp">
<use name="boost_program_options"/>
<use name="FWCore/Framework"/>
Expand Down
29 changes: 29 additions & 0 deletions FWCore/MessageService/test/PrintProcessInformation.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "DataFormats/Provenance/interface/ProcessConfiguration.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h"
#include "FWCore/ServiceRegistry/interface/ProcessContext.h"
#include "FWCore/ServiceRegistry/interface/StreamContext.h"

namespace edmtest {
class PrintProcessInformation : public edm::global::EDAnalyzer<> {
public:
explicit PrintProcessInformation(edm::ParameterSet const&) {}

void analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const&) const final {
auto const* processConfiguration =
e.moduleCallingContext()->getStreamContext()->processContext()->processConfiguration();
assert(processConfiguration);
auto reduced = *processConfiguration;
reduced.reduce();
edm::LogSystem("PrintProcessInformation")
<< "Name:" << processConfiguration->processName() << "\nReducedConfigurationID:" << reduced.id()
<< "\nParameterSetID:" << processConfiguration->parameterSetID();
}
};
} // namespace edmtest

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(edmtest::PrintProcessInformation);
34 changes: 34 additions & 0 deletions FWCore/MessageService/test/compareJobReportToOutput.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3

import xml.etree.ElementTree as ET

quantities = ["Name", "ReducedConfigurationID", "ParameterSetID"]

def parsexml(fname):
root = ET.parse(fname)
process = root.find("Process")
return {q: process.find(q).text for q in quantities}

def parselog(fname):
ret = {}
with open(fname) as f:
for line in f:
s = line.rstrip().split(":")
if len(s) == 2:
ret[s[0]] = s[1]
return ret

def main(jobreport, log):
xmldata = parsexml(jobreport)
logdata = parselog(log)

ret = 0
for q in quantities:
if xmldata[q] != logdata[q]:
print(f"Quantity {q}: job report '{xmldata[q]}' != log '{logdata[q]}'")
ret = 1
return ret

if __name__ == "__main__":
import sys
sys.exit(main(sys.argv[1], sys.argv[2]))
2 changes: 2 additions & 0 deletions FWCore/MessageService/test/filter-timestamps.sed
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
s/ [0-9]?[0-9]-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-2[0-9][0-9][0-9] [0-9]?[0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])? [A-Z]?[A-Z][A-Z][A-Z]( |\t|-|$)/ {Timestamp} /
s|<ReducedConfigurationID>.*?</ReducedConfigurationID>|<ReducedConfigurationID>{Value}</ReducedConfigurationID>|
s|<ParameterSetID>.*?</ParameterSetID>|<ParameterSetID>{Value}</ParameterSetID>|
7 changes: 7 additions & 0 deletions FWCore/MessageService/test/jobreport_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")
process.maxEvents.input = 1
process.source = cms.Source("EmptySource")
process.a = cms.EDAnalyzer("edmtest::PrintProcessInformation")
process.p = cms.Path(process.a)
8 changes: 8 additions & 0 deletions FWCore/MessageService/test/testJobReport.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

function die { echo $1: status $2 ; exit $2; }

cmsRun -j fwjr.xml ${SCRAM_TEST_PATH}/jobreport_cfg.py > log.txt 2>&1 || die "cmsRun jobreport_cfg.py failed" $?
${SCRAM_TEST_PATH}/compareJobReportToOutput.py fwjr.xml log.txt || die "Job report comparison to log failed" $?


1 change: 1 addition & 0 deletions FWCore/MessageService/test/u1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ status=0
rm -f u1_errors.log u1_warnings.log u1_infos.log u1_debugs.log u1_default.log u1_job_report.mxml

cmsRun -j u1_job_report.mxml ${SCRAM_TEST_PATH}/u1_cfg.py || exit $?
edmFjrDump u1_job_report.mxml

for file in u1_errors.log u1_warnings.log u1_infos.log u1_debugs.log u1_default.log u1_job_report.mxml
do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<!-- -->
</FrameworkJobReport>
6 changes: 6 additions & 0 deletions FWCore/MessageService/test/unit_test_outputs/job_report.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<!-- -->
</FrameworkJobReport>
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<!-- -->
</FrameworkJobReport>
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<!-- -->
</FrameworkJobReport>
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<!-- -->
</FrameworkJobReport>
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<!-- -->
</FrameworkJobReport>
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<!-- -->
</FrameworkJobReport>
6 changes: 6 additions & 0 deletions FWCore/MessageService/test/unit_test_outputs/u27FJR.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<MessageSummary>
<Category_f_FwkReport Value="1" />
<Category_i_cat_A Value="6" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TEST</Name>
<ReducedConfigurationID>{Value}</ReducedConfigurationID>
<ParameterSetID>{Value}</ParameterSetID>
</Process>
<!-- -->
</FrameworkJobReport>
20 changes: 10 additions & 10 deletions IOPool/Common/test/TestEdmFastMerge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,33 @@ cmsRun -j ${LOCAL_TMP_DIR}/TestFastMergeFJR_ancestor2.xml ${LOCAL_TEST_DIR}/Fast

cmsRun -j ${LOCAL_TMP_DIR}/TestFastMergeFJRx.xml ${LOCAL_TEST_DIR}/FastMergeTest_x_cfg.py || die 'Failure using FastMergeTest_x_cfg.py' $?
#need to filter items in job report which always change
egrep -v "<GUID>|<PFN>|^$" $LOCAL_TEST_DIR/proper_fjrx_output > $LOCAL_TMP_DIR/proper_fjrx_output_filtered
egrep -v "<GUID>|<PFN>|^$" $LOCAL_TMP_DIR/TestFastMergeFJRx.xml > $LOCAL_TMP_DIR/TestFastMergeFJRx_filtered.xml
egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TEST_DIR/proper_fjrx_output > $LOCAL_TMP_DIR/proper_fjrx_output_filtered
egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TMP_DIR/TestFastMergeFJRx.xml > $LOCAL_TMP_DIR/TestFastMergeFJRx_filtered.xml
diff $LOCAL_TMP_DIR/proper_fjrx_output_filtered $LOCAL_TMP_DIR/TestFastMergeFJRx_filtered.xml || die 'output framework job report is wrong for proper_fjrx_output_filtered' $?

#cmsRun -j ${LOCAL_TMP_DIR}/TestFastMergeFJRx_second.xml ${LOCAL_TEST_DIR}/FastMergeTest_x_second_cfg.py || die 'Failure using FastMergeTest_x_second_cfg.py' $?
##need to filter items in job report which always change
#egrep -v "<GUID>|<PFN>|^$" $LOCAL_TEST_DIR/proper_fjrx_second_output > $LOCAL_TMP_DIR/proper_fjrx_second_output_filtered
#egrep -v "<GUID>|<PFN>|^$" $LOCAL_TMP_DIR/TestFastMergeFJRx_second.xml > $LOCAL_TMP_DIR/TestFastMergeFJRx_second_filtered.xml
#egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TEST_DIR/proper_fjrx_second_output > $LOCAL_TMP_DIR/proper_fjrx_second_output_filtered
#egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TMP_DIR/TestFastMergeFJRx_second.xml > $LOCAL_TMP_DIR/TestFastMergeFJRx_second_filtered.xml
#diff $LOCAL_TMP_DIR/proper_fjrx_second_output_filtered $LOCAL_TMP_DIR/TestFastMergeFJRx_second_filtered.xml || die 'output framework job report is wrong for proper_fjrx_second_output_filtered' $?


cmsRun -j ${LOCAL_TMP_DIR}/TestFastMergeFJR.xml ${LOCAL_TEST_DIR}/FastMergeTest_cfg.py || die 'Failure using FastMergeTest_cfg.py' $?
#need to filter items in job report which always change
egrep -v "<GUID>|<PFN>|^$" $LOCAL_TEST_DIR/proper_fjr_output > $LOCAL_TMP_DIR/proper_fjr_output_filtered
egrep -v "<GUID>|<PFN>|^$" $LOCAL_TMP_DIR/TestFastMergeFJR.xml > $LOCAL_TMP_DIR/TestFastMergeFJR_filtered.xml
egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TEST_DIR/proper_fjr_output > $LOCAL_TMP_DIR/proper_fjr_output_filtered
egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TMP_DIR/TestFastMergeFJR.xml > $LOCAL_TMP_DIR/TestFastMergeFJR_filtered.xml
diff $LOCAL_TMP_DIR/proper_fjr_output_filtered $LOCAL_TMP_DIR/TestFastMergeFJR_filtered.xml || die 'output framework job report is wrong for proper_fjr_output_filtered' $?

cmsRun -j ${LOCAL_TMP_DIR}/TestFastMergeRLFJR.xml ${LOCAL_TEST_DIR}/FastMergeTestRL_cfg.py || die 'Failure using FastMergeTestRL_cfg.py' $?
#need to filter items in job report which always change
egrep -v "<GUID>|<PFN>|^$" $LOCAL_TEST_DIR/proper_RLfjr_output > $LOCAL_TMP_DIR/proper_RLfjr_output_filtered
egrep -v "<GUID>|<PFN>|^$" $LOCAL_TMP_DIR/TestFastMergeRLFJR.xml > $LOCAL_TMP_DIR/TestFastMergeRLFJR_filtered.xml
egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TEST_DIR/proper_RLfjr_output > $LOCAL_TMP_DIR/proper_RLfjr_output_filtered
egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TMP_DIR/TestFastMergeRLFJR.xml > $LOCAL_TMP_DIR/TestFastMergeRLFJR_filtered.xml
diff $LOCAL_TMP_DIR/proper_RLfjr_output_filtered $LOCAL_TMP_DIR/TestFastMergeRLFJR_filtered.xml || die 'output run lumi framework job report is wrong for proper_RLfjr_output_filtered' $?

cmsRun -j ${LOCAL_TMP_DIR}/TestFastMergeRFJR.xml ${LOCAL_TEST_DIR}/FastMergeTestR_cfg.py || die 'Failure using FastMergeTestR_cfg.py' $?
#need to filter items in job report which always change
egrep -v "<GUID>|<PFN>|^$" $LOCAL_TEST_DIR/proper_Rfjr_output > $LOCAL_TMP_DIR/proper_Rfjr_output_filtered
egrep -v "<GUID>|<PFN>|^$" $LOCAL_TMP_DIR/TestFastMergeRFJR.xml > $LOCAL_TMP_DIR/TestFastMergeRFJR_filtered.xml
egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TEST_DIR/proper_Rfjr_output > $LOCAL_TMP_DIR/proper_Rfjr_output_filtered
egrep -v "<GUID>|<PFN>|<ReducedConfigurationID>|<ParameterSetID>|^$" $LOCAL_TMP_DIR/TestFastMergeRFJR.xml > $LOCAL_TMP_DIR/TestFastMergeRFJR_filtered.xml
diff $LOCAL_TMP_DIR/proper_Rfjr_output_filtered $LOCAL_TMP_DIR/TestFastMergeRFJR_filtered.xml || die 'output run framework job report is wrong for proper_Rfjr_output_filtered' $?

cmsRun ${LOCAL_TEST_DIR}/ReadFastMergeTestOutput_cfg.py || die 'Failure using ReadFastMergeTestOutput_cfg.py' $?
4 changes: 4 additions & 0 deletions IOPool/Common/test/proper_RLfjr_output
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TESTMERGE</Name>
</Process>

<InputFile>
<State Value="closed"/>
<LFN></LFN>
Expand Down
4 changes: 4 additions & 0 deletions IOPool/Common/test/proper_Rfjr_output
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TESTMERGE</Name>
</Process>

<InputFile>
<State Value="closed"/>
<LFN></LFN>
Expand Down
4 changes: 4 additions & 0 deletions IOPool/Common/test/proper_fjr_output
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TESTMERGE</Name>
</Process>

<InputFile>
<State Value="closed"/>
<LFN></LFN>
Expand Down
4 changes: 4 additions & 0 deletions IOPool/Common/test/proper_fjrx_output
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TESTMERGE</Name>
</Process>

<InputFile>
<State Value="closed"/>
<LFN></LFN>
Expand Down
4 changes: 4 additions & 0 deletions IOPool/Common/test/proper_fjrx_second_output
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<FrameworkJobReport>

<Process>
<Name>TESTMERGE</Name>
</Process>

<InputFile>
<State Value="closed"/>
<LFN></LFN>
Expand Down