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, 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 StormStorageMaker.cc.

Member Function Documentation

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

Reimplemented from StorageMaker.

Definition at line 76 of file StormStorageMaker.cc.

References getTURL(), and findQualityFiles::size.

79  {
80  struct stat st;
81  if (stat (getTURL(path).c_str(), &st) != 0)
82  return false;
83 
84  if (size)
85  *size = st.st_size;
86 
87  return true;
88  }
tuple path
else: Piece not in the list, fine.
std::string getTURL(const std::string &surl)
tuple size
Write out results.
std::string StormStorageMaker::getTURL ( const std::string &  surl)
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 Storage* StormStorageMaker::open ( const std::string &  proto,
const std::string &  surl,
int  mode 
)
inlineoverridevirtual

Implements StorageMaker.

Definition at line 57 of file StormStorageMaker.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().

60  {
62  StorageFactory::ReadHint readHint = f->readHint();
63  StorageFactory::CacheHint cacheHint = f->cacheHint();
64 
66  || cacheHint == StorageFactory::CACHE_HINT_STORAGE)
67  mode &= ~IOFlags::OpenUnbuffered;
68  else
70 
71  std::string path = getTURL(surl);
72  File *file = new File (path, mode);
73  return f->wrapNonLocalFile (file, proto, path, mode);
74  }
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.
std::string getTURL(const std::string &surl)
double f[11][100]
ReadHint readHint(void) const
Definition: File.h:11