14 #include <boost/property_tree/json_parser.hpp> 15 #include <boost/property_tree/ptree.hpp> 16 #include <boost/filesystem.hpp> 17 #include <boost/format.hpp> 29 boost::property_tree::ptree
32 namespace bpt = boost::property_tree;
33 namespace bfs = boost::filesystem;
39 hostnameReturn = gethostname(host ,
sizeof(host));
40 if (hostnameReturn == -1)
42 <<
"Internal error, cannot get host name";
45 std::ostringstream oss_pid;
52 struct stat dataFileStat;
53 dataFileStat.st_size=0;
55 if (
stat(dataFilePathName.c_str(), &dataFileStat) != 0)
57 <<
"Internal error, cannot get data file: " 60 dataFileName =
bfs::path(dataFilePathName).filename().string();
64 bpt::ptree processedEvents, acceptedEvents, errorEvents, bitmask, fileList, fileSize,
inputFiles, fileAdler32, 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");
99 pt.put(
"definition", outJsonDefName.string());
103 sprintf(sourceInfo,
"%s_%d", host, pid);
104 pt.put(
"source", sourceInfo);
unsigned int getEventsProcessedForLumi(unsigned int lumi, bool *abortFlag=0)
char data[epos_bytes_allocation]
boost::property_tree::ptree fillJson(int run, int lumi, const std::string &dataFilePathName, const std::string &transferDestinationStr, const std::string &mergeTypeStr, evf::FastMonitoringService *fms)