CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
StormStorageMaker Class Reference
Inheritance diagram for StormStorageMaker:
StorageMaker

Public Member Functions

bool check (const std::string &, const std::string &path, const AuxSettings &, IOOffset *size=0) const override
 
std::unique_ptr< Storageopen (const std::string &proto, const std::string &surl, int mode, const AuxSettings &) const override
 
- Public Member Functions inherited from StorageMaker
virtual void stagein (const std::string &proto, const std::string &path, const AuxSettings &aux) const
 
 StorageMaker ()=default
 
virtual ~StorageMaker ()=default
 

Private Member Functions

std::string getTURL (const std::string &surl) const
 

Detailed Description

Definition at line 12 of file StormStorageMaker.cc.

Member Function Documentation

bool StormStorageMaker::check ( const std::string &  ,
const std::string &  path,
const AuxSettings ,
IOOffset size = 0 
) const
inlineoverridevirtual

Reimplemented from StorageMaker.

Definition at line 68 of file StormStorageMaker.cc.

References DEFINE_EDM_PLUGIN, getTURL(), findQualityFiles::size, and hgcalPlots::stat.

71  {
72  struct stat st;
73  if (stat(getTURL(path).c_str(), &st) != 0)
74  return false;
75 
76  if (size)
77  *size = st.st_size;
78 
79  return true;
80  }
size
Write out results.
std::string getTURL(const std::string &surl) const
std::string StormStorageMaker::getTURL ( const std::string &  surl) const
inlineprivate

Definition at line 14 of file StormStorageMaker.cc.

References HLTObjectMonitor_Client_cff::client, Exception, LogDebug, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, command_line::start, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by check(), and open().

14  {
16  if (char *p = std::getenv("CMS_STORM_PTG_CLIENT"))
17  client = p;
18  else
19  throw cms::Exception("StormStorageMaker") << "$CMS_STORM_PTG_CLIENT has no value";
20 
21  // Command
22  std::string comm(client + " srm:" + surl + " 2>&1");
23  LogDebug("StormStorageMaker") << "command: " << comm << std::endl;
24 
25  FILE *pipe = popen(comm.c_str(), "r");
26  if (!pipe)
27  throw cms::Exception("StormStorageMaker") << "failed to execute PtG command: " << comm;
28 
29  // Get output
30  int ch;
32  while ((ch = getc(pipe)) != EOF)
33  output.push_back(ch);
34  pclose(pipe);
35 
36  LogDebug("StormStorageMaker") << "output: " << output << std::endl;
37 
38  // Extract TURL if possible.
39  size_t start = output.find("FilePath:", 0);
40  if (start == std::string::npos)
41  throw cms::Exception("StormStorageMaker") << "no turl found in command '" << comm << "' output:\n" << output;
42 
43  start += 9;
44  std::string turl(output, start, output.find_first_of("\n", start) - start);
45  LogDebug("StormStorageMaker") << "file to open: " << turl << std::endl;
46  return turl;
47  }
#define LogDebug(id)
Definition: start.py:1
Definition: pipe.py:1
std::unique_ptr<Storage> StormStorageMaker::open ( const std::string &  proto,
const std::string &  surl,
int  mode,
const AuxSettings  
) const
inlineoverridevirtual

Implements StorageMaker.

Definition at line 50 of file StormStorageMaker.cc.

References StorageFactory::CACHE_HINT_STORAGE, StorageFactory::cacheHint(), f, FrontierConditions_GlobalTag_cff::file, StorageFactory::get(), getTURL(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, eostools::move(), IOFlags::OpenUnbuffered, castor_dqm_sourceclient_file_cfg::path, StorageFactory::READ_HINT_UNBUFFERED, StorageFactory::readHint(), AlCaHLTBitMon_QueryRunRegistry::string, and StorageFactory::wrapNonLocalFile().

53  {
55  StorageFactory::ReadHint readHint = f->readHint();
56  StorageFactory::CacheHint cacheHint = f->cacheHint();
57 
60  else
62 
63  std::string path = getTURL(surl);
64  auto file = std::make_unique<File>(path, mode);
65  return f->wrapNonLocalFile(std::move(file), proto, path, mode);
66  }
CacheHint cacheHint(void) const
std::unique_ptr< Storage > wrapNonLocalFile(std::unique_ptr< Storage > s, const std::string &proto, const std::string &path, int mode) const
std::string getTURL(const std::string &surl) const
Definition: IOFlags.h:4
static const StorageFactory * get(void)
double f[11][100]
ReadHint readHint(void) const
def move(src, dest)
Definition: eostools.py:511