m_ControlPort(0), m_PassedChecks(0), m_ID(0)
84found = params.
find(
"client_node");
85 if(found != params.
end())
88found = params.
find(
"client_session");
89 if(found != params.
end())
92found = params.
find(
"client_type");
93 if(found != params.
end())
100 "client_session is provided but client_node is not");
103 "client_node is provided but client_session is not");
112found = params.
find(
"prog");
113 if(found != params.
end())
116found = params.
find(
"client");
117 if(found != params.
end())
120found = params.
find(
"scope");
121 if(found != params.
end())
124found = params.
find(
"control_port");
125 if(found != params.
end()) {
128NStr::StringToNumeric<unsigned short>(found->second);
130 ERR_POST(
"Error converting client control port. " 131 "Expected control_port=<unsigned short>, " 132 "received control_port="<< found->second);
137found = params.
find(
"client_host");
138 if(found != params.
end())
177 "Invalid parameter: queue required");
186 "to execute "+
cmd);
188 "Access denied: admin privileges required");
195 "to execute "+
cmd);
197 "Access denied: submitter privileges required");
204 "to execute "+
cmd);
206 "Access denied: worker node privileges required");
213 "to execute "+
cmd);
215 "Access denied: reader privileges required");
222 "to execute "+
cmd);
224 "Access denied: program privileges required");
233 stringci_claimed_type = claimed_type;
235 if(ci_claimed_type ==
"submitter")
237 if(ci_claimed_type ==
"worker node")
239 if(ci_claimed_type ==
"reader")
241 if(ci_claimed_type ==
"admin")
243 if(ci_claimed_type ==
"auto")
245 if(ci_claimed_type ==
"reset")
249 "Unsupported client_type value at the handshake phase. Supported " 250 "values are: submitter, worker node, reader, admin and auto. " 268 stringchecksum_as_string;
271checksum_as_string = checksum.
GetHexSum();
281checksum_as_string.size())
283normalized =
val.substr(0, outer_lenght) +
"/"+
284checksum_as_string +
"/"+
285 val.substr(
val.size() - outer_lenght, outer_lenght);
288 ERR_POST(
"Client identification parameter "<<
key<<
289 " exceeds the max allowed length of "<<
301m_BlacklistTimeout(
NULL),
307m_BlacklistedJobsOpCount(0),
308m_PrefAffinitiesOpCount(0),
309m_WaitAffinitiesOpCount(0)
317m_BlacklistTimeout(timeout),
323m_BlacklistedJobsOpCount(0),
324m_PrefAffinitiesOpCount(0),
325m_WaitAffinitiesOpCount(0)
334vector<unsigned int> to_be_removed;
336 if(item.second < current_time)
337to_be_removed.push_back(item.first);
340 for(
const auto& job_id : to_be_removed) {
363 if(found->second < current_time) {
386 ERR_POST(
"Design error in NetSchedule. " 387 "Blacklist timeout pointer must not be NULL. " 388 "Ignore blacklisting request and continue.");
397 if(last_time_in_list < last_access)
463 booluse_preferred)
const 478 constvector<TJobStatus> & match_states)
484 unsigned intmin_existed_id =
tracker.GetMinJobID();
485vector<unsigned int> to_be_removed;
487 for(map<
unsigned int,
490 if(k->first < min_existed_id)
491to_be_removed.push_back(k->first);
494 for(vector<TJobStatus>::const_iterator j = match_states.begin();
495j != match_states.end(); ++j) {
497to_be_removed.push_back(k->first);
504 for(vector<unsigned int>::const_iterator m = to_be_removed.begin();
505m != to_be_removed.end(); ++m) {
569m_RegistrationTime(0, 0),
570m_SessionStartTime(0, 0),
571m_SessionResetTime(0, 0),
575m_NumberOfSubmitted(0),
576m_NumberOfSockErrors(0),
577m_ClientDataVersion(0)
586m_ClaimedType(client_id.GetType()),
587m_Addr(client_id.GetAddress()),
588m_ControlPort(client_id.GetControlPort()),
589m_ClientHost(client_id.GetClientHost()),
590m_RegistrationTime(0, 0),
591m_SessionStartTime(0, 0),
592m_SessionResetTime(0, 0),
594m_Session(client_id.GetSession()),
596m_NumberOfSubmitted(0),
597m_NumberOfSockErrors(0),
598m_ClientDataVersion(0),
599m_WNData(blacklist_timeout),
600m_ReaderData(read_blacklist_timeout),
601m_LastScope(client_id.
GetScope()),
606 "Creating client information object for old style clients");
621 if(cmd_group ==
eGet) {
646 if(cmd_group ==
eGet)
699 buffer+=
"OK:CLIENT: '"+ node_name +
"'\n" 701 "OK: PREFERRED AFFINITIES RESET: ";
703 else buffer+=
"FALSE\n";
705 buffer+=
"OK: READER PREFERRED AFFINITIES RESET: ";
707 else buffer+=
"FALSE\n";
710 buffer+=
"OK: LAST ACCESS: n/a\n";
712 buffer+=
"OK: LAST ACCESS: "+
716 buffer+=
"OK: SESSION START TIME: n/a\n";
718 buffer+=
"OK: SESSION START TIME: "+
722 buffer+=
"OK: REGISTRATION TIME: n/a\n";
724 buffer+=
"OK: REGISTRATION TIME: "+
728 buffer+=
"OK: SESSION RESET TIME: n/a\n";
730 buffer+=
"OK: SESSION RESET TIME: "+
735 buffer+=
"OK: CLIENT HOST: ";
741 buffer+=
"OK: WORKER NODE CONTROL PORT: ";
748 buffer+=
"OK: SESSION: n/a\n";
754 buffer+=
"OK: NUMBER OF SUBMITTED JOBS: "+
761 buffer+=
"OK: NUMBER OF BLACKLISTED JOBS: "+
762to_string(wn_blacklist.
count()) +
"\n";
764 buffer+=
"OK: BLACKLISTED JOBS:\n";
767 for( ; en.
valid(); ++en) {
768 unsigned intjob_id = *en;
780 buffer+=
"OK: NUMBER OF READ BLACKLISTED JOBS: "+
781to_string(rd_blacklist.
count()) +
"\n";
783 buffer+=
"OK: READ BLACKLISTED JOBS:\n";
786 for( ; en.
valid(); ++en) {
787 unsigned intjob_id = *en;
795 buffer+=
"OK: NUMBER OF RUNNING JOBS: "+
798 buffer+=
"OK: RUNNING JOBS:\n";
801 for( ; en.
valid(); ++en)
805 buffer+=
"OK: NUMBER OF JOBS GIVEN FOR EXECUTION: "+
808 buffer+=
"OK: NUMBER OF READING JOBS: "+
811 buffer+=
"OK: READING JOBS:\n";
814 for( ; en.
valid(); ++en)
818 buffer+=
"OK: NUMBER OF JOBS GIVEN FOR READING: "+
821 buffer+=
"OK: NUMBER OF PREFERRED AFFINITIES: "+
824 buffer+=
"OK: PREFERRED AFFINITIES:\n";
827 for( ; en.
valid(); ++en)
831 buffer+=
"OK: NUMBER OF REQUESTED AFFINITIES: "+
834 buffer+=
"OK: REQUESTED AFFINITIES:\n";
837 for( ; en.
valid(); ++en)
841 buffer+=
"OK: NUMBER OF READER PREFERRED AFFINITIES: "+
845 buffer+=
"OK: READER PREFERRED AFFINITIES:\n";
848 for( ; en.
valid(); ++en)
852 buffer+=
"OK: NUMBER OF READER REQUESTED AFFINITIES: "+
856 buffer+=
"OK: READER REQUESTED AFFINITIES:\n";
859 for( ; en.
valid(); ++en)
863 buffer+=
"OK: NUMBER OF SOCKET WRITE ERRORS: "+
868 if(wn_gc_clients.
find(node_name) == wn_gc_clients.
end())
869 buffer+=
"OK: WN AFFINITIES GARBAGE COLLECTED: FALSE\n";
871 buffer+=
"OK: WN AFFINITIES GARBAGE COLLECTED: TRUE\n";
873 if(read_gc_clients.
find(node_name) == read_gc_clients.
end())
874 buffer+=
"OK: READER AFFINITIES GARBAGE COLLECTED: FALSE\n";
876 buffer+=
"OK: READER AFFINITIES GARBAGE COLLECTED: TRUE\n";
878 "OK: PROGRAM NAME: '"+
889vector<TJobStatus> match_states;
894 if(cmd_group ==
eGet) {
909 "client data version does not match");
972 case eActive:
return "active";
973 case eWNStale:
return "worker node stale";
976 case eQuit:
return "quit";
Checksum and hash calculation classes.
CChecksum â Checksum calculator.
string GetTokenByID(unsigned int aff_id) const
EClaimedClientType GetType(void) const
string x_NormalizeNodeOrSession(const string &val, const string &key)
bool IsComplete(void) const
const string & GetProgramName(void) const
void SetClientName(const string &client_name)
const string & GetSession(void) const
void CheckAccess(TNSCommandChecks cmd_reqs, CNetScheduleServer *server, const string &cmd)
unsigned short m_ControlPort
EClaimedClientType m_ClientType
void Update(unsigned int peer_addr, const TNSProtoParams ¶ms)
const string & GetClientHost(void) const
unsigned int GetAddress(void) const
EClaimedClientType x_ConvertToClaimedType(const string &claimed_type) const
TNSCommandChecks m_PassedChecks
string GetVirtualScope(void) const
unsigned short GetControlPort(void) const
size_t m_NumberOfSockErrors
string Print(const string &node_name, const CQueue *queue, const CNSAffinityRegistry &aff_registry, const set< string > &gc_clients, const set< string > &read_gc_clients, bool verbose) const
void RegisterSubmittedJobs(size_t count)
CNSPreciseTime m_SessionStartTime
int SetClientData(const string &data, int data_version)
void RegisterJob(unsigned int job_id, ECommandGroup cmd_group)
CNSPreciseTime m_LastAccess
EClaimedClientType m_ClaimedType
void RegisterBlacklistedJob(unsigned int job_id, ECommandGroup cmd_group)
CNSPreciseTime m_RegistrationTime
unsigned short m_ControlPort
string GetVirtualScope(const string &client_node) const
CNSPreciseTime m_SessionResetTime
void Touch(const CNSClientId &client_id)
void GCBlacklistedJobs(const CJobStatusTracker &tracker, ECommandGroup cmd_group)
string x_TypeAsString(void) const
size_t m_NumberOfSubmitted
SRemoteNodeData m_ReaderData
string x_StateAsString(void) const
static CNSPreciseTime Current(void)
NetSchedule internal exception.
NetScheduler threaded server.
void RegisterAlert(EAlertType alert_type, const string &message)
string MakeJobKey(unsigned int job_id) const
TJobStatus GetJobStatus(unsigned job_id) const
Constant iterator designed to enumerate "ON" bits.
bool valid() const noexcept
Checks if iterator is still valid.
Bitvector Bit-vector container with runtime compression of bits.
@ opt_free_0
Free unused 0 blocks.
bool get_bit(size_type n) const noexcept
returns true if bit n is set and false is bit n is 0.
bool any() const noexcept
Returns true if any bits in this bitset are set, and otherwise returns false.
void optimize(bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0)
Optimize memory bitvector's memory allocation.
bool set_bit(size_type n, bool val=true)
Sets bit n.
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
size_type count() const noexcept
population count (count of ON bits)
container_type::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
const_iterator find(const key_type &key) const
const_iterator end() const
string GetHexSum(void) const
Return string with checksum in hexadecimal form.
void AddLine(const char *line, size_t len)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
EJobStatus
Job status codes.
static string StatusToString(EJobStatus status)
Printable status type.
@ eDone
Job is ready (computed successfully)
@ eConfirmed
Final state - read confirmed.
@ eCanceled
Explicitly canceled.
@ eJobNotFound
No such job.
@ eReadFailed
Final state - read failed.
@ eFailed
Failed to run (execution timeout)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string gethostbyaddr(const CNCBI_IPAddr &addr, ESwitch log=eOff)
Return empty string on error.
static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)
Get a printable version of the specified string.
static string ParseEscapes(const CTempString str, EEscSeqRange mode=eEscSeqRange_Standard, char user_char='?')
Parse C-style escape sequences in the specified string.
static string & ToLower(string &str)
Convert string to lower case â string& version.
@ BM_GAP
GAP compression is ON.
unsigned int
A callback function used to compare two keys in a database.
NetSchedule job status tracker.
const struct ncbi::grid::netcache::search::fields::KEY key
#define GetProgramName
Avoid name clash with the NCBI C Toolkit.
NetSchedule client specs.
unsigned int TNSCommandChecks
const size_t k_OpLimitToOptimize
const string kVirtualScopePrefix
const CNSPreciseTime kTimeZero
const CNSPreciseTime kTimeNever
string NS_FormatPreciseTime(const CNSPreciseTime &t)
const unsigned kMaxWorkerNodeIdSize
NetSchedule queue client version control.
void AddToBlacklist(unsigned int job_id, const CNSPreciseTime &last_access)
void x_BlacklistedOp(void) const
TNSBitVector m_WaitAffinities
map< unsigned int, CNSPreciseTime > m_BlacklistLimits
CNSPreciseTime * m_BlacklistTimeout
void x_UpdateBlacklist(void) const
void GCBlacklist(const CJobStatusTracker &tracker, const vector< TJobStatus > &match_states)
unsigned short m_WaitPort
size_t m_WaitAffinitiesOpCount
TNSBitVector m_BlacklistedJobs
const TNSBitVector & GetBlacklistedJobsRef(void) const
TNSBitVector m_PrefAffinities
void UpdateBlacklist(unsigned int job_id) const
void x_JobsOp(void) const
bool ClearPreferredAffinities(void)
void RegisterJob(unsigned int job_id)
void x_PrefAffinitiesOp(void) const
void ClearWaitAffinities(void)
size_t m_BlacklistedJobsOpCount
void x_WaitAffinitiesOp(void) const
bool AddPreferredAffinity(unsigned int aff)
size_t m_PrefAffinitiesOpCount
bool MoveJobToBlacklist(unsigned int job_id)
string GetBlacklistLimit(unsigned int job_id) const
bool IsRequestedAffinity(const TNSBitVector &aff, bool use_preferred) const
void UnregisterGivenJob(unsigned int job_id)
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