38 #define MAX_VISIBLE_DATA_LENGTH 50
56 fprintf(stderr,
GRID_APP_NAME ": invalid option combination.\n");
67 "Total number of Running and Pending jobs: %u\n" :
69 "{\n\t\"active_job_count\": %u\n}\n",
70 st_map[
"Running"] + st_map[
"Pending"]);
72 string cmd =
"STAT JOBS";
80 cmd.append(
" group=");
93 const char* format_cont;
96 format_cont =
format =
"%s: %u\n";
100 format_cont =
",\n\t\"%s\": %u";
104 if (it->second > 0 || it->first ==
"Total") {
105 printf(
format, it->first.c_str(), it->second);
123 result.SetByKey((*it).GetServerAddress(),
141 result.SetByKey((*it).GetServerAddress(),
149 cmd.append(
" VERBOSE");
158 printf(
"server_address: %s:%hu\njob_id: %u\n",
161 if (!
key.queue.empty())
162 printf(
"queue_name: %s\n",
key.queue.c_str());
167 printf(
"[%.*s]\n",
int(event_header.
length()), event_header.
data());
171 const string& attr_value)
173 printf(
" %.*s: %s\n",
int(attr_name.
length()),
174 attr_name.
data(), attr_value.c_str());
179 printf(
" %.*s\n",
int(attr_name.
length()), attr_name.
data());
187 printf(
"%s_storage: netcache, key=%s\n", prefix,
data.c_str() + 2);
200 printf(
"%s_storage: %s, size=%lu\n", prefix,
204 printf(
"%s_%s_data: \"%s\"\n",
format, prefix,
207 printf(
"%s_%s_data_preview: \"%s\"...\n",
format, prefix,
216 printf(
"%.*s: %.*s\n", (
int) field_name.
length(), field_name.
data(),
217 (
int) field_value.
length(), field_value.
data());
CJsonNode g_LegacyStatToJson(CNetServer server, bool verbose)
void g_PrintJSON(FILE *output_stream, CJsonNode node, const char *indent)
bool IsOptionSet(int option) const
struct CGridCommandLineInterfaceApp::SOptions m_Opts
int PrintNetScheduleStats()
CNetScheduleAdmin m_NetScheduleAdmin
void PrintNetScheduleStats_Generic(ENetScheduleStatTopic topic)
CNetScheduleAPIExt m_NetScheduleAPI
static void PrintLine(const string &line)
static CJsonNode NewObjectNode()
Create a new JSON object node.
void PrintServerStatistics(CNcbiOstream &output_stream, EStatisticsOptions opt=eStatisticsBrief)
void StatusSnapshot(TStatusMap &status_map, const string &affinity_token=kEmptyStr, const string &job_group=kEmptyStr)
Returns statuses for a given affinity token.
void PrintCmdOutput(const string &cmd, CNcbiOstream &output_stream, ECmdOutputStyle output_style, CNetService::EIterationMode=CNetService::eSortByLoad)
CNetServiceIterator Iterate(EIterationMode mode=eSortByLoad)
void PrintXput(const string &data, const char *prefix)
virtual void ProcessJobMeta(const CNetScheduleKey &key)
virtual void ProcessRawLine(const string &line)
virtual void ProcessJobInfoField(const CTempString &field_name, const CTempString &field_value)
virtual void ProcessJobEventField(const CTempString &attr_name, const string &attr_value)
virtual void BeginJobEvent(const CTempString &event_header)
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)
Get a printable version of the specified string.
CTempString & assign(const char *src_str, size_type len)
Assign new values to the content of the a string.
const char * data(void) const
Return a pointer to the array represented.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
size_type length(void) const
Return the length of the represented array.
string g_NetService_TryResolveHost(const string &ip_or_hostname)
const struct ncbi::grid::netcache::search::fields::KEY key
string g_GetNetScheduleStatCommand(ENetScheduleStatTopic topic)
@ eNetScheduleStatClients
@ eNetScheduleStatNotifications
@ eNetScheduleStatJobGroups
@ eNetScheduleStatAffinities
CJsonNode g_GenericStatToJson(CNetServer server, ENetScheduleStatTopic topic, bool verbose)
#define MAX_VISIBLE_DATA_LENGTH
EOutputFormat output_format
Meaningful information encoded in the NetSchedule key.