Skip to content
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

allow TriggerResultsFilter to throw for invalid HLTPathStatus patterns #39044

Merged
merged 1 commit into from Aug 24, 2022

Conversation

missirol
Copy link
Contributor

@missirol missirol commented Aug 12, 2022

PR description:

This PR updates the TriggerResultsFilter plugin to spot patterns without any valid matches when HLTPathStatus collections are used (i.e. when usePathStatus=True).

Up to now throw=True had no effect if usePathStatus=True, even if triggerConditions contained patterns with no valid matches amongst the Paths in the job.

All TriggerResultsFilter instances in the central HLT menus use throw=True, and since many use usePathStatus=True, those could in principle silently return False due to invalid patterns (in practise, those patterns are often controlled by the ConfDB GUI, so should be correct).

After this PR, invalid patterns for HLTPathStatus collections will lead to an exception if throw=True.

While testing these changes, small updates were applied to the unit-tests for TriggerResultsFilter. In particular, TriggerResultsFilter modules with valid patterns now use throw=True, while those with invalid patterns are those with throw=False.

Edit : in addition, if throw=True, the plugin TriggerResultsFilter will now throw an exception if the parsing of the trigger-results expression fails (query with invalid syntax); up to now, this was leading only to a warning.

Thanks to @fwyzard for much help with the implementation; I tag him to review these changes.

PR validation:

Private tests with the relevant unit-tests.

If this PR is a backport, please specify the original PR and why you need to backport that PR. If this PR will be backported please specify to which release cycle the backport is meant for:

A backport to 12_4_X is not necessary, but might be useful. (see #39044 (comment))

CMSSW_12_4_X

for (auto const& p : m_pathStatusTokens) {
auto const& handle = event.getHandle(p.second);
if (handle.isValid()) {
m_pathStatus.push_back(handle->accept());
triggerNames.push_back(p.first);
} else {
edm::LogError("MissingHLTPathStatus")
<< "invalid handle for requested edm::HLTPathStatus with label \"" << p.first << "\"";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was good to add here an error message. I don't know if it should even be promoted to an exception.

}
});
}
}

void TriggerResultsFilter::beginStream(edm::StreamID) {
Copy link
Contributor Author

@missirol missirol Aug 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check is done in beginStream, because the lambda passed via callWhenNewProductsRegistered is executed only after the module is constructed.

Core-sw experts clarified that the callback in callWhenNewProductsRegistered is applied serially to the different branches, so .matched was implemented as a simple bool, without resorting to atomic types.

# load conditions from the global tag
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the unit-tests, the use of the GT is not strictly needed, so I thought it would be better to remove it.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39044/31534

  • This PR adds an extra 20KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @missirol (Marino Missiroli) for master.

It involves the following packages:

  • HLTrigger/HLTcore (hlt)
  • HLTrigger/HLTfilters (hlt)

@cmsbuild, @missirol, @Martin-Grunewald can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @silviodonato, @fwyzard this is something you requested to watch as well.
@perrotta, @dpiparo, @qliphy, @rappoccio you are the release manager for this.

cms-bot commands are listed here

Comment on lines 6 to 11
#process.MessageLogger.cerr.INFO = cms.untracked.PSet(
# reportEvery = cms.untracked.int32(1), # every!
# limit = cms.untracked.int32(-1) # no limit!
# )
#process.MessageLogger.cerr.FwkReport.reportEvery = 100 # only report every 100th event start
#process.MessageLogger.cerr_stats.threshold = 'INFO' # also info in statistics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these commented-out lines ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In short, convenience. I used L10 to limit printouts while testing, and I thought it might be convenient to leave these lines there similarly to what is in one of the other configs, triggerResultsFilter_by_TriggerResults.py#L13.

I can remove them if you prefer, of course.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite the opposite... if they are useful for testing, you could also uncomment them, since this is a test file.
Would there be any downsides ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, let me have a look and update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use the snippet below in the 3 configs for the unit-tests. What do you think?

With this, the event number is reported only 10 times instead of 1000, warnings/errors and the TrigReport messages are reported. The commented-out lines enable all info-level outputs for every event, and are left there for debugging.

process.options.wantSummary = True

process.load('FWCore.MessageService.MessageLogger_cfi')
process.MessageLogger.cerr.FwkReport.reportEvery = 100 # only report every 100th event start
process.MessageLogger.cerr.enableStatistics = False # enable "MessageLogger Summary" message
process.MessageLogger.cerr.threshold = 'INFO' # change to 'WARNING' not to show INFO-level messages
## enable reporting of INFO-level messages (default is limit=0, i.e. no messages reported)
#process.MessageLogger.cerr.INFO = cms.untracked.PSet(
#    reportEvery = cms.untracked.int32(1), # every event!
#    limit = cms.untracked.int32(-1)       # no limit!
#)

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-39044/31745

  • This PR adds an extra 20KB to repository

@cmsbuild
Copy link
Contributor

Pull request #39044 was updated. @cmsbuild, @missirol, @Martin-Grunewald can you please check and sign again.

@missirol
Copy link
Contributor Author

type bugfix

A small fix, but a fix nonetheless. TSG asked to eventually backport this to 12_4_X.

Comment on lines +131 to +133
if (m_eventCache.shouldThrow()) {
throw cms::Exception("Configuration") << "Couldn't parse trigger-results expression \"" << expression << "\"";
} else {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new addition: I would say TriggerResultsFilter should throw an exception (not just a warning) if throw=True and the parsing of the expression fails.

@missirol
Copy link
Contributor Author

please test

The last push

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-5b5fbc/27036/summary.html
COMMIT: e355f21
CMSSW: CMSSW_12_5_X_2022-08-23-2300/el8_amd64_gcc10
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/39044/27036/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 51
  • DQMHistoTests: Total histograms compared: 3693084
  • DQMHistoTests: Total failures: 2
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3693060
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 50 files compared)
  • Checked 212 log files, 49 edm output root files, 51 DQM output files
  • TriggerResults: no differences found

@missirol
Copy link
Contributor Author

+hlt

  • updates TriggerResultsFilter to throw an exception as expected (if throw=True) if usePathStatus=True and the specified trigger-results patterns have no matches
  • in addition, if throw=True, TriggerResultsFilter will now throw an exception if the parsing of the trigger-results expression fails (up to now, this only led to a warning)

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@perrotta
Copy link
Contributor

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants