(event < eSubmit || event >
eReread)
115last_update = last_touch;
119 returnlast_update + job_run_timeout;
120 returnlast_update + queue_run_timeout;
125 returnlast_update + job_read_timeout;
126 returnlast_update + queue_read_timeout;
133regular_expiration = last_update + job_timeout;
135queue_pending_timeout;
137 if(regular_expiration < pending_expiration)
138 returnregular_expiration;
139 returnpending_expiration;
143 returnlast_update + job_timeout;
144 returnlast_update + queue_timeout;
161m_SubmNotifTimeout(),
162m_ListenerNotifAddress(0),
163m_ListenerNotifPort(0),
164m_ListenerNotifAbsTime(),
171m_NeedSubmProgressMsgNotif(
false),
172m_NeedLsnrProgressMsgNotif(
false),
173m_NeedStolenNotif(
false)
184m_SubmNotifPort(request.port),
185m_SubmNotifTimeout(request.timeout, 0),
186m_ListenerNotifAddress(0),
187m_ListenerNotifPort(0),
188m_ListenerNotifAbsTime(),
193m_Mask(request.job_mask),
197m_NeedSubmProgressMsgNotif(request.need_progress_msg),
198m_NeedLsnrProgressMsgNotif(
false),
199m_NeedStolenNotif(
false)
262vector<string> parts;
265 if(parts.size() < 2)
317timeout = queue_timeout;
319run_timeout = queue_run_timeout;
321read_timeout = queue_read_timeout;
338 if(dump_fields &
eId)
340 if(dump_fields &
eKey)
368 if(dump_fields &
eGroup)
370 if(dump_fields &
eMask)
372 if(dump_fields &
eInput)
396 static stringprefix =
"OK:id: ";
398.append(to_string(
m_Id))
404 static stringprefix =
"OK:key: ";
412 static stringprefix =
"OK:status: ";
420 static stringprefix =
"OK:last_touch: ";
429 string&
dump)
const 431 static stringprefix =
"OK:erase_time: ";
432 static stringna_prefix = prefix +
"n/a (timeout: ";
433 static stringtimeout_suffix =
" (timeout: ";
434 static stringpostfix =
" sec)"+
kNewLine;
435 static stringpending_suffix =
" sec, pending timeout: ";
437 dump.append(na_prefix)
439.append(pending_suffix)
445.append(timeout_suffix)
447.append(pending_suffix)
454 string&
dump)
const 456 static stringprefix =
"OK:run_expiration: ";
457 static stringna_prefix = prefix +
"n/a (timeout: ";
458 static stringsuffix =
" (timeout: ";
459 static stringpostfix =
" sec)"+
kNewLine;
467 dump.append(na_prefix)
474 string&
dump)
const 476 static stringprefix =
"OK:read_expiration: ";
477 static stringna_prefix = prefix +
"n/a (timeout: ";
478 static stringsuffix =
" (timeout: ";
479 static stringpostfix =
" sec)"+
kNewLine;
487 dump.append(na_prefix)
494 static stringprefix =
"OK:subm_notif_port: ";
495 static stringna_reply = prefix +
"n/a"+
kNewLine;
501 dump.append(na_reply);
506 static stringprefix =
"OK:subm_notif_expiration: ";
507 static stringsuffix =
" (timeout: ";
508 static stringpostfix =
" sec)"+
kNewLine;
509 static stringna_reply = prefix +
"n/a"+
kNewLine;
517 dump.append(na_reply);
522 static stringprefix =
"OK:listener_notif: ";
523 static stringna_reply = prefix +
"n/a"+
kNewLine;
524 static stringcolon =
":";
526 dump.append(na_reply);
537 static stringprefix =
"OK:listener_notif_expiration: ";
538 static stringna_reply = prefix +
"n/a"+
kNewLine;
544 dump.append(na_reply);
549 static stringprefix =
"OK:event";
550 static string client=
": client=";
551 static stringns =
"ns";
552 static string event=
" event=";
553 static stringstatus =
" status=";
554 static stringret_code =
" ret_code=";
555 static stringtimestamp =
" timestamp=";
556 static stringna =
"n/a ";
557 static stringnode =
"' node='";
558 static stringsession =
"' session='";
559 static stringerr_msg =
"' err_msg=";
562 for(
const auto& ev :
m_Events) {
563 unsigned int addr= ev.GetNodeAddr();
566.append(to_string(event_no))
578.append(to_string(ev.GetRetCode()))
585 dump.append(1,
'\'')
588.append(ev.GetClientNode())
590.append(ev.GetClientSession())
592.append(ev.GetQuotedErrorMsg())
600 static stringprefix =
"OK:run_counter: ";
608 static stringprefix =
"OK:read_counter: ";
615 string&
dump)
const 617 static stringprefix =
"OK:affinity: ";
618 static stringna_reply = prefix +
"n/a"+
kNewLine;
619 static stringopen_paren =
" ('";
620 static stringclose_paren =
"')";
629 dump.append(na_reply);
633 string&
dump)
const 635 static stringprefix =
"OK:group: ";
636 static stringna_reply = prefix +
"n/a"+
kNewLine;
637 static stringopen_paren =
" ('";
638 static stringclose_paren =
"')";
647 dump.append(na_reply);
652 static stringprefix =
"OK:mask: ";
654.append(to_string(
m_Mask))
660 static stringprefix =
"OK:input: '";
669 static stringprefix =
"OK:output: '";
678 static stringprefix =
"OK:progress_msg: '";
687 static stringprefix =
"OK:remote_client_sid: ";
695 static stringprefix =
"OK:remote_client_ip: ";
703 static stringprefix =
"OK:ncbi_phid: ";
711 static stringprefix =
"OK:need_subm_progress_msg_notif: ";
719 static stringprefix =
"OK:need_lsnr_progress_msg_notif: ";
727 static stringprefix =
"OK:need_stolen_notif: ";
746 "inconsistency in the job history. " 747 "No reading status found or no event before reading.");
748 return m_Events[index].GetStatus();
795}
catch(
constexception & ex) {
796 throwruntime_error(
"Writing error while dumping a job properties: "+
801 for(vector<CJobEvent>::const_iterator it =
m_Events.begin();
806events_dump.
event=
int(event.m_Event);
807events_dump.
status=
int(event.m_Status);
808events_dump.
timestamp= (double)event.m_Timestamp;
809events_dump.
node_addr= event.m_NodeAddr;
810events_dump.
ret_code= event.m_RetCode;
816events_dump.
Write(jobs_file, event.m_ClientNode.data(),
817 event.m_ClientSession.data(),
818 event.m_ErrorMsg.data());
819}
catch(
constexception & ex) {
820 throwruntime_error(
"Writing error while dumping a job events: "+
833}
catch(
constexception & ex) {
834 throwruntime_error(
"Writing error while dumping a job " 835 "input/output: "+
string(ex.what()));
852progress_msg_buf) == 1)
893 if(event_dump.
Read(jobs_file,
895client_node_buf, client_session_buf,
897 throwruntime_error(
"Unexpected end of the dump file. " 898 "Cannot read expected job events.");
905 event.m_NodeAddr = event_dump.
node_addr;
906 event.m_RetCode = event_dump.
ret_code;
907 event.m_ClientNode.clear();
909 event.m_ClientNode =
string(client_node_buf,
911 event.m_ClientSession.clear();
913 event.m_ClientSession =
string(client_session_buf,
915 event.m_ErrorMsg.clear();
917 event.m_ErrorMsg =
string(err_msg_buf,
928input_buf, output_buf) != 0)
929 throwruntime_error(
"Unexpected end of the dump file. " 930 "Cannot read expected job input/output.");
static std::string EventToString(EJobEvent event)
const string & GetErrorMsg() const
TJobStatus GetStatusBeforeReading(void) const
void x_AppendRunCounter(string &dump) const
void x_AppendReadExpiration(const CNSPreciseTime &read_timeout, const CNSPreciseTime &exp_time, string &dump) const
void x_AppendEraseTime(const CNSPreciseTime &timeout, const CNSPreciseTime &pending_timeout, const CNSPreciseTime &exp_time, string &dump) const
void x_AppendOutput(string &dump) const
void x_AppendRemoteClientIP(string &dump) const
void SetNCBIPHID(const string &ncbi_phid)
CNSPreciseTime m_SubmNotifTimeout
CNSPreciseTime m_ReadTimeout
void SetClientIP(const string &client_ip)
bool ShouldNotifyListener(const CNSPreciseTime ¤t_time) const
void Dump(FILE *jobs_file) const
CNSPreciseTime GetLastEventTime(void) const
void x_AppendMask(string &dump) const
EAuthTokenCompareResult CompareAuthToken(const string &auth_token) const
void SetOutput(const string &output)
bool m_NeedLsnrProgressMsgNotif
void x_AppendNcbiPhid(string &dump) const
void x_AppendNeedSubmitProgressMsgNotif(string &dump) const
void x_AppendId(string &dump) const
void x_AppendListenerNotifExpiration(string &dump) const
CNSPreciseTime m_ListenerNotifAbsTime
void x_AppendSubmitNotifExpiration(string &dump) const
void x_AppendEvents(string &dump) const
const CJobEvent * GetLastEvent() const
void x_AppendProgressMsg(string &dump) const
string Print(TDumpFields dump_fields, const CQueue &queue, const CNSAffinityRegistry &aff_registry, const CNSGroupsRegistry &group_registry) const
unsigned short m_SubmNotifPort
TJobStatus GetStatus() const
unsigned short m_ListenerNotifPort
CJobEvent & AppendEvent()
void x_AppendNeedListenerProgressMsgNotif(string &dump) const
bool m_NeedSubmProgressMsgNotif
void x_AppendLastTouch(string &dump) const
void x_AppendRunExpiration(const CNSPreciseTime &run_timeout, const CNSPreciseTime &exp_time, string &dump) const
void x_AppendNeedStolenNotif(string &dump) const
void SetInput(const string &input)
vector< CJobEvent > m_Events
bool ShouldNotifySubmitter(const CNSPreciseTime ¤t_time) const
void x_AppendReadCounter(string &dump) const
string GetErrorMsg() const
CNSPreciseTime m_LastTouch
void x_AppendRemoteClientSID(string &dump) const
CNSPreciseTime GetExpirationTime(const CNSPreciseTime &queue_timeout, const CNSPreciseTime &queue_run_timeout, const CNSPreciseTime &queue_read_timeout, const CNSPreciseTime &queue_pending_timeout, const CNSPreciseTime &event_time) const
void x_AppendGroup(const CNSGroupsRegistry &group_registry, string &dump) const
void SetClientSID(const string &client_sid)
void x_AppendStatus(string &dump) const
void x_AppendSubmitNotifPort(string &dump) const
unsigned int m_ListenerNotifAddress
void x_AppendKey(const CQueue &queue, string &dump) const
void x_AppendInput(string &dump) const
CNSPreciseTime m_RunTimeout
void x_AppendAffinity(const CNSAffinityRegistry &aff_registry, string &dump) const
void x_AppendListenerNotif(string &dump) const
bool LoadFromDump(FILE *jobs_file, char *input_buf, char *output_buf, const SJobDumpHeader &header)
string GetTokenByID(unsigned int aff_id) const
unsigned int ResolveGroup(const string &group)
Client API for NCBI NetSchedule server.
NetSchedule internal exception.
string MakeJobKey(unsigned int job_id) const
CNSPreciseTime GetTimeout() const
CNSPreciseTime GetReadTimeout() const
CNSPreciseTime GetPendingTimeout() const
CNSPreciseTime GetRunTimeout() const
static SQLCHAR output[256]
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
EJobStatus
Job status codes.
static string StatusToString(EJobStatus status)
Printable status type.
@ eReading
Job has its output been reading.
@ eRunning
Running on a worker node.
@ ePending
Waiting for execution.
#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 list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static size_t StringToSizet(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to size_t.
static const string BoolToString(bool value)
Convert bool to string.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
unsigned int
A callback function used to compare two keys in a database.
static string s_EventAsString[]
CNSPreciseTime GetJobExpirationTime(const CNSPreciseTime &last_touch, TJobStatus status, const CNSPreciseTime &job_submit_time, const CNSPreciseTime &job_timeout, const CNSPreciseTime &job_run_timeout, const CNSPreciseTime &job_read_timeout, const CNSPreciseTime &queue_timeout, const CNSPreciseTime &queue_run_timeout, const CNSPreciseTime &queue_read_timeout, const CNSPreciseTime &queue_pending_timeout, const CNSPreciseTime &event_time)
const unsigned int kNetScheduleMaxDBDataSize
const unsigned int kNetScheduleMaxDBErrSize
@ eListenerNotifExpiration
@ eNeedSubmitProgressMsgNotif
@ eNeedListenerProgressMsgNotif
const CNSPreciseTime kTimeZero
string NS_FormatPreciseTimeAsSec(const CNSPreciseTime &t)
string NS_FormatPreciseTime(const CNSPreciseTime &t)
const unsigned kMaxHitIdSize
const unsigned kMaxWorkerNodeIdSize
const unsigned kMaxSessionIdSize
static string kNewLine("\n")
const unsigned kMaxClientIpSize
CNetScheduleAPI::EJobStatus TJobStatus
static CNamedPipeClient * client
void Write(FILE *f, const char *progress_msg)
bool need_lsnr_progress_msg_notif
Uint4 listener_notif_addr
bool need_subm_progress_msg_notif
double subm_notif_timeout
char client_sid[kMaxSessionIdSize]
double listener_notif_abstime
int Read(FILE *f, size_t fixed_size_from_header, char *progress_msg)
char client_ip[kMaxClientIpSize]
Uint4 listener_notif_port
char ncbi_phid[kMaxHitIdSize]
void Write(FILE *f, const char *client_node, const char *client_session, const char *err_msg)
Uint4 client_session_size
int Read(FILE *f, size_t fixed_size_from_header, char *client_node, char *client_session, char *err_msg)
int Read(FILE *f, size_t fixed_size_from_header, char *input, char *output)
void Write(FILE *f, const char *input, const char *output)
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