Public Member Functions | Private Member Functions | Private Attributes | List of all members
ifdh_ns::IFCatalogInterface Class Reference

#include <IFCatalogInterface_service.h>

Inheritance diagram for ifdh_ns::IFCatalogInterface:
art::CatalogInterface

Public Member Functions

 IFCatalogInterface (const fhicl::ParameterSet &, art::ActivityRegistry &)
 
 ~IFCatalogInterface ()
 
- Public Member Functions inherited from art::CatalogInterface
virtual ~CatalogInterface () noexcept=default
 
void configure (std::vector< std::string > const &items)
 
int getNextFileURI (std::string &uri, double &waitTime)
 
void updateStatus (std::string const &uri, FileDisposition status)
 
void outputFileClosed (std::string const &module_label, std::string const &fileFQname)
 
void outputFileOpened (std::string const &module_label)
 
void outputModuleInitiated (std::string const &module_label, fhicl::ParameterSet const &pset)
 
void eventSelected (std::string const &module_label, EventID const &event_id, HLTGlobalStatus const &acceptance_info)
 
bool isSearchable ()
 
void rewind ()
 

Private Member Functions

virtual void doConfigure (std::vector< std::string > const &item)
 
virtual int doGetNextFileURI (std::string &uri, double &waitTime)
 
virtual void doUpdateStatus (std::string const &uri, art::FileDisposition status)
 
virtual void doOutputFileOpened (std::string const &module_label)
 
virtual void doOutputModuleInitiated (std::string const &module_label, fhicl::ParameterSet const &pset)
 
virtual void doOutputFileClosed (std::string const &module_label, std::string const &fileFQname)
 
virtual void doEventSelected (std::string const &module_label, art::EventID const &event_id, art::HLTGlobalStatus const &acceptance_info)
 
virtual bool doIsSearchable ()
 
virtual void doRewind ()
 

Private Attributes

art::ServiceHandle< IFDH_ifdh_handle
 
std::string _process_id
 
std::string _proj_uri
 
std::string _project_name
 
std::string _sam_station
 
std::string _last_file_uri
 
std::vector< std::string_output_files
 
std::vector< bool_output_ignore
 

Detailed Description

Definition at line 15 of file IFCatalogInterface_service.h.

Constructor & Destructor Documentation

ifdh_ns::IFCatalogInterface::IFCatalogInterface ( const fhicl::ParameterSet cfg,
art::ActivityRegistry  
)

Definition at line 13 of file IFCatalogInterface_service.cc.

13  :
14  _process_id(""),
15  _proj_uri(""),
16  _project_name(""),
17  _sam_station(""),
18  _last_file_uri("")
19 {
20  std::vector<std::string> cfgkeys = cfg.get_names();
21  std::string s;
22 
23  mf::LogVerbatim("test") << "IFCatalogInterface constructor, got keys:";
24  for (std::vector<std::string>::iterator p = cfgkeys.begin(); p != cfgkeys.end(
25  ); p++ ) {
26  mf::LogVerbatim("test")<< *p << ", ";
27  }
28 
29  if ( cfg.get_if_present("webURI", s) ) {
30  mf::LogVerbatim("test") << "IFCatalogInterface: setting _proj_uri to:" << s << "\n";
31  _proj_uri = s;
32  }
33 }
intermediate_table::iterator iterator
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223
std::optional< T > get_if_present(std::string const &key) const
Definition: ParameterSet.h:224
std::vector< std::string > get_names() const
static QCString * s
Definition: config.cpp:1042
ifdh_ns::IFCatalogInterface::~IFCatalogInterface ( )

Definition at line 35 of file IFCatalogInterface_service.cc.

35  {
36  std::string process_status("completed");
37  mf::LogVerbatim("test") << "IFCatalogInterface destructor:";
38  if( _last_file_uri.length() ) {
39  mf::LogVerbatim("test") << "IFCatalogInterface: updating file status in destructor";
41  process_status = "bad";
42  }
43  if( _proj_uri.length() && _process_id.length() ) {
44  _ifdh_handle->setStatus(_proj_uri, _process_id, process_status);
45  }
46 }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::string string
Definition: nybbler.cc:12
virtual void doUpdateStatus(std::string const &uri, art::FileDisposition status)
art::ServiceHandle< IFDH > _ifdh_handle

Member Function Documentation

void ifdh_ns::IFCatalogInterface::doConfigure ( std::vector< std::string > const &  item)
privatevirtual

Implements art::CatalogInterface.

Definition at line 49 of file IFCatalogInterface_service.cc.

49  {
50  if (item.size() ) {
51  _process_id = item[0];
52  mf::LogVerbatim("test") << "IFCatalogInterface doConfigure, got id:" << item[0];
53  }
54 }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void ifdh_ns::IFCatalogInterface::doEventSelected ( std::string const &  module_label,
art::EventID const &  event_id,
art::HLTGlobalStatus const &  acceptance_info 
)
privatevirtual

Implements art::CatalogInterface.

Definition at line 136 of file IFCatalogInterface_service.cc.

138  {
139  ;
140 }
int ifdh_ns::IFCatalogInterface::doGetNextFileURI ( std::string uri,
double &  waitTime 
)
privatevirtual

Implements art::CatalogInterface.

Definition at line 58 of file IFCatalogInterface_service.cc.

58  {
59  mf::LogVerbatim("test") << "IFCatalogInterface entering doGetNextFile\n";
60  if ( _last_file_uri.length() ) {
61  mf::LogVerbatim("test") << "Updating status in doGetNextFile\n";
62  // XXX should this be art::FileDisposition::SKIPPED ???
63  // shouldn't we have updated the status already?
65  }
66  if ( _proj_uri.length()) {
67  uri = _ifdh_handle->getNextFile(_proj_uri,_process_id);
68  _last_file_uri = uri;
69  if (uri.length()) {
70  mf::LogVerbatim("test") << "doGetNextFile success\n";
72  } else {
73  mf::LogVerbatim("test") << "doGetNextFile no_more_files\n";
75  }
76  }
78 }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
virtual void doUpdateStatus(std::string const &uri, art::FileDisposition status)
art::ServiceHandle< IFDH > _ifdh_handle
bool ifdh_ns::IFCatalogInterface::doIsSearchable ( )
privatevirtual

Implements art::CatalogInterface.

Definition at line 143 of file IFCatalogInterface_service.cc.

143  {
144  return 0;
145 }
void ifdh_ns::IFCatalogInterface::doOutputFileClosed ( std::string const &  module_label,
std::string const &  fileFQname 
)
privatevirtual

Implements art::CatalogInterface.

Definition at line 129 of file IFCatalogInterface_service.cc.

130  {
131  mf::LogVerbatim("test") << "IFCatalogInteface doOutputFileClosed: " << module_label << ", " << fileFQname << "\n";
132  return;
133 }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void ifdh_ns::IFCatalogInterface::doOutputFileOpened ( std::string const &  module_label)
privatevirtual

Implements art::CatalogInterface.

Definition at line 102 of file IFCatalogInterface_service.cc.

102  {
103  return;
104 }
void ifdh_ns::IFCatalogInterface::doOutputModuleInitiated ( std::string const &  module_label,
fhicl::ParameterSet const &  pset 
)
privatevirtual

Implements art::CatalogInterface.

Definition at line 107 of file IFCatalogInterface_service.cc.

108  {
109  std::string s;
110  bool ignore = false;
111  std::vector<std::string> cfgkeys = pset.get_names();
112  mf::LogVerbatim("test") << "IFCatalogInterface doOutputModuleInitiated, got keys:";
113  for (std::vector<std::string>::iterator p = cfgkeys.begin(); p != cfgkeys.end(
114  ); p++ ) {
115  mf::LogVerbatim("test")<< *p << ", ";
116  }
117 
118  if ( pset.get_if_present("fileName", s) ) {
119  _output_files.push_back(s);
120  }
121  if ( pset.get_if_present("sam_ignore", ignore) ) {
122  ;
123  }
124  _output_ignore.push_back(ignore);
125 }
intermediate_table::iterator iterator
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223
static QCString * s
Definition: config.cpp:1042
std::vector< std::string > _output_files
void ifdh_ns::IFCatalogInterface::doRewind ( )
privatevirtual

Implements art::CatalogInterface.

Definition at line 148 of file IFCatalogInterface_service.cc.

148  {
149  // throw NotImplemented;
150  ;
151 }
void ifdh_ns::IFCatalogInterface::doUpdateStatus ( std::string const &  uri,
art::FileDisposition  status 
)
privatevirtual

Implements art::CatalogInterface.

Definition at line 81 of file IFCatalogInterface_service.cc.

81  {
82  static const char *statusmap[] = {
83  "transferred",
84  "consumed",
85  "skipped",
86  "consumed", /* INCOMPLETE */
87  };
88 
89  mf::LogVerbatim("test") << "IFCatalogInterface doUpdateStatus " << uri << " status: " << int(status) << "\n";
90 
91  if( _proj_uri.length()) {
92  _ifdh_handle->updateFileStatus(_proj_uri,_process_id,uri,statusmap[int(status)]);
94  int res = unlink(_ifdh_handle->localPath(_last_file_uri).c_str());
95  mf::LogVerbatim("test") << "unlink of file returns:" << res << "\n";
96  _last_file_uri = "";
97  }
98  }
99 }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
art::ServiceHandle< IFDH > _ifdh_handle

Member Data Documentation

art::ServiceHandle<IFDH> ifdh_ns::IFCatalogInterface::_ifdh_handle
private

Definition at line 22 of file IFCatalogInterface_service.h.

std::string ifdh_ns::IFCatalogInterface::_last_file_uri
private

Definition at line 27 of file IFCatalogInterface_service.h.

std::vector<std::string> ifdh_ns::IFCatalogInterface::_output_files
private

Definition at line 28 of file IFCatalogInterface_service.h.

std::vector<bool> ifdh_ns::IFCatalogInterface::_output_ignore
private

Definition at line 29 of file IFCatalogInterface_service.h.

std::string ifdh_ns::IFCatalogInterface::_process_id
private

Definition at line 23 of file IFCatalogInterface_service.h.

std::string ifdh_ns::IFCatalogInterface::_proj_uri
private

Definition at line 24 of file IFCatalogInterface_service.h.

std::string ifdh_ns::IFCatalogInterface::_project_name
private

Definition at line 25 of file IFCatalogInterface_service.h.

std::string ifdh_ns::IFCatalogInterface::_sam_station
private

Definition at line 26 of file IFCatalogInterface_service.h.


The documentation for this class was generated from the following files: