:
"REFUSESUBMITS mode=0");
49m_Impl->m_API->m_Service.ExecOnAllServers(
cmd);
55 const autodie = level ==
eDie;
56 string cmd(die ?
"SHUTDOWN SUICIDE":
57level == eShutdownImmediate ?
"SHUTDOWN IMMEDIATE":
58level ==
eDrain?
"SHUTDOWN drain=1":
"SHUTDOWN");
62 autoretry_guard = m_Impl->m_API->m_Service->CreateRetryGuard(retry_mode);
65m_Impl->m_API->m_Service.ExecOnAllServers(
cmd);
76 string cmd(
"RECO");
78m_Impl->m_API->m_Service.ExecOnAllServers(
cmd);
82 const string& description)
84limits::Check<limits::SQueueName>(qname);
86 string cmd=
"QCRE "+ qname;
90 if(!description.empty()) {
98m_Impl->m_API->m_Service.ExecOnAllServers(
cmd);
103limits::Check<limits::SQueueName>(qname);
105 string cmd(
"QDEL "+ qname);
107m_Impl->m_API->m_Service.ExecOnAllServers(
cmd);
116 while(
output.ReadLine(line))
117 out<< line <<
"\n";
122 string cmd(
"DUMP "+ job_key);
124 returnm_Impl->m_API->GetServer(job_key).ExecWithRetry(
cmd,
true);
130 if(job_statuses.empty()) {
131 cmd.assign(
"CANCELQ");
133 cmd.assign(
"CANCEL status=");
134 cmd.append(job_statuses);
137m_Impl->m_API->m_Service.ExecOnAllServers(
cmd);
143 string cmd(
"VERSION");
145m_Impl->m_API->m_Service.PrintCmdOutput(
cmd,
152 const string& start_after_job,
154 const string& job_statuses,
155 const string& job_group)
157 string cmd(
"DUMP");
158 if(!job_statuses.empty()) {
159 cmd.append(
" status=");
160 cmd.append(job_statuses);
162 if(!start_after_job.empty()) {
163 cmd.append(
" start_after=");
164 cmd.append(start_after_job);
167 cmd.append(
" count=");
170 if(!job_group.empty()) {
171limits::Check<limits::SJobGroup>(job_group);
172 cmd.append(
" group=");
173 cmd.append(job_group);
176m_Impl->m_API->m_Service.PrintCmdOutput(
cmd,
182 const string& start_after_job,
185 const string& job_group)
191job_statuses.clear();
194DumpQueue(output_stream, start_after_job, job_count, job_statuses, job_group);
200 stringqinf_cmd(
"QINF2 "+ queue_name);
211queue_info[field->name] = field->value;
228GetQueueInfo(m_Impl->m_API->m_Service.Iterate().GetServer(),
229queue_name, queue_info);
235GetQueueInfo(server, m_Impl->m_API->m_Queue, queue_info);
240GetQueueInfo(m_Impl->m_API->m_Queue, queue_info);
246 boolprint_headers = m_Impl->m_API->m_Service.IsLoadBalanced();
251output_stream <<
'['<< (*it).GetServerAddress() <<
']'<<
NcbiEndl;
255GetQueueInfo(*it, queue_name, queue_info);
258output_stream << qi->first <<
": "<< qi->second <<
NcbiEndl;
269list<SWorkerNodeInfo>& worker_nodes)
276 string cmd(
"GETCONF");
278m_Impl->m_API->m_Service.PrintCmdOutput(
cmd,
285 string cmd(opt == eStatisticsBrief ?
"STAT":
286opt == eStatisticsClients ?
"STAT CLIENTS":
"STAT ALL");
288m_Impl->m_API->m_Service.PrintCmdOutput(
cmd,
294 string cmd(
"HEALTH");
296m_Impl->m_API->m_Service.PrintCmdOutput(
cmd,
302 string cmd(
"STAT QUEUES");
314 while(cmd_output.
ReadLine(output_line))
316output_line.length() >
sizeof(
"[queue "))
317qlist.back().queues.push_back(output_line.substr(
318 sizeof(
"[queue ") - 1,
319output_line.length() -
sizeof(
"[queue ")));
325 const string& affinity_token,
326 const string& job_group)
328 string cmd=
"STAT JOBS";
330 if(!affinity_token.empty()) {
331limits::Check<limits::SAffinity>(affinity_token);
332 cmd.append(
" aff=");
333 cmd.append(affinity_token);
336 if(!job_group.empty()) {
337limits::Check<limits::SJobGroup>(job_group);
338 cmd.append(
" group=");
339 cmd.append(job_group);
351(*it).ExecWithRetry(
cmd,
true));
353 while(cmd_output.
ReadLine(output_line))
355status_map[st_str] +=
363 "Error while parsing STAT JOBS response");
Client API for NCBI NetSchedule server.
void ReloadServerConfig()
void GetQueueInfo(CNetServer server, const string &queue_name, TQueueInfo &queue_info)
void PrintServerStatistics(CNcbiOstream &output_stream, EStatisticsOptions opt=eStatisticsBrief)
void PrintServerVersion(CNcbiOstream &output_stream)
Print version string.
void DeleteQueue(const string &qname)
Delete queue Applicable only to queues, created through CreateQueue method.
void GetQueueList(TQueueList &result)
void SwitchToDrainMode(ESwitch on_off)
Enable server drain mode.
void CreateQueue(const string &qname, const string &qclass, const string &description=kEmptyStr)
Create an instance of the given queue class.
void PrintConf(CNcbiOstream &output_stream)
EShutdownLevel
Shutdown level.
void DumpJob(CNcbiOstream &out, const string &job_key)
void ShutdownServer(EShutdownLevel level=eNormalShutdown)
Shutdown the server daemon.
void StatusSnapshot(TStatusMap &status_map, const string &affinity_token=kEmptyStr, const string &job_group=kEmptyStr)
Returns statuses for a given affinity token.
void CancelAllJobs(const string &job_statuses=kEmptyStr)
Cancel all jobs in the queue (optionally with particular statuses).
void DumpQueue(CNcbiOstream &output_stream, const string &start_after_job=kEmptyStr, size_t job_count=0, const string &job_statuses=kEmptyStr, const string &job_group=kEmptyStr)
void PrintHealth(CNcbiOstream &output_stream)
void GetWorkerNodes(list< SWorkerNodeInfo > &worker_nodes)
void PrintQueueInfo(const string &queue_name, CNcbiOstream &output_stream)
list< SServerQueueList > TQueueList
NetSchedule internal exception.
bool ReadLine(string &output)
@ eMultilineOutput_NetCacheStyle
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
std::ofstream out("events_result.xml")
main entry point for tests
static SQLCHAR output[256]
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
TErrCode GetErrCode(void) const
Get error code.
#define NCBI_RETHROW(prev_exception, exception_class, err_code, message)
Generic macro to re-throw an exception.
EJobStatus
Job status codes.
static string StatusToString(EJobStatus status)
Printable status type.
@ eJobNotFound
No such job.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static CTempString TruncateSpaces_Unsafe(const CTempString str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
@ eTrunc_Begin
Truncate leading whitespace only.
const TArgs & GetArgs(void) const
Get the const list of arguments.
enum ENcbiSwitch ESwitch
Aux.
NetSchedule client specs.
static string s_MkQINFCmd(const string &queue_name)
void g_GetWorkerNodes(CNetScheduleAPI api, list< CNetScheduleAdmin::SWorkerNodeInfo > &worker_nodes)
static void s_ParseQueueInfo(const string &server_output, CNetScheduleAdmin::TQueueInfo &queue_info)
void g_AppendClientIPSessionIDHitID(string &cmd)
CNetServer::SExecResult ConnectAndExec(const string &cmd, bool multiline_output, bool retry_on_exception=false)
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