-
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 #28597 from makortel/enforceGUIDInFileName_9_4_x
Add enforceGUIDInFileName option to PoolSource and EmbeddedRootSource (9_4_X)
- Loading branch information
Showing
19 changed files
with
199 additions
and
24 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,17 @@ | ||
#ifndef FWCore_Utilities_stemFromPath_h | ||
#define FWCore_Utilities_stemFromPath_h | ||
|
||
#include <string> | ||
|
||
namespace edm { | ||
// This functions extracts the stem of a file from the path (= file | ||
// name without the extension). | ||
// | ||
// 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 stemFromPath(const std::string& 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 stemFromPath(const std::string& path) { | ||
auto begin = path.rfind("/"); | ||
if (begin == std::string::npos) { | ||
begin = path.rfind(":"); | ||
if (begin == std::string::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,16 @@ | ||
#include "FWCore/Utilities/interface/stemFromPath.h" | ||
|
||
#include <cassert> | ||
|
||
int main() { | ||
assert(edm::stemFromPath("foo.root") == "foo"); | ||
assert(edm::stemFromPath("/foo.root") == "foo"); | ||
assert(edm::stemFromPath("/bar/foo.root") == "foo"); | ||
assert(edm::stemFromPath("/bar///....//...///foo.root") == "foo"); | ||
assert(edm::stemFromPath("/bar/foo.xyzzy") == "foo"); | ||
assert(edm::stemFromPath("/bar/xyzzy.foo.root") == "xyzzy"); | ||
assert(edm::stemFromPath("file:foo.root") == "foo"); | ||
assert(edm::stemFromPath("file:/path/to/bar.txt") == "bar"); | ||
assert(edm::stemFromPath("root://server.somewhere:port/whatever?param=path/to/bar.txt") == "bar"); | ||
return 0; | ||
} |
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,31 @@ | ||
# 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 = cms.untracked.PSet( | ||
input = cms.untracked.int32(-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.