NCBI C++ ToolKit
util.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: util.hpp 80788 2018-01-09 17:15:54Z sadyrovr $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Dmitry Kazimirov
27  *
28  * File Description: Utility functions - declarations.
29  *
30  */
31 
32 #ifndef UTIL__HPP
33 #define UTIL__HPP
34 
38 
40 
42 
44  const string& queue_name);
45 
47 
49 
51 {
52 public:
53  virtual void ProcessJobMeta(const CNetScheduleKey& key) = 0;
54 
55  virtual void BeginJobEvent(const CTempString& event_header) = 0;
56  virtual void ProcessJobEventField(const CTempString& attr_name,
57  const string& attr_value) = 0;
58  virtual void ProcessJobEventField(const CTempString& attr_name) = 0;
59  virtual void ProcessInput(const string& data) = 0;
60  virtual void ProcessOutput(const string& data) = 0;
61 
62  virtual void ProcessJobInfoField(const CTempString& field_name,
63  const CTempString& field_value) = 0;
64 
65  virtual void ProcessRawLine(const string& line) = 0;
66 
67  virtual ~IJobInfoProcessor() {}
68 };
69 
71 {
72 public:
73  CJobInfoToJSON() : m_JobInfo(CJsonNode::NewObjectNode()) {}
74 
75  virtual void ProcessJobMeta(const CNetScheduleKey& key);
76 
77  virtual void BeginJobEvent(const CTempString& event_header);
78  virtual void ProcessJobEventField(const CTempString& attr_name,
79  const string& attr_value);
80  virtual void ProcessJobEventField(const CTempString& attr_name);
81  virtual void ProcessInput(const string& data);
82  virtual void ProcessOutput(const string& data);
83 
84  virtual void ProcessJobInfoField(const CTempString& field_name,
85  const CTempString& field_value);
86 
87  virtual void ProcessRawLine(const string& line);
88 
89  CJsonNode GetRootNode() const {return m_JobInfo;}
90 
91 private:
96 };
97 
98 void g_ProcessJobInfo(CNetScheduleAPI ns_api, const string& job_key,
99  IJobInfoProcessor* processor, bool verbose,
100  CCompoundIDPool::TInstance id_pool = NULL);
101 
102 void g_PrintJSON(FILE* output_stream, CJsonNode node,
103  const char* indent = "\t");
104 
106  const string& command, bool multiline);
107 
109  bool server_version_key);
110 
111 void g_SuspendNetSchedule(CNetScheduleAPI netschedule_api, bool pullback_mode);
112 void g_ResumeNetSchedule(CNetScheduleAPI netschedule_api);
113 
114 void g_SuspendWorkerNode(CNetServer worker_node,
115  bool pullback_mode, unsigned timeout);
116 void g_ResumeWorkerNode(CNetServer worker_node);
117 
118 #define TOKEN_TYPE__NETCACHE_BLOB_KEY "NetCacheBlobKey"
119 #define TOKEN_TYPE__NETSCHEDULE_JOB_KEY "NetScheduleJobKey"
120 #define TOKEN_TYPE__NETSTORAGEOBJECT_LOC "NetStorageObjectLoc"
121 
122 CJsonNode g_WhatIs(const string& id, CCompoundIDPool id_pool = CCompoundIDPool());
123 
124 namespace NNetStorage
125 {
126 
128 
129 class CExecToJson : public IExecToJson
130 {
131 public:
133 
134 private:
135  virtual CJsonNode ExecOn(CNetServer) override;
136 
138  const string m_Command;
139 };
140 
141 }
142 
144 
145 #endif // UTIL__HPP
Pool of recycled CCompoundID objects.
CJsonNode m_UnparsableLines
Definition: util.hpp:95
virtual void ProcessInput(const string &data)
Definition: util.cpp:532
virtual void ProcessJobEventField(const CTempString &attr_name, const string &attr_value)
Definition: util.cpp:245
CJsonNode m_JobEvents
Definition: util.hpp:93
CJsonNode m_CurrentEvent
Definition: util.hpp:94
CJsonNode GetRootNode() const
Definition: util.hpp:89
CJobInfoToJSON()
Definition: util.hpp:73
CJsonNode m_JobInfo
Definition: util.hpp:92
virtual void BeginJobEvent(const CTempString &event_header)
Definition: util.cpp:237
virtual void ProcessOutput(const string &data)
Definition: util.cpp:541
virtual void ProcessJobInfoField(const CTempString &field_name, const CTempString &field_value)
Definition: util.cpp:553
virtual void ProcessJobMeta(const CNetScheduleKey &key)
Definition: util.cpp:226
virtual void ProcessRawLine(const string &line)
Definition: util.cpp:563
JSON node abstraction.
Client API for NCBI NetSchedule server.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
This class is for use by the grid_cli utility only.
virtual void ProcessJobMeta(const CNetScheduleKey &key)=0
virtual void ProcessRawLine(const string &line)=0
virtual void ProcessJobEventField(const CTempString &attr_name, const string &attr_value)=0
virtual void BeginJobEvent(const CTempString &event_header)=0
virtual void ProcessInput(const string &data)=0
virtual void ProcessJobEventField(const CTempString &attr_name)=0
virtual void ProcessOutput(const string &data)=0
virtual void ProcessJobInfoField(const CTempString &field_name, const CTempString &field_value)=0
virtual ~IJobInfoProcessor()
Definition: util.hpp:67
const string m_Command
Definition: util.hpp:138
CExecToJson(CNetStorageAdmin::TInstance, const string &)
Definition: util.cpp:927
virtual CJsonNode ExecOn(CNetServer) override
Definition: util.cpp:934
CNetStorageAdmin m_NetStorageAdmin
Definition: util.hpp:137
char data[12]
Definition: iconv.c:80
#define NULL
Definition: ncbistd.hpp:225
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
void RemoveStdReplyFields(CJsonNode &server_reply)
Definition: util.cpp:919
const struct ncbi::grid::netcache::search::fields::KEY key
NetSchedule client specs.
const char * command
static BOOL multiline
Definition: pcregrep.c:192
true_type verbose
Definition: processing.cpp:890
CSeq_id_Mapper TInstance
string indent(" ")
CJsonNode g_ServerInfoToJson(CNetService service, bool server_version_key)
Definition: util.cpp:799
CJsonNode g_WhatIs(const string &id, CCompoundIDPool id_pool=CCompoundIDPool())
Definition: util.cpp:876
CJsonNode g_ExecAnyCmdToJson(CNetService service, const string &command, bool multiline)
Definition: util.cpp:774
CJsonNode g_ReconfAndReturnJson(CNetScheduleAPI ns_api)
Definition: util.cpp:218
CJsonNode g_LegacyStatToJson(CNetServer server, bool verbose)
Definition: util.cpp:72
CJsonNode g_QueueClassInfoToJson(CNetScheduleAPI ns_api)
Definition: util.cpp:210
void g_PrintJSON(FILE *output_stream, CJsonNode node, const char *indent="\t")
Definition: util.cpp:738
void g_ProcessJobInfo(CNetScheduleAPI ns_api, const string &job_key, IJobInfoProcessor *processor, bool verbose, CCompoundIDPool::TInstance id_pool=NULL)
Definition: util.cpp:572
void g_ResumeNetSchedule(CNetScheduleAPI netschedule_api)
Definition: util.cpp:817
void g_SuspendNetSchedule(CNetScheduleAPI netschedule_api, bool pullback_mode)
Definition: util.cpp:808
void g_ResumeWorkerNode(CNetServer worker_node)
Definition: util.cpp:839
CJsonNode g_QueueInfoToJson(CNetScheduleAPI ns_api, const string &queue_name)
Definition: util.cpp:194
void g_SuspendWorkerNode(CNetServer worker_node, bool pullback_mode, unsigned timeout)
Definition: util.cpp:826
Meaningful information encoded in the NetSchedule key.
Modified on Sat May 25 14:17:27 2024 by modify_doxy.py rev. 669887