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, IOOffset *size=0) override
 
virtual Storageopen (const std::string &proto, const std::string &surl, int mode) override
 
- Public Member Functions inherited from StorageMaker
virtual void setDebugLevel (unsigned int debugLevel)
 
virtual void setTimeout (unsigned int timeout)
 
virtual void stagein (const std::string &proto, const std::string &path)
 
 StorageMaker (void)
 
virtual ~StorageMaker (void)
 

Private Member Functions

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

Detailed Description

Definition at line 12 of file StormLCGStorageMaker.cc.

Member Function Documentation

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

Reimplemented from StorageMaker.

Definition at line 77 of file StormLCGStorageMaker.cc.

References getTURL(), and findQualityFiles::size.

80  {
81  struct stat st;
82  if (stat (getTURL(path).c_str(), &st) != 0)
83  return false;
84 
85  if (size)
86  *size = st.st_size;
87 
88  return true;
89  }
tuple path
else: Piece not in the list, fine.
std::string getTURL(const std::string &surl)
tuple size
Write out results.
std::string StormLcgGtStorageMaker::getTURL ( const std::string &  surl)
inlineprivate

Definition at line 15 of file StormLCGStorageMaker.cc.

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

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
virtual Storage* StormLcgGtStorageMaker::open ( const std::string &  proto,
const std::string &  surl,
int  mode 
)
inlineoverridevirtual

Implements StorageMaker.

Definition at line 58 of file StormLCGStorageMaker.cc.

References StorageFactory::CACHE_HINT_STORAGE, StorageFactory::cacheHint(), f, mergeVDriftHistosByStation::file, reco_application_tbsim_DetSim-Digi_cfg::File, StorageFactory::get(), getTURL(), IOFlags::OpenUnbuffered, cmsHarvester::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  File *file = new File (path, mode);
74  return f->wrapNonLocalFile (file, proto, path, mode);
75  }
CacheHint cacheHint(void) const
Storage * wrapNonLocalFile(Storage *s, const std::string &proto, const std::string &path, int mode)
static StorageFactory * get(void)
tuple path
else: Piece not in the list, fine.
double f[11][100]
std::string getTURL(const std::string &surl)
ReadHint readHint(void) const
Definition: File.h:11