14 #include <boost/property_tree/json_parser.hpp>
15 #include <boost/property_tree/ptree.hpp>
16 #include <boost/format.hpp>
35 namespace bpt = boost::property_tree;
41 hostnameReturn = gethostname(host,
sizeof(host));
42 if (hostnameReturn == -1)
43 throw cms::Exception(
"fillJson") <<
"Internal error, cannot get host name";
46 std::ostringstream oss_pid;
53 struct stat dataFileStat;
54 dataFileStat.st_size = 0;
56 if (
stat(dataFilePathName.c_str(), &dataFileStat) != 0)
57 throw cms::Exception(
"fillJson") <<
"Internal error, cannot get data file: " << dataFilePathName;
63 bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize,
inputFiles, fileAdler32,
64 transferDestination, mergeType, hltErrorEvents;
66 processedEvents.put(
"", nProcessed);
67 acceptedEvents.put(
"", nProcessed);
69 errorEvents.put(
"", 0);
71 fileList.put(
"", dataFileName);
72 fileSize.put(
"", dataFileStat.st_size);
73 inputFiles.put(
"",
"");
74 fileAdler32.put(
"", -1);
75 transferDestination.put(
"", transferDestinationStr);
76 mergeType.put(
"", mergeTypeStr);
77 hltErrorEvents.put(
"", 0);
79 data.push_back(std::make_pair(
"", processedEvents));
80 data.push_back(std::make_pair(
"", acceptedEvents));
81 data.push_back(std::make_pair(
"", errorEvents));
82 data.push_back(std::make_pair(
"", bitmask));
83 data.push_back(std::make_pair(
"", fileList));
84 data.push_back(std::make_pair(
"", fileSize));
85 data.push_back(std::make_pair(
"", inputFiles));
86 data.push_back(std::make_pair(
"", fileAdler32));
87 data.push_back(std::make_pair(
"", transferDestination));
88 data.push_back(std::make_pair(
"", mergeType));
89 data.push_back(std::make_pair(
"", hltErrorEvents));
91 pt.add_child(
"data", data);
94 pt.put(
"definition",
"/fakeDefinition.jsn");
100 pt.put(
"definition", outJsonDefName.string());
104 sprintf(sourceInfo,
"%s_%d", host, pid);
105 pt.put(
"source", sourceInfo);
char data[epos_bytes_allocation]
unsigned int getEventsProcessedForLumi(unsigned int lumi, bool *abortFlag=nullptr)
boost::property_tree::ptree fillJson(int run, int lumi, const std::string &dataFilePathName, const std::string &transferDestinationStr, const std::string &mergeTypeStr, evf::FastMonitoringService *fms)