|
ATLAS Offline Software
|
Go to the documentation of this file.
20 #include <boost/functional/hash.hpp>
25 #include <sys/types.h>
50 boost::hash_combine (
hash, std::hash<pid_t>() (getpid()));
51 std::size_t tries = 0;
55 throw std::runtime_error (
"infinite loop trying to create tempory file for DiskWriterXRD");
58 boost::hash_combine (
hash,
std::hash<decltype(time)>() (time));
59 std::size_t hash16 {
hash};
60 while (hash16 > 0xffff)
61 hash16 = (hash16&0xffff) ^ (hash16 >> 16);
63 std::ostringstream
str;
71 if (gSystem->AccessPathName (
m_tmp.c_str()) != 0)
72 m_file.reset (TFile::Open (
m_tmp.c_str(),
"CREATE"));
92 std::cerr <<
"exception closing file " <<
m_path <<
": "
93 <<
e.what() << std::endl;
97 std::cerr <<
"unknown exception closing file " <<
m_path << std::endl;
136 std::random_device rd;
137 std::mt19937
gen (rd());
138 bool success =
false;
153 std::cerr <<
"encountered error copying files to XRD path: \"" <<
m_path <<
"\"" << std::endl;
161 unsigned seconds = std::uniform_int_distribution<>(30,60) (
gen);
162 std::cerr <<
"sleeping for " <<
seconds <<
" seconds before retrying" << std::endl;
166 std::cerr <<
"giving up, leaving file at " <<
m_tmp << std::endl;
167 throw std::runtime_error (
"failed to copy file to XRD");
@ u
Enums for curvilinear frames.
std::unique_ptr< TFile > m_file
the actual file object
void testInvariant() const
test the invariant of this object
std::string m_path
the path being used
virtual TFile * getFile() override
the file we are writing to
DiskWriterXRD(const std::string &val_path)
standard constructor
virtual void doClose() override
closes the file we are writing to
std::string m_path
the path being used
#define RCU_REQUIRE2_SOFT(x, y)
virtual std::string getPath() const override
the path where this file can be accessed or the empty string if it is not known (yet).
std::string getenv(const std::string &variableName)
get an environment variable
#define RCU_DESTROY_INVARIANT(x)
void exec(const std::string &cmd)
effects: execute the given command guarantee: strong failures: out of memory II failures: system fail...
~DiskWriterXRD()
standard destructor
#define RCU_CHANGE_INVARIANT(x)
This module provides a lot of global definitions, forward declarations and includes that are used by ...
#define RCU_THROW_MSG(message)
void close()
closes the file we are writing to
#define RCU_READ_INVARIANT(x)
std::string quote(const std::string &name)
effects: quote the given name to protect it from the shell returns: the quoted name guarantee: strong...
std::string m_tmp
the temporary path being used
#define RCU_NEW_INVARIANT(x)