CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
StormStorageMaker Class Reference
Inheritance diagram for StormStorageMaker:
StorageMaker

Public Member Functions

virtual bool check (const std::string &, const std::string &path, const AuxSettings &, IOOffset *size=0) const override
 
virtual 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

virtual 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 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  }
std::string getTURL(const std::string &surl) const
tuple size
Write out results.
std::string StormStorageMaker::getTURL ( const std::string &  surl) const
inlineprivate

Definition at line 15 of file StormStorageMaker.cc.

References OfflineClient_cff::client, Exception, LogDebug, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, pipe::pipe(), dqm_diff::start, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by check(), and open().

16  {
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)
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
def pipe
Definition: pipe.py:5
virtual 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, mergeVDriftHistosByStation::file, StorageFactory::get(), getTURL(), alignBH_cfg::mode, eostools::move(), IOFlags::OpenUnbuffered, fed_dqm_sourceclient-live_cfg::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)
68  mode &= ~IOFlags::OpenUnbuffered;
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
static const StorageFactory * get(void)
def move
Definition: eostools.py:510
double f[11][100]
ReadHint readHint(void) const