(paused_queues.
empty()) {
79 CFilepause_state_file(path);
81 if(pause_state_file.
Exists())
82pause_state_file.
Remove();
84 ERR_POST(
"Error removing the paused queue file. " 85 "It may lead to an incorrect pause state " 86 "of queues when the server restarts.");
97k != paused_queues.
end(); ++k) {
98 f.Write(k->first.c_str(), k->first.size());
99 int cnt= sprintf(
buffer,
" %d\n", k->second);
103}
catch(
constexception & exc) {
104 ERR_POST(
"Error saving the paused queue file: "<< exc.what() <<
105 "\nIt may lead to an incorrect pause state " 106 "of queues when the server restarts.");
108 ERR_POST(
"Unknown error saving the paused queue file. " 109 "It may lead to an incorrect pause state " 110 "of queues when the server restarts.");
126 boolserver_refuse_state,
127 constvector<string> refuse_submit_queues)
132 if(refuse_submit_queues.empty() && !server_refuse_state) {
135 CFilerefuse_submit_queues_file(path);
137 if(refuse_submit_queues_file.
Exists())
138refuse_submit_queues_file.
Remove();
140 ERR_POST(
"Error removing the refuse submit file. " 141 "It may lead to an incorrect refuse submit state " 142 "of queues when the server restarts.");
152 if(server_refuse_state) {
153 const char*
data=
"[server]\n";
157 for(vector<string>::const_iterator k = refuse_submit_queues.begin();
158k != refuse_submit_queues.end(); ++k) {
159 f.Write(k->c_str(), k->size());
163}
catch(
constexception & exc) {
164 ERR_POST(
"Error saving the refuse submit file: "<< exc.what() <<
165 "\nIt may lead to an incorrect refuse submit state " 166 "of queues when the server restarts.");
168 ERR_POST(
"Unknown error saving the refuse submit file. " 169 "It may lead to an incorrect refuse submit state " 170 "of queues when the server restarts.");
183 CFilepause_state_file(path);
184 boolreported =
false;
186 if(pause_state_file.
Exists()) {
187ifstream queue_file(path);
190 while(std::getline(queue_file, line)) {
194std::istringstream iss(line);
198 if(!(iss >> queue_name >> pause_mode)) {
200 ERR_POST(
"Error reading queue name and its pause status " 201 "from "<< path <<
". Ignore and continue.");
208 ERR_POST(
"Invalid pause mode "<< pause_mode <<
209 " for queue "<< queue_name <<
210 " while reading from "<< path <<
211 ". Ignore and continue.");
213paused_queues[queue_name] = pause_mode;
218 returnpaused_queues;
225vector<string> refuse_submit_queues;
230 CFilerefuse_submit_file(path);
232 if(refuse_submit_file.
Exists()) {
233ifstream refuse_file(path);
236 while(std::getline(refuse_file, line)) {
240refuse_submit_queues.push_back(line);
244 returnrefuse_submit_queues;
Class for support low level input/output for files.
NetScheduler threaded server.
bool GetRefuseSubmits() const
vector< string > GetRefuseSubmitQueues(void) const
map< string, int > GetPauseQueues(void) const
string GetDataPath(void) const
bool GetDiskless(void) const
container_type::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Remove a directory entry.
static string MakePath(const string &dir=kEmptyStr, const string &base=kEmptyStr, const string &ext=kEmptyStr)
Assemble a path from basic components.
virtual bool Exists(void) const
Check existence of file.
@ eReadWrite
File can be read and written.
@ eCreate
Create a new file, or truncate an existing one.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
const GenericPointer< typename T::ValueType > T2 value
bool IsPauseStatusValid(int value)
CFastMutex g_RefuseSubmitLock
CFastMutex g_PausedQueueLock
vector< string > DeserializeRefuseSubmitState(const string &data_path, bool diskless)
void SerializePauseState(CNetScheduleServer *server)
map< string, int > DeserializePauseState(const string &data_path, bool diskless)
void SerializeRefuseSubmitState(CNetScheduleServer *server)
const string kPausedQueuesFilesName("PAUSED_QUEUES")
const string kRefuseSubmitFileName("REFUSE_SUBMIT")
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4