CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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=nullptr) 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

◆ check()

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

Reimplemented from StorageMaker.

Definition at line 68 of file StormStorageMaker.cc.

71  {
72  struct stat st;
73  if (stat(getTURL(path).c_str(), &st) != 0)
74  return false;
75 
76  if (size)
77  *size = st.st_size;
78 
79  return true;
80  }

References getTURL(), castor_dqm_sourceclient_file_cfg::path, findQualityFiles::size, and hgcalPlots::stat.

◆ getTURL()

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

Definition at line 14 of file StormStorageMaker.cc.

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

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

Referenced by check(), and open().

◆ open()

std::unique_ptr<Storage> StormStorageMaker::open ( const std::string &  proto,
const std::string &  surl,
int  mode,
const AuxSettings  
) const
inlineoverridevirtual
start
Definition: start.py:1
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
StorageFactory::CacheHint
CacheHint
Definition: StorageFactory.h:15
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
StorageFactory::READ_HINT_UNBUFFERED
Definition: StorageFactory.h:17
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1119
HLTObjectMonitor_Client_cff.client
client
Definition: HLTObjectMonitor_Client_cff.py:6
StorageFactory::get
static const StorageFactory * get(void)
Definition: StorageFactory.cc:28
pipe
Definition: pipe.py:1
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
StormStorageMaker::getTURL
std::string getTURL(const std::string &surl) const
Definition: StormStorageMaker.cc:14
IOFlags
Definition: IOFlags.h:4
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
StorageFactory
Definition: StorageFactory.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
IOFlags::OpenUnbuffered
Definition: IOFlags.h:20
StorageFactory::CACHE_HINT_STORAGE
Definition: StorageFactory.h:15
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
StorageFactory::ReadHint
ReadHint
Definition: StorageFactory.h:17
command_line.start
start
Definition: command_line.py:167
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443