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 77 of file StormStorageMaker.cc.

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

81  {
82  struct stat st;
83  if (stat (getTURL(path).c_str(), &st) != 0)
84  return false;
85 
86  if (size)
87  *size = st.st_size;
88 
89  return true;
90  }
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 15 of file StormStorageMaker.cc.

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

Referenced by check(), and open().

16  {
17  std::string client;
18  if (char *p = getenv("CMS_STORM_PTG_CLIENT"))
19  client = p;
20  else
21  throw cms::Exception("StormStorageMaker")
22  << "$CMS_STORM_PTG_CLIENT has no value";
23 
24  // Command
25  std::string comm(client + " srm:" + surl + " 2>&1");
26  LogDebug("StormStorageMaker") << "command: " << comm << std::endl;
27 
28  FILE *pipe = popen(comm.c_str(), "r");
29  if(! pipe)
30  throw cms::Exception("StormStorageMaker")
31  << "failed to execute PtG command: "
32  << comm;
33 
34  // Get output
35  int ch;
37  while ((ch = getc(pipe)) != EOF)
38  output.push_back(ch);
39  pclose(pipe);
40 
41  LogDebug("StormStorageMaker") << "output: " << output << std::endl;
42 
43  // Extract TURL if possible.
44  size_t start = output.find("FilePath:", 0);
45  if (start == std::string::npos)
46  throw cms::Exception("StormStorageMaker")
47  << "no turl found in command '" << comm << "' output:\n" << output;
48 
49  start += 9;
50  std::string turl(output, start, output.find_first_of("\n", start) - start);
51  LogDebug("StormStorageMaker") << "file to open: " << turl << std::endl;
52  return turl;
53  }
#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 57 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, callgraph::path, StorageFactory::READ_HINT_UNBUFFERED, StorageFactory::readHint(), AlCaHLTBitMon_QueryRunRegistry::string, and StorageFactory::wrapNonLocalFile().

61  {
63  StorageFactory::ReadHint readHint = f->readHint();
64  StorageFactory::CacheHint cacheHint = f->cacheHint();
65 
67  || cacheHint == StorageFactory::CACHE_HINT_STORAGE)
69  else
71 
72  std::string path = getTURL(surl);
73  auto file = std::make_unique<File> (path, mode);
74  return f->wrapNonLocalFile (std::move(file), proto, path, mode);
75  }
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