test
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
StormLcgGtStorageMaker Class Reference
Inheritance diagram for StormLcgGtStorageMaker:
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 StormLCGStorageMaker.cc.

Member Function Documentation

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

Reimplemented from StorageMaker.

Definition at line 78 of file StormLCGStorageMaker.cc.

References getTURL(), and findQualityFiles::size.

82  {
83  struct stat st;
84  if (stat (getTURL(path).c_str(), &st) != 0)
85  return false;
86 
87  if (size)
88  *size = st.st_size;
89 
90  return true;
91  }
tuple size
Write out results.
std::string getTURL(const std::string &surl) const
std::string StormLcgGtStorageMaker::getTURL ( const std::string &  surl) const
inlineprivate

Definition at line 15 of file StormLCGStorageMaker.cc.

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

Referenced by check(), and open().

16  {
17  // PrepareToGet timeout
18  std::string timeout("300");
19  if(char *p = getenv("CMS_STORM_LCG_GT_TIMEOUT"))
20  timeout = p;
21 
22  /* Build the command line:
23  -b => no BDII contacted
24  -T srmv2 => necessary with -b
25  -t timeout */
26  std::string comm("lcg-gt -b -T srmv2 -t " + timeout + " srm:" + surl + " file 2>&1");
27  LogDebug("StormLCGStorageMaker") << "command: " << comm << std::endl;
28 
29  FILE *pipe = popen(comm.c_str(), "r");
30  if(! pipe)
31  throw cms::Exception("StormLCGStorageMaker")
32  << "failed to execute lcg-gt command: "
33  << comm;
34 
35  // Get output
36  int ch;
38  while ((ch = getc(pipe)) != EOF)
39  output.push_back(ch);
40  pclose(pipe);
41 
42  LogDebug("StormLCGStorageMaker") << "output: " << output << std::endl;
43 
44  // Extract TURL if possible.
45  size_t start = output.find("file:", 0);
46  if (start == std::string::npos)
47  throw cms::Exception("StormLCGStorageMaker")
48  << "no turl found in command '" << comm << "' output:\n" << output;
49 
50  start += 5;
51  std::string turl(output, start, output.find_first_of("\n", start) - start);
52  LogDebug("StormLCGStorageMaker") << "file to open: " << turl << std::endl;
53  return turl;
54  }
#define LogDebug(id)
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
def pipe
Definition: pipe.py:5
int timeout
Definition: mps_check.py:51
virtual std::unique_ptr<Storage> StormLcgGtStorageMaker::open ( const std::string &  proto,
const std::string &  surl,
int  mode,
const AuxSettings  
) const
inlineoverridevirtual

Implements StorageMaker.

Definition at line 58 of file StormLCGStorageMaker.cc.

References StorageFactory::CACHE_HINT_STORAGE, StorageFactory::cacheHint(), f, mergeVDriftHistosByStation::file, StorageFactory::get(), getTURL(), universalConfigTemplate::mode, eostools::move(), IOFlags::OpenUnbuffered, fed_dqm_sourceclient-live_cfg::path, StorageFactory::READ_HINT_UNBUFFERED, StorageFactory::readHint(), AlCaHLTBitMon_QueryRunRegistry::string, and StorageFactory::wrapNonLocalFile().

62  {
64  StorageFactory::ReadHint readHint = f->readHint();
65  StorageFactory::CacheHint cacheHint = f->cacheHint();
66 
68  || cacheHint == StorageFactory::CACHE_HINT_STORAGE)
69  mode &= ~IOFlags::OpenUnbuffered;
70  else
72 
73  std::string path = getTURL(surl);
74  auto file = std::make_unique<File> (path, mode);
75  return f->wrapNonLocalFile (std::move(file), proto, path, mode);
76  }
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
static const StorageFactory * get(void)
def move
Definition: eostools.py:510
double f[11][100]
ReadHint readHint(void) const
std::string getTURL(const std::string &surl) const