-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28561 from makortel/enforceGUIDInFileName
Add enforceGUIDInFileName option to PoolSource and EmbeddedRootSource
- Loading branch information
Showing
20 changed files
with
207 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env python | ||
|
||
from __future__ import print_function | ||
import xml.etree.ElementTree as ET | ||
import argparse | ||
|
||
def printGUID(root): | ||
for f in root.findall("File"): | ||
print(f.find("GUID").text) | ||
|
||
def printExitCode(root): | ||
error = root.find("FrameworkError") | ||
if error is None: | ||
print("0") | ||
return | ||
print(error.get("ExitStatus")) | ||
|
||
def main(opts): | ||
tree = ET.parse(opts.file) | ||
root = tree.getroot() | ||
if opts.guid: | ||
printGUID(root) | ||
if opts.exitCode: | ||
printExitCode(root) | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Extract some values from the Framework Job Report") | ||
parser.add_argument("file", type=str, | ||
help="Framework Job Report XML file") | ||
parser.add_argument("--guid", action="store_true", | ||
help="GUID of the output file") | ||
parser.add_argument("--exitCode", action="store_true", | ||
help="Job exit code") | ||
|
||
opts = parser.parse_args() | ||
main(opts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef FWCore_Utilities_stemFromPath_h | ||
#define FWCore_Utilities_stemFromPath_h | ||
|
||
#include <string_view> | ||
|
||
namespace edm { | ||
// This functions extracts the stem of a file from the path (= file | ||
// name without the extension). The returned value is a string_view | ||
// to the input string. Caller should ensure that the input string | ||
// object lives long enough. | ||
// | ||
// The reason to have our own function instead of | ||
// std/boost::filesystem is that tehcnically these paths are not | ||
// filesystem paths, but paths in CMS LFN/PFN space that (may) have | ||
// different rules. | ||
std::string_view stemFromPath(std::string_view path); | ||
} // namespace edm | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "FWCore/Utilities/interface/stemFromPath.h" | ||
|
||
namespace edm { | ||
std::string_view stemFromPath(std::string_view path) { | ||
auto begin = path.rfind("/"); | ||
if (begin == std::string_view::npos) { | ||
begin = path.rfind(":"); | ||
if (begin == std::string_view::npos) { | ||
// shouldn't really happen? | ||
begin = 0; | ||
} else { | ||
begin += 1; | ||
} | ||
} else { | ||
begin += 1; | ||
} | ||
auto end = path.find(".", begin); | ||
return path.substr(begin, end - begin); | ||
} | ||
} // namespace edm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define CATCH_CONFIG_MAIN | ||
#include "catch.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "FWCore/Utilities/interface/stemFromPath.h" | ||
|
||
#include "catch.hpp" | ||
|
||
TEST_CASE("Test stemFromPath", "[sources]") { | ||
CHECK(edm::stemFromPath("foo.root") == "foo"); | ||
CHECK(edm::stemFromPath("/foo.root") == "foo"); | ||
CHECK(edm::stemFromPath("/bar/foo.root") == "foo"); | ||
CHECK(edm::stemFromPath("/bar///....//...///foo.root") == "foo"); | ||
CHECK(edm::stemFromPath("/bar/foo.xyzzy") == "foo"); | ||
CHECK(edm::stemFromPath("/bar/xyzzy.foo.root") == "xyzzy"); | ||
CHECK(edm::stemFromPath("file:foo.root") == "foo"); | ||
CHECK(edm::stemFromPath("file:/path/to/bar.txt") == "bar"); | ||
CHECK(edm::stemFromPath("root://server.somewhere:port/whatever?param=path/to/bar.txt") == "bar"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Configuration file for PoolInputTest | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
import sys | ||
|
||
argv = [] | ||
foundpy = False | ||
for a in sys.argv: | ||
if foundpy: | ||
argv.append(a) | ||
if ".py" in a: | ||
foundpy = True | ||
|
||
process = cms.Process("TESTRECO") | ||
process.load("FWCore.Framework.test.cmsExceptionsFatal_cff") | ||
|
||
process.maxEvents.input = -1 | ||
process.OtherThing = cms.EDProducer("OtherThingProducer") | ||
process.Analysis = cms.EDAnalyzer("OtherThingAnalyzer") | ||
|
||
process.source = cms.Source("PoolSource", | ||
setRunNumber = cms.untracked.uint32(621), | ||
fileNames = cms.untracked.vstring(argv[0]), | ||
enforceGUIDInFileName = cms.untracked.bool(True) | ||
) | ||
|
||
process.p = cms.Path(process.OtherThing*process.Analysis) | ||
|
||
|
Oops, something went wrong.