CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
StormLcgGtStorageMaker Class Reference
Inheritance diagram for StormLcgGtStorageMaker:
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 StormLCGStorageMaker.cc.

Member Function Documentation

◆ check()

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

Reimplemented from StorageMaker.

Definition at line 70 of file StormLCGStorageMaker.cc.

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

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

◆ getTURL()

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

Definition at line 14 of file StormLCGStorageMaker.cc.

14  {
15  // PrepareToGet timeout
16  std::string timeout("300");
17  if (char *p = std::getenv("CMS_STORM_LCG_GT_TIMEOUT"))
18  timeout = p;
19 
20  /* Build the command line:
21  -b => no BDII contacted
22  -T srmv2 => necessary with -b
23  -t timeout */
24  std::string comm("lcg-gt -b -T srmv2 -t " + timeout + " srm:" + surl + " file 2>&1");
25  LogDebug("StormLCGStorageMaker") << "command: " << comm << std::endl;
26 
27  FILE *pipe = popen(comm.c_str(), "r");
28  if (!pipe)
29  throw cms::Exception("StormLCGStorageMaker") << "failed to execute lcg-gt command: " << comm;
30 
31  // Get output
32  int ch;
34  while ((ch = getc(pipe)) != EOF)
35  output.push_back(ch);
36  pclose(pipe);
37 
38  LogDebug("StormLCGStorageMaker") << "output: " << output << std::endl;
39 
40  // Extract TURL if possible.
41  size_t start = output.find("file:", 0);
42  if (start == std::string::npos)
43  throw cms::Exception("StormLCGStorageMaker") << "no turl found in command '" << comm << "' output:\n" << output;
44 
45  start += 5;
46  std::string turl(output, start, output.find_first_of('\n', start) - start);
47  LogDebug("StormLCGStorageMaker") << "file to open: " << turl << std::endl;
48  return turl;
49  }

References Exception, LogDebug, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, command_line::start, AlCaHLTBitMon_QueryRunRegistry::string, and mps_check::timeout.

Referenced by check(), and open().

◆ open()

std::unique_ptr<Storage> StormLcgGtStorageMaker::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
StormLcgGtStorageMaker::getTURL
std::string getTURL(const std::string &surl) const
Definition: StormLCGStorageMaker.cc:14
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
IOFlags
Definition: IOFlags.h:4
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
mps_check.timeout
int timeout
Definition: mps_check.py:53
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
timeout
Definition: timeout.py:1
StorageFactory
Definition: StorageFactory.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
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
edm_modernize_messagelogger.stat
stat
Definition: edm_modernize_messagelogger.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443