47 m_NetScheduleAPI(ns_api)
49 auto warning_handler = [&](
const string& m,
CNetServer s) {
65 "NetScheduleServer constructor: "
66 "'server_address' must be a host:port combination");
73 {
"service_name",
"", },
74 {
"queue_name",
"", },
75 {
"client_name",
"", },
83 const auto service_name = args[
"service_name"].AsString();
84 const auto queue_name = args[
"queue_name"].AsString();
85 const auto client_name = args[
"client_name"].AsString();
88 service_name, client_name, queue_name));
96 {
"service_name",
"", },
97 {
"queue_name",
"", },
98 {
"client_name",
"", },
106 const auto service_name = args[
"service_name"].AsString();
107 const auto queue_name = args[
"queue_name"].AsString();
108 const auto client_name = args[
"client_name"].AsString();
111 service_name, client_name, queue_name));
135 {
"server_status", ExecMethod<TSelf, &TSelf::ExecServerStatus>, {
136 {
"verbose",
false, },
138 {
"job_group_info", ExecMethod<TSelf, &TSelf::ExecJobGroupInfo>, {
139 {
"verbose",
false, },
141 {
"client_info", ExecMethod<TSelf, &TSelf::ExecClientInfo>, {
142 {
"verbose",
false, },
144 {
"notification_info", ExecMethod<TSelf, &TSelf::ExecNotificationInfo>, {
145 {
"verbose",
false, },
147 {
"affinity_info", ExecMethod<TSelf, &TSelf::ExecAffinityInfo>, {
148 {
"verbose",
false, },
150 {
"change_preferred_affinities", ExecMethod<TSelf, &TSelf::ExecChangePreferredAffinities>, {
157 cmds.insert(cmds.end(), base_cmds.begin(), base_cmds.end());
166 auto& reply = io.
reply;
167 const auto verbose = args[
"verbose"].AsBoolean();
175 auto& reply = io.
reply;
176 const auto verbose = args[
"verbose"].AsBoolean();
184 auto& reply = io.
reply;
185 const auto verbose = args[
"verbose"].AsBoolean();
193 auto& reply = io.
reply;
194 const auto verbose = args[
"verbose"].AsBoolean();
202 auto& reply = io.
reply;
203 const auto verbose = args[
"verbose"].AsBoolean();
214 affinity.
Exec(
"change_preferred_affinities", it);
226 auto affs_to_add = args[
"affs_to_add"].Value();
227 auto affs_to_del = args[
"affs_to_del"].Value();
244 {
"set_client_type", ExecMethod<TSelf, &TSelf::ExecSetClientType>, {
245 {
"client_type", 0, },
247 {
"set_node_session", ExecMethod<TSelf, &TSelf::ExecSetNodeSession>, {
251 {
"queue_info", ExecMethod<TSelf, &TSelf::ExecQueueInfo>, {
252 {
"queue_name",
"", },
254 {
"queue_class_info", ExecMethod<TSelf, &TSelf::ExecQueueClassInfo>, },
255 {
"reconf", ExecMethod<TSelf, &TSelf::ExecReconf>, },
256 {
"suspend", ExecMethod<TSelf, &TSelf::ExecSuspend>, {
257 {
"pullback_mode",
false, },
259 {
"resume", ExecMethod<TSelf, &TSelf::ExecResume>, },
260 {
"shutdown", ExecMethod<TSelf, &TSelf::ExecShutdown>, {
261 {
"do_not_drain",
false, },
263 {
"parse_key", ExecMethod<TSelf, &TSelf::ExecParseKey>, {
266 {
"job_info", ExecMethod<TSelf, &TSelf::ExecJobInfo>, {
268 {
"verbose",
true, },
270 {
"job_counters", ExecMethod<TSelf, &TSelf::ExecJobCounters>, {
272 {
"job_group",
"", },
274 {
"get_servers", ExecMethod<TSelf, &TSelf::ExecGetServers>, },
278 cmds.insert(cmds.end(), base_cmds.begin(), base_cmds.end());
295 const auto node = args[
"node"].AsString();
296 const auto session = args[
"session"].AsString();
305 auto& reply = io.
reply;
306 const auto queue_name = args[
"queue_name"].AsString();
312 auto& reply = io.
reply;
318 auto& reply = io.
reply;
326 const auto pullback_mode = args[
"pullback_mode"].AsBoolean();
339 const auto do_not_drain = args[
"do_not_drain"].AsBoolean();
348 auto& reply = io.
reply;
349 const auto job_key = args[
"job_key"].AsString();
359 auto& reply = io.
reply;
360 const auto job_key = args[
"job_key"].AsString();
361 const auto verbose = args[
"verbose"].AsBoolean();
371 auto& reply = io.
reply;
372 const auto affinity = args[
"affinity"].AsString();
373 const auto job_group = args[
"job_group"].AsString();
379 jobs_by_status.
SetInteger(it->first, it->second);
381 reply.Append(jobs_by_status);
386 auto& reply = io.
reply;
394 reply.Append(object_ids);
CJsonNode g_ReconfAndReturnJson(CNetScheduleAPI ns_api)
CJsonNode g_LegacyStatToJson(CNetServer server, bool verbose)
CJsonNode g_QueueClassInfoToJson(CNetScheduleAPI ns_api)
void g_ResumeNetSchedule(CNetScheduleAPI netschedule_api)
void g_ProcessJobInfo(CNetScheduleAPI ns_api, const string &job_key, IJobInfoProcessor *processor, bool verbose, CCompoundIDPool::TInstance id_pool)
void g_SuspendNetSchedule(CNetScheduleAPI netschedule_api, bool pullback_mode)
CJsonNode g_QueueInfoToJson(CNetScheduleAPI ns_api, const string &queue_name)
CJsonNode GetRootNode() const
virtual void ProcessJobMeta(const CNetScheduleKey &key)
Iterator for JSON arrays and objects.
bool IsNull() const
Return true for a null node. Return false otherwise.
static CJsonNode NewArrayNode()
Create a new JSON array node.
SJsonIteratorImpl * Iterate(EIterationMode mode=eNatural) const
For a container node (that is, either an array or an object), begin iteration over its elements.
void AppendInteger(Int8 value)
For an array node, add a integer node at the end of the array.
void SetInteger(const string &key, Int8 value)
Set a JSON object element to the specified integer value.
static CJsonNode NewObjectNode()
Create a new JSON object node.
void Append(CJsonNode::TInstance value)
For an array node, add a new element at the end of the array.
Client API for NCBI NetSchedule server.
@ eNormalShutdown
Normal shutdown was requested.
@ eDrain
Wait for all server data to expire.
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 SetWarningHandler(TEventHandler warning_handler)
CNetServiceIterator Iterate(EIterationMode mode=eSortByLoad)
void Exec(const string &name, CJsonIterator &input)
CAutomationProc * m_AutomationProc
TObjectID AddObject(TAutomationObjectRef new_object)
void SendWarning(const string &warn_msg, TAutomationObjectRef source)
TAutomationObjectRef ReturnNetScheduleServerObject(CNetScheduleAPI::TInstance ns_api, CNetServer::TInstance server)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void SetClientType(EClientType client_type)
void ChangePreferredAffinities(const vector< string > *affs_to_add, const vector< string > *affs_to_delete)
CNetScheduleExecutor GetExecutor()
Create an instance of CNetScheduleExecutor.
CNetScheduleAdmin GetAdmin()
pair< TCommands, TCommandChecker > TCommandGroup
vector< CCommand > TCommands
@ eNetScheduleStatClients
@ eNetScheduleStatNotifications
@ eNetScheduleStatJobGroups
@ eNetScheduleStatAffinities
CJsonNode g_GenericStatToJson(CNetServer server, ENetScheduleStatTopic topic, bool verbose)
vector< string > s_ExtractVectorOfStrings(CJsonNode &arg)
void ReSetClientSession(const string &)
void ReSetClientNode(const string &)
CCompoundIDPool GetCompoundIDPool()
static TInstance CreateNoCfgLoad(const string &, const string &, const string &)
Meaningful information encoded in the NetSchedule key.
static const string kName
void ExecServerStatus(const TArguments &args, SInputOutput &io)
void ExecNotificationInfo(const TArguments &args, SInputOutput &io)
static TCommands CallCommands()
SNetScheduleServer(CAutomationProc *automation_proc, CNetScheduleAPIExt ns_api, CNetServer::TInstance server)
static CCommand CallCommand()
void ExecAffinityInfo(const TArguments &args, SInputOutput &io)
void ExecJobGroupInfo(const TArguments &args, SInputOutput &io)
void ExecChangePreferredAffinities(const TArguments &args, SInputOutput &io)
void ExecClientInfo(const TArguments &args, SInputOutput &io)
static CAutomationObject * Create(const TArguments &args, CAutomationProc *automation_proc)
static CCommand NewCommand()
void ExecJobInfo(const TArguments &args, SInputOutput &io)
void ExecQueueClassInfo(const TArguments &args, SInputOutput &io)
SNetScheduleService(CAutomationProc *automation_proc, CNetScheduleAPI ns_api)
void ExecQueueInfo(const TArguments &args, SInputOutput &io)
static const string kName
static TCommands CallCommands()
CNetScheduleAPIExt m_NetScheduleAPI
static CCommand NewCommand()
void ExecJobCounters(const TArguments &args, SInputOutput &io)
void ExecParseKey(const TArguments &args, SInputOutput &io)
void ExecReconf(const TArguments &args, SInputOutput &io)
void ExecShutdown(const TArguments &args, SInputOutput &io)
static CCommand CallCommand()
void ExecGetServers(const TArguments &args, SInputOutput &io)
void ExecSetNodeSession(const TArguments &args, SInputOutput &io)
void ExecSuspend(const TArguments &args, SInputOutput &io)
void ExecSetClientType(const TArguments &args, SInputOutput &io)
static CAutomationObject * Create(const TArguments &args, CAutomationProc *automation_proc)
void ExecResume(const TArguments &args, SInputOutput &io)
static TCommands CallCommands()