{
"affinity_may_change",
350{
"affinity_may_change",
594((
string*)
data)->append((
const char*) ptr,
size);
615m_ProcessMessage(
NULL),
619m_WithinBatchSubmit(
false),
620m_SingleCmdParser(sm_CommandMap),
621m_BatchHeaderParser(sm_BatchHeaderMap),
622m_BatchEndParser(sm_BatchEndMap),
623m_ClientIdentificationPrinted(
false),
624m_RollbackAction(
NULL)
708(read_count > 0 || write_count > 0)) {
716 ERR_POST(
"Unseccessfull client socket shutdown. " 717 "The socket may have data not delivered to the client. " 718 "Error code: "<< status <<
": "<<
IO_StatusStr(status));
746 ERR_POST(
"eCommunicationError:Connection pool full");
749 ERR_POST(
"eCommunicationError:Unpollable connection");
752 ERR_POST(
"eCommunicationError:Request queue full");
755 ERR_POST(
"eCommunicationError:Unknown overflow error");
767 ERR_POST(
"NetSchedule is shutting down. Client input rejected.");
770 "is shutting down. Session aborted."+
777 stringerror_client_message;
819 catch(
constexception & ex) {
821error_client_message =
"ERR:"+
823 "error - "+
string(ex.
what()));
827 ERR_POST(
"ERR:Unknown server exception.");
828error_client_message =
"ERR:eInternalError:Unknown server exception.";
852setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &
val,
sizeof(
val));
860 size_trequired_size)
872 #if defined(_DEBUG) && !defined(NDEBUG) 880nanosleep(&delay,
NULL);
897msg_size =
value.size();
898 while(msg_size >= 1 &&
msg[msg_size-1] ==
'\n')
900required_size = msg_size + 1;
922 size_tmsg_size =
msg.size();
923 boolhas_eom =
false;
925 while(msg_size >= 1 &&
msg[msg_size-1] ==
'\n') {
930 size_trequired_size = msg_size + 1;
931 const char* msg_buf =
NULL;
934msg_buf =
msg.data();
947 #if defined(_DEBUG) && !defined(NDEBUG) 970 size_twritten_bytes,
976 "Error writing message to the client. " 978 "Socket write error status: "+
IO_StatusStr(write_result) +
". " 979 "Written bytes: "+ to_string(written_bytes) +
". " 980 "Socket write timing: "+ to_string(
double(timing)) +
". " 981 "Message begins with: ";
982 if(
msg.size() > 32)
983report +=
msg.substr(0, 32) +
" (TRUNCATED)";
1011 unsigned intpeer_addr;
1056 string msg=
"Error authenticating client: '";
1090 for(
const auto& param : params) {
1091 if(param.first ==
"status") {
1092diag_extra.
Print(
"job_status", param.second);
1094diag_extra.
Print(param.first, param.second);
1195 boolrestore_client =
false;
1197 unsigned intorig_client_id = 0;
1212restore_client =
true;
1220 "Job queue is required");
1239 boolclient_was_found =
false;
1240 boolsession_was_reset =
false;
1242 boolhad_wn_pref_affs =
false;
1243 boolhad_reader_pref_affs =
false;
1247session_was_reset, old_session,
1248had_wn_pref_affs, had_reader_pref_affs);
1249 if(client_was_found && session_was_reset) {
1251 stringwn_val =
"true";
1252 if(!had_wn_pref_affs)
1253wn_val =
"had none";
1254 stringreader_val =
"true";
1255 if(!had_reader_pref_affs)
1256reader_val =
"had none";
1261.
Print(
"client_old_session", old_session)
1262.
Print(
"wn_preferred_affinities_reset", wn_val)
1263.
Print(
"reader_preferred_affinities_reset", reader_val);
1273 if(restore_client) {
1320 if(!size_str.
empty())
1335 ERR_POST(
"Server error: "<< ex);
1347 ERR_POST(
"Error processing command: "<< ex);
1359 ERR_POST(
"Unknown error while expecting BTCH or ENDS");
1407 ERR_POST(
"Error processing command: "<< ex);
1410 "Invalid batch submission, syntax error"+
1421 ERR_POST(
"Arguments parsing unknown exception. " 1422 "Batch submit is rejected.");
1425 "Arguments parsing unknown exception"+
1480 ERR_POST(
"Error processing command: "<< ex);
1483 "Batch submit error - unexpected end of batch"+
1494 ERR_POST(
"Unknown error while expecting ENDB.");
1497 "Unknown error while expecting ENDB."+
1513 ctx->SetRequestID();
1516.Print(
"_type",
"cmd")
1520.Print(
"cmd",
"BTCH")
1537.
Print(
"start_job", job_id)
1538.
Print(
"commit_time",
1541.
Print(
"transaction_time",
1556SetRequestStatus(ex.ErrCodeToHTTPStatusCode());
1602<<
" for unknown job: " 1615reply.reserve(1024);
1617reply.append(
"OK:job_status=")
1619.append(
"&job_exptime=")
1620.append(to_string(lifetime.
Sec()));
1623reply.append(
"&pause=pullback");
1625reply.append(
"&pause=nopullback");
1628reply.append(
"&msg=")
1649 stringprogress_msg;
1651client_ip, client_sid,
1652client_phid, progress_msg,
1658<<
" for unknown job: " 1672reply.reserve(1024);
1673reply.append(
"OK:job_status=")
1675.append(
"&job_exptime=")
1676.append(to_string(lifetime.
Sec()));
1679reply.append(
"&pause=pullback");
1681reply.append(
"&pause=nopullback");
1684reply.append(
"&msg=")
1706<<
" with neither add list nor del list");
1713list<string> aff_to_add_list;
1714list<string> aff_to_del_list;
1717 "\t,", aff_to_add_list);
1719 "\t,", aff_to_del_list);
1727 for(list<string>::const_iterator k = aff_to_add_list.begin();
1728k != aff_to_add_list.end(); ++k) {
1729 if(find(aff_to_del_list.begin(), aff_to_del_list.end(), *k) !=
1730aff_to_del_list.end()) {
1733 " is in both add and del lists"+
1758 for(list<string>::const_iterator k = msgs.begin();
1759k != msgs.end(); ++k)
1760 msg+=
"WARNING:"+ *k +
";";
1777list<string> aff_to_set;
1779 "\t,", aff_to_set);
1928 "Neither job key nor a group nor an " 1929 "affinity nor a status list is provided " 1930 "for the CANCEL command");
1933 "Job key or any combination of a group and an affinity " 1945 "CANCEL can accept either a job " 1946 "key or any combination of a group " 1947 "and an affinity and job statuses");
1949 x_WriteMessage(
"ERR:eInvalidParameter:CANCEL can accept either a job " 1950 "key or any combination of a group and an affinity and " 1964vector<string> warnings;
1965vector<TJobStatus> statuses;
1968 boolreported =
false;
1969vector<TJobStatus>::iterator k =
1974warnings.push_back(
"eInvalidJobStatus:unknown job " 1975 "status in the status list");
1978 "Unknown job status in the status list. " 1979 "Ignore and continue.");
1992k = statuses.begin();
1993 while(k != statuses.end()) {
1995warnings.push_back(
"eIgnoringCanceledStatus:attempt to " 1996 "cancel jobs in the 'Canceled' status");
1999 "Attempt to cancel jobs in the 'Canceled' " 2000 "status. Ignore and continue.");
2014 if(warnings.empty())
2018 for(vector<string>::const_iterator k = warnings.begin();
2019k != warnings.end(); ++k) {
2020 msg+=
"WARNING:"+ *k +
";";
2037 "CANCEL for unknown job: "<<
2066<<
" for unknown job: " 2081reply.reserve(2048);
2084 stringpause_status_msg;
2088pause_status_msg =
"&pause=pullback";
2090pause_status_msg =
"&pause=nopullback";
2092 stringprogress_msg_part;
2094progress_msg_part.append(
"&msg=")
2097reply.append(
"OK:")
2098.append(
"job_status=")
2100.append(
"&client_ip=")
2102.append(
"&client_sid=")
2104.append(
"&ncbi_phid=")
2106.append(
"&job_exptime=")
2107.append(to_string(lifetime.
Sec()))
2108.append(
"&ret_code=")
2110.append(
"&output=")
2112.append(
"&err_msg=")
2114.append(
"&input=")
2116.append(pause_status_msg)
2117.append(progress_msg_part)
2120reply.append(
"OK:")
2121.append(to_string((
int) job.
GetStatus()))
2170 stringpause_status_str;
2173pause_status_str =
"pullback";
2175pause_status_str =
"nopullback";
2184.
Print(
"reason",
2185 "pause: "+ pause_status_str);
2192list<string> aff_list;
2195list<string> group_list;
2197 "\t,", group_list);
2200 stringadded_pref_aff;
2214added_pref_aff) ==
false) {
2223 if(!added_pref_aff.empty()) {
2227.
Print(
"added_preferred_affinity", added_pref_aff);
2232.
Print(
"added_preferred_affinity", added_pref_aff);
2289 ERR_POST(
Warning<<
"Accepting results for a job in the FAILED state.");
2298<<
" results. The job has already been done.");
2308<<
" results. The job is unknown");
2318<<
" results; job is in " 2323 "Cannot accept job results; job is in "+
2355<<
" results. The job is unknown");
2358 ERR_POST(
Warning<<
"Accepting results for a job in the FAILED state.");
2365<<
" results. The job has already been done.");
2382 stringpause_status_str;
2385pause_status_str =
"pullback";
2387pause_status_str =
"nopullback";
2390.
Print(
"reason",
2391 "pause: "+ pause_status_str);
2397list<string> aff_list;
2401 stringadded_pref_aff;
2415added_pref_aff) ==
false) {
2421 if(added_pref_aff.empty() ==
false) {
2425.
Print(
"added_preferred_affinity", added_pref_aff);
2430.
Print(
"added_preferred_affinity", added_pref_aff);
2471<<
"MGET for unknown job " 2515 x_WriteMessage(
"OK:WARNING:eJobAlreadyFailed:Already failed;"+
2529 x_WriteMessage(
"ERR:eInvalidJobStatus:Cannot fail job; job is in "+
2538 if(warning.empty())
2583warning, return_option);
2586 if(warning.empty())
2610 x_WriteMessage(
"ERR:eInvalidJobStatus:Cannot return job; job is in "+
2625 boolauth_token_ok =
true;
2645 if(!auth_token_ok) {
2675 x_WriteMessage(
"ERR:eInvalidJobStatus:Cannot reschedule job; job is in "+
2712 x_WriteMessage(
"ERR:eInvalidJobStatus:Cannot redo job; job is in "+
2729<<
" in JDEX for job " 2776<<
" in JDREX for job " 2821 size_tlast_event_index = 0;
2839 stringprogress_msg_part;
2841progress_msg_part =
"&msg="+
2846 "&last_event_index="+
2847to_string(last_event_index) +
2863 if(!what.empty() && what !=
"QCLASSES"&& what !=
"QUEUES"&&
2864what !=
"JOBS"&& what !=
"ALL"&& what !=
"CLIENTS"&&
2865what !=
"NOTIFICATIONS"&& what !=
"AFFINITIES"&&
2866what !=
"GROUPS"&& what !=
"WNODE"&& what !=
"SERVICES"&&
2867what !=
"ALERTS"&& what !=
"SCOPES") {
2869 "Unsupported '"+ what +
2870 "' parameter for the STAT command.");
2873 if(q ==
NULL&& (what ==
"CLIENTS"|| what ==
"NOTIFICATIONS"||
2874what ==
"AFFINITIES"|| what ==
"GROUPS"||
2875what ==
"WNODE"|| what ==
"SCOPES")) {
2877 "STAT "+ what +
" requires a queue");
2883 if(what ==
"QCLASSES") {
2886 if(!
info.empty())
2893 if(what ==
"QUEUES") {
2896 if(!
info.empty())
2903 if(what ==
"SERVICES") {
2908k != services.
end(); ++k) {
2911 output+= k->first +
"="+ k->second;
2917 if(what ==
"ALERTS") {
2928 if(what ==
"JOBS")
2935 info+=
"OK:SubmitsDisabledEffective: ";
2940 info+=
"OK:DrainedShutdown: ";
2956 if(!what.empty() && what !=
"ALL") {
2962 string info=
"OK:Started: "+
2965 info+=
"OK:SubmitsDisabledEffective: ";
2970 info+=
"OK:SubmitsDisabledPrivate: ";
2982 if(what ==
"ALL") {
2986 " bit_blk="+ to_string(bv_stat.
bit_blocks) +
2987 "; gap_blk="+ to_string(bv_stat.
gap_blocks) +
2988 "; mem_used="+ to_string(bv_stat.
memory_used) +
3009 "to execute RECO");
3011 "Access denied: admin privileges required");
3024vector<string> config_warnings;
3025 booladmin_decrypt_error(
false);
3028 if(!config_warnings.empty()) {
3031 for(vector<string>::const_iterator k = config_warnings.begin();
3032k != config_warnings.end(); ++k) {
3034 if(!
msg.empty()) {
3044 msg=
"ERR:eInvalidParameter:Configuration file is not " 3045 "well formed. "+
msg;
3046 if(
msg.size() > 1024) {
3048 msg+=
" TRUNCATED";
3057vector<string> config_checksum_warnings;
3060 if(config_checksum_warnings.empty()) {
3064 for(vector<string>::const_iterator
3065k = config_checksum_warnings.begin();
3066k != config_checksum_warnings.end(); ++k)
3081 if(what_changed.
GetSize() == 0 &&
3083services_changed.
GetSize() == 0) {
3088 x_WriteMessage(
"OK:WARNING:eNoParametersChanged:No changes in " 3089 "changeable parameters were identified in the new " 3097diff.
SetByKey(k.GetKey(), k.GetNode());
3099diff.
SetByKey(k.GetKey(), k.GetNode());
3101 stringdiff_as_string = diff.
Repr();
3110 x_WriteMessage(
"OK:WARNING:eConfigFileNotChanged:Configuration " 3111 "file has not been changed, RECO ignored;"+
3135 "parameters or any combination of a group and " 3136 "an affinity and job statuses");
3138 x_WriteMessage(
"ERR:eInvalidParameter:DUMP can accept either a job " 3139 "key or no parameters or any combination of a group and " 3148 boolreported =
false;
3149vector<TJobStatus>::iterator k =
3156 "Unknown job status in the status list. " 3157 "Ignore and continue.");
3166vector<string> warnings;
3175statuses.size() == 0)
3198 if(job_info.empty()) {
3220 x_WriteMessage(
"OK:WARNING:eAlreadyDrainShutdown:The server is " 3221 "already in drain shutdown state;"+
3243 stringconfiguration;
3263configuration =
string(converter);
3274 static stringreply =
3299 boolmem_used_result =
3302 intproc_fd_soft_limit;
3303 intproc_fd_hard_limit;
3305&proc_fd_soft_limit,
3306&proc_fd_hard_limit);
3309 #if defined(_DEBUG) && !defined(NDEBUG) 3314 if(err_emul.
as_int>= 0)
3315proc_fd_used = err_emul.
as_int;
3319 if(err_emul.
as_int>= 0)
3335 if(process_time_result)
3336reply +=
"&user_time="+ to_string(user_time) +
3337 "&system_time="+ to_string(system_time) +
3338 "&real_time="+ to_string(real_time);
3340reply +=
"&user_time=n/a&system_time=n/a&real_time=n/a";
3342 if(physical_memory > 0)
3343reply +=
"&physical_memory="+ to_string(physical_memory);
3345reply +=
"&physical_memory=n/a";
3347 if(mem_used_result)
3348reply +=
"&mem_used_total="+ to_string(mem_used.
total) +
3349 "&mem_used_total_peak="+ to_string(mem_used.
total_peak) +
3350 "&mem_used_resident="+ to_string(mem_used.
resident) +
3351 "&mem_used_resident_peak="+ to_string(mem_used.
resident_peak) +
3352 "&mem_used_shared="+ to_string(mem_used.
shared) +
3353 "&mem_used_data="+ to_string(mem_used.
data) +
3354 "&mem_used_stack="+ to_string(mem_used.
stack) +
3355 "&mem_used_text="+ to_string(mem_used.
text) +
3356 "&mem_used_lib="+ to_string(mem_used.
lib) +
3357 "&mem_used_swap="+ to_string(mem_used.
swap);
3359reply +=
"&mem_used_total=n/a" 3360 "&mem_used_total_peak=n/a" 3361 "&mem_used_resident=n/a" 3362 "&mem_used_resident_peak=n/a" 3363 "&mem_used_shared=n/a" 3364 "&mem_used_data=n/a" 3365 "&mem_used_stack=n/a" 3366 "&mem_used_text=n/a" 3368 "&mem_used_swap=n/a";
3370 if(proc_fd_soft_limit >= 0)
3371reply +=
"&proc_fd_soft_limit="+ to_string(proc_fd_soft_limit);
3373reply +=
"&proc_fd_soft_limit=n/a";
3375 if(proc_fd_hard_limit >= 0)
3376reply +=
"&proc_fd_hard_limit="+ to_string(proc_fd_hard_limit);
3378reply +=
"&proc_fd_hard_limit=n/a";
3380 if(proc_fd_used >= 0)
3381reply +=
"&proc_fd_used="+ to_string(proc_fd_used);
3383reply +=
"&proc_fd_used=n/a";
3385 if(proc_thread_count >= 1)
3386reply +=
"&proc_thread_count="+ to_string(proc_thread_count);
3388reply +=
"&proc_thread_count=n/a";
3391 if(!alerts.empty())
3392reply +=
"&"+ alerts;
3401 size_targs_size = arguments.
Size();
3402 stringcmdline_args;
3403 for(
size_tindex = 0; index < args_size; ++index) {
3405cmdline_args +=
" ";
3406cmdline_args += arguments[index];
3426 x_WriteMessage(
"OK:WARNING:eAlertAlreadyAcknowledged:Alert has " 3483 if(qname.empty()) {
3498 stringlinked_sections_part;
3502vector<string> warnings;
3507jobs_per_state, warnings);
3511jobs_part.append(1,
'&')
3514.append(to_string(jobs_per_state[index]));
3515total += jobs_per_state[index];
3517jobs_part.append(
"&Total=")
3518.append(to_string(total));
3521k = linked_sections.
begin(); k != linked_sections.end(); ++k) {
3522 stringprefix((k->first).c_str() + strlen(
"linked_section_"));
3524j != k->second.end(); ++j) {
3525linked_sections_part.append(1,
'&')
3535qname_part.append(
"queue_name=")
3547params.
qclass+
"\t\""+
3598 boolclient_was_found =
false;
3599 boolsession_was_reset =
false;
3601 boolhad_wn_pref_affs =
false;
3602 boolhad_reader_pref_affs =
false;
3605session_was_reset, old_session,
3607had_reader_pref_affs);
3608 if(client_was_found && session_was_reset) {
3610 stringwn_val =
"true";
3611 if(!had_wn_pref_affs)
3612wn_val =
"had none";
3613 stringreader_val =
"true";
3614 if(!had_reader_pref_affs)
3615reader_val =
"had none";
3620.
Print(
"client_old_session", old_session)
3621.
Print(
"wn_preferred_affinities_reset", wn_val)
3622.
Print(
"reader_preferred_affinities_reset", reader_val);
3642 if(used_slots >= max_slots) {
3643 ERR_POST(
"All scope slots are in use");
3645 x_WriteMessage(
"ERR:eInternalError:All scope slots are in use"+
3661 unsigned intmax_input_size;
3662 unsigned intmax_output_size;
3670 string result(
"OK:max_input_size="+
3671to_string(max_input_size) +
"&"+
3672 "max_output_size="+
3673to_string(max_output_size));
3676k = linked_sections.
begin(); k != linked_sections.end(); ++k) {
3677 stringprefix((k->first).c_str() + strlen(
"linked_section_"));
3679j != k->second.end(); ++j) {
3680 result+=
"&"+ prefix +
"::"+
3687 x_WriteMessage(
"OK:max_input_size="+ to_string(max_input_size) +
";" 3688 "max_output_size="+ to_string(max_output_size) +
";"+
3698 stringconfiguration;
3701configuration +=
"OK:"+ it->first +
'='+ it->second +
kEndOfResponse;
3728 boolno_more_jobs =
true;
3729 stringadded_pref_aff;
3731list<string> aff_list;
3733list<string> group_list;
3750added_pref_aff) ==
false) {
3756 unsigned intjob_id = job.
GetId();
3776 if(!added_pref_aff.empty()) {
3780.
Print(
"added_preferred_affinity", added_pref_aff);
3785.
Print(
"added_preferred_affinity", added_pref_aff);
3799.
Print(
"no_more_jobs", no_more_jobs);
3865 boolno_op =
false;
3890 x_WriteMessage(
"ERR:eInvalidJobStatus:Cannot reread job; job is in "+
3896<<
"; job has not been read yet");
3897 x_WriteMessage(
"OK:WARNING:eJobNotRead:The job has not been read yet;"+
3929<<
" read job; job is in " 3950 if(data_size > limit) {
3953<<
" bytes. Received " 3957 x_WriteMessage(
"ERR:eInvalidParameter:Client data is too long. " 3958 "It must be <= "+ to_string(limit) +
3959 " bytes. Received "+ to_string(data_size) +
3965 x_WriteMessage(
"OK:version="+ to_string(current_data_version) +
3974 boolclient_found =
false;
3975 boolhad_wn_pref_affs =
false;
3976 boolhad_reader_pref_affs =
false;
3980old_session, had_wn_pref_affs, had_reader_pref_affs);
3984 stringwn_val =
"true";
3985 if(!had_wn_pref_affs)
3986wn_val =
"had none";
3987 stringreader_val =
"true";
3988 if(!had_reader_pref_affs)
3989reader_val =
"had none";
3994.
Print(
"client_old_session", old_session)
3995.
Print(
"wn_preferred_affinities_reset", wn_val)
3996.
Print(
"reader_preferred_affinities_reset", reader_val);
4019 "Server is in drained shutting down state"+
4040 x_WriteMessage(
"OK:WARNING:eSubmitsDisabledForServer:Submits are " 4063 stringreply =
"OK:WARNING:eQueueAlreadyPaused:The queue has " 4064 "already been paused (previous pullback value is ";
4066 elsereply +=
"false";
4067reply +=
", new pullback value is ";
4069 elsereply +=
"false";
4102 "Command is obsolete and will be ignored;"+
4112 "Anonymous client (no client_node and client_session" 4113 " at handshake) cannot "+ message);
4124 "Either both or neither of the port and " 4125 "timeout parameters must be 0");
4133 "Invalid authorization token. It cannot be empty.");
4145 "without preferred affinities and " 4146 "with any_aff flag set to false " 4147 "will never match any job.");
4152 "It is forbidden to have both any_affinity and " 4153 "exclusive_new_aff GET2 flags set to 1.");
4157 "It is forbidden to have both prioritized_aff and " 4158 "wnode_aff GET2 flags set to 1.");
4162 "It is forbidden to have both prioritized_aff and " 4163 "exclusive_new_aff GET2 flags set to 1.");
4167 "If the prioritized_aff GET2 flag set to 1 then " 4168 "a non empty list of explicit affinities must be provided.");
4179 ERR_POST(
Warning<<
"The job read request without explicit affinities, " 4180 "without preferred affinities and " 4181 "with any_aff flag set to false " 4182 "will never match any job.");
4187 "It is forbidden to have both any_aff and " 4188 "exclusive_new_aff READ2 flags set to 1.");
4192 "It is forbidden to have both prioritized_aff and " 4193 "reader_aff READ2 flags set to 1.");
4197 "It is forbidden to have both prioritized_aff and " 4198 "exclusive_new_aff READ2 flags set to 1.");
4202 "If the prioritized_aff READ2 flag set to 1 then " 4203 "a non empty list of explicit affinities must be provided.");
4213 "QINF2 command expects a queue name or a service name. " 4214 "Nothing has been provided.");
4219 "QINF2 command expects only one value: queue name or " 4220 "a service name. Both have been provided.");
4234 if(!is_worker_node_command) {
4236 if(it->first ==
"ip")
4238 else if(it->first ==
"sid")
4245.Print(
"_type",
"cmd")
4247.Print(
"cmd",
cmd.command->cmd)
4251 for(
const auto& param :
cmd.params) {
4253 if(param.first ==
"ip")
4256 if(param.first ==
"sid")
4259 if(param.first ==
"ncbi_phid")
4262 if(param.first ==
"status")
4263ctxt_extra.
Print(
"job_status", param.second);
4265ctxt_extra.
Print(param.first, param.second);
4267ctxt_extra.
Flush();
4284.Print(
"_type",
"cmd")
4286.Print(
"info",
msg)
4317 if(!job.
GetId()) {
4332 stringsubmitter_notif_info;
4335 if(host ==
"127.0.0.1") {
4338 if(host ==
"127.0.0.1") {
4340 "Could not detect the self host address " 4341 "to provide it to a worker node");
4344submitter_notif_info.append(
"&submitter_notif_host=")
4346.append(
"&submitter_notif_port=")
4350reply.reserve(1024);
4351reply.append(
"OK:job_key=")
4353.append(
"&input=")
4355.append(
"&affinity=")
4357.append(
"&client_ip=")
4359.append(
"&client_sid=")
4361.append(
"&ncbi_phid=")
4364.append(to_string(job.
GetMask()))
4365.append(
"&auth_token=")
4367.append(submitter_notif_info)
4379 " "+ to_string(job.
GetMask()) +
4468 const string& client_sid,
4469 const string& phid)
const 4513.Print(
"_type",
"conn")
4524 const string&
msg,
4525 const string& suffix)
4529 if(need_request_start) {
4536 ERR_POST(
"Error parsing command: "<<
msg+ suffix);
4538 ERR_POST(
"Error parsing command: "<<
4540 " (TRUNCATED)"+ suffix);
4544 stringclient_error =
"ERR:eProtocolSyntaxError:";
4546client_error +=
msg+ suffix;
4549 " (TRUNCATED)"+ suffix;
4558 const string& what,
4563vector<string> warnings;
4565 if(what ==
"CLIENTS") {
4568 else if(what ==
"NOTIFICATIONS") {
4571 else if(what ==
"AFFINITIES") {
4574 else if(what ==
"GROUPS") {
4577 else if(what ==
"SCOPES") {
4580 else if(what ==
"JOBS") {
4586 else if(what ==
"WNODE") {
4587warnings.push_back(
"eCommandObsolete:Command is obsolete, " 4588 "use STAT CLIENTS instead");
4592 for(vector<string>::const_iterator k = warnings.begin();
4593k != warnings.end(); ++k) {
4594 msg+=
"WARNING:"+ *k +
";";
4609 "max_connections=\""+
4619 "network_timeout=\""+
4623 "log_batch_each_job=\""+
4625 "log_notification_thread=\""+
4627 "log_cleaning_thread=\""+
4629 "log_execution_watcher_thread=\""+
4632 "log_statistics_thread=\""+
4634 "del_batch_size=\""+
4636 "markdel_batch_size=\""+
4638 "scan_batch_size=\""+
4640 "purge_timeout=\""+
4642 "stat_interval=\""+
4644 "job_counters_interval=\""+
4647 "max_client_data=\""+
4651 "admin_client_name=\""+
4653 "state_transition_perf_log_queues=\""+
4655 "state_transition_perf_log_classes=\""+
4660 "reserve_dump_space=\""+
4667 const string& section_name,
4670 if(values.
empty())
4673 stringret =
"["+ section_name +
"]\n";
4675k != values.
end(); ++k)
4676ret += k->first +
"=\""+ k->second +
"\"\n";
4699vector<string> & warnings)
const 4701vector<TJobStatus> no_duplicates;
4703 for(vector<TJobStatus>::const_iterator k = src.begin();
4704k != src.end(); ++k) {
4705 if(find(no_duplicates.begin(), no_duplicates.end(), *k) !=
4706no_duplicates.end()) {
4707warnings.push_back(
"eStatusDuplicates:job status "+
4709 " provided more than once");
4713 " provided more than once");
4715no_duplicates.push_back(*k);
4718 returnno_duplicates;
4747message.resize(message.size() - 1);
4749 if(!message.empty())
TJobStatus GetStatusBeforeReading(void) const
const string & GetClientSID() const
void SetNCBIPHID(const string &ncbi_phid)
void SetSubmNotifTimeout(const CNSPreciseTime &t)
unsigned GetSubmAddr() const
void SetClientIP(const string &client_ip)
unsigned short GetSubmNotifPort() const
const string & GetInput() const
const string & GetOutput() const
TJobStatus GetStatus() const
string GetAuthToken() const
void SetMask(unsigned mask)
void SetInput(const string &input)
string GetErrorMsg() const
const string & GetClientIP() const
unsigned GetAffinityId() const
const string & GetNCBIPHID() const
const string & GetProgressMsg() const
void SetClientSID(const string &client_sid)
void SetSubmNotifPort(unsigned short port)
Iterator for JSON arrays and objects.
size_t GetSize() const
For a container node (that is, either an array or an object), return the number of elements in the co...
string Repr(TReprFlags flags=0) const
Return a string representation of this 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 SetByKey(const string &key, CJsonNode::TInstance value)
For a JSON object node, insert a new element or update an existing element.
static CJsonNode NewObjectNode()
Create a new JSON object node.
void SetPassedChecks(TNSCommandChecks check)
void SetScope(const string &scope)
void ResetPassedCheck(void)
const string & GetClientName(void) const
unsigned int GetID(void) const
bool IsComplete(void) const
const string & GetProgramName(void) const
const string & GetSession(void) const
void SetID(unsigned int id)
const string & GetNode(void) const
void CheckAccess(TNSCommandChecks cmd_reqs, CNetScheduleServer *server, const string &cmd)
TNSCommandChecks GetPassedChecks(void) const
void Update(unsigned int peer_addr, const TNSProtoParams ¶ms)
unsigned int GetAddress(void) const
static CNSPreciseTime Current(void)
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
virtual void Rollback(CQueue *queue)=0
static CNcbiApplication * Instance(void)
Singleton method.
static void Reload(void)
Re-read key file locations and domain paths, reload encryption keys.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
string GetAsFromConfig(void) const
map< string, string > GetOrigDiagSection(void) const
map< string, string > GetOrigLogSection(void) const
NetSchedule internal exception.
void x_PrintGetJobResponse(const CQueue *q, const CJob &job, bool add_security_token)
void x_ProcessQueueInfo(CQueue *)
void x_ProcessCancelWaitGet(CQueue *)
void x_ProcessGetParam(CQueue *)
virtual void OnOpen(void)
Runs in response to an external event [asynchronous].
CNetScheduleHandler(CNetScheduleServer *server)
void x_ProcessFastStatusW(CQueue *)
void x_ProcessCancelWaitRead(CQueue *)
void x_ProcessReloadConfig(CQueue *)
void x_ProcessReadRollback(CQueue *)
CRef< CQueue > GetQueue(void)
void x_ProcessGetMessage(CQueue *)
@ eStatus_OK
Command is ok and execution is good.
@ eStatus_SubmitRefused
In refuse submits mode and received SUBMIT.
@ eStatus_SocketIOError
Error writing to socket.
@ eStatus_NotImplemented
Command is not implemented.
@ eStatus_HTTPProbe
Routine test from systems.
@ eStatus_Inactive
Connection was closed due to inactivity timeout.
@ eStatus_BadAuth
Bad authorization token.
@ eStatus_ServerError
Internal server error.
@ eStatus_NotFound
Job is not found.
@ eStatus_ShuttingDown
Server is shutting down.
@ eStatus_BadRequest
Command is incorrect.
@ eStatus_InvalidJobStatus
Invalid job status.
void x_OnCmdParserError(bool need_request_start, const string &msg, const string &suffix)
virtual void OnMessage(BUF buffer)
void x_ProcessPutFailure(CQueue *)
void x_ProcessDropQueue(CQueue *)
string x_GetConnRef(void) const
void x_HandleSocketErrorOnResponse(const string &msg, EIO_Status write_result, size_t written_bytes, const CNSPreciseTime &timing)
void x_ProcessQuitSession(CQueue *)
void x_ProcessMsgAuth(BUF buffer)
bool x_NeedToGeneratePHIDAndSID(FProcessor processor) const
void x_CheckAuthorizationToken(void)
void x_ProcessChangeAffinity(CQueue *)
TProtoParser m_BatchEndParser
void x_ProcessCancel(CQueue *)
void x_ProcessSetClientData(CQueue *)
void x_ProcessDump(CQueue *)
void x_ProcessReading(CQueue *)
void x_ProcessQList(CQueue *)
EIO_Status x_PrepareWriteBuffer(const string &msg, size_t msg_size, size_t required_size)
void x_FinalizeReadCommand(const string &command, TJobStatus status, const CJob &job)
CNSRollbackInterface * m_RollbackAction
bool x_CanBeWithoutQueue(FProcessor processor) const
static void x_MakeSureSingleEOR(string &message)
void x_ProcessMsgBatchSubmit(BUF buffer)
void x_ProcessRefuseSubmits(CQueue *)
TProtoParser m_BatchHeaderParser
static SCommandMap sm_BatchHeaderMap[]
void x_ProcessMsgBatchHeader(BUF buffer)
CStopWatch m_BatchStopWatch
void x_PrintCmdRequestStop(void)
string x_GetServerSection(void) const
void x_ProcessSubmitBatch(CQueue *)
void x_ProcessReadFailed(CQueue *)
void x_SetConnRequestStatus(unsigned int status)
void x_ProcessCancelQueue(CQueue *)
void x_CmdObsolete(CQueue *)
void x_ProcessGetConfiguration(CQueue *)
bool x_NeedCmdLogging(void) const
virtual void OnWrite(void)
The client is ready to receive data.
void x_ProcessJobDelayExpiration(CQueue *)
void x_ProcessGetConf(CQueue *)
CWeakRef< CQueue > m_QueueRef
void x_ClearRollbackAction(void)
void x_ProcessRedo(CQueue *)
unsigned int x_GetPeerAddress(void)
void x_ProcessConfirm(CQueue *)
void x_SetCmdRequestStatus(unsigned int status)
void x_ProcessDeleteDynamicQueue(CQueue *)
EIO_Status x_WriteMessage(const string &msg)
void x_UpdateClientPassedChecks(CQueue *q)
virtual void OnClose(IServer_ConnectionHandler::EClosePeer peer)
The connection has closed (with information on type of closing)
void x_ProcessAckAlert(CQueue *)
TProtoParser m_SingleCmdParser
void x_ProcessPause(CQueue *)
void x_ExecuteRollbackAction(CQueue *q)
void x_ProcessJobExchange(CQueue *)
void x_ProcessClearWorkerNode(CQueue *)
void x_ProcessCreateDynamicQueue(CQueue *)
virtual void OnTimeout(void)
Runs when a client has been idle for too long, prior to closing the connection [synchronous].
void x_CheckReadParameters(void)
string x_GetLogSection(void) const
void x_LogCommandWithJob(const CJob &job) const
void x_CmdNotImplemented(CQueue *)
void x_CreateConnContext(void)
void x_ProcessActiveCount(CQueue *)
void x_ProcessMsgBatchJob(BUF buffer)
string x_GetStoredSectionValues(const string §ion_name, const map< string, string > &values) const
void x_SetRequestContext(void)
CRef< CRequestContext > m_CmdContext
void x_ProcessVersion(CQueue *)
void x_ProcessMsgRequest(BUF buffer)
void x_ProcessGetJob(CQueue *)
void x_SetQuickAcknowledge(void)
string x_GetDiagSection(void) const
bool m_ClientIdentificationPrinted
void x_ProcessSetAffinity(CQueue *)
CNSPreciseTime m_BatchSubmTimeout
void(CNetScheduleHandler::* m_ProcessMessage)(BUF buffer)
static SCommandMap sm_BatchEndMap[]
void x_ProcessPut(CQueue *)
CRef< CRequestContext > m_ConnContext
void x_CheckGetParameters(void)
void x_ProcessPutMessage(CQueue *)
void x_StatisticsNew(CQueue *q, const string &what, const CNSPreciseTime &curr)
void x_ProcessResume(CQueue *)
void x_CheckPortAndTimeout(void)
void x_ProcessJobDelayReadExpiration(CQueue *)
vector< TJobStatus > x_RemoveDuplicateStatuses(const vector< TJobStatus > &src, vector< string > &warnings) const
void x_ProcessSetQueue(CQueue *)
void x_ProcessMsgQueue(BUF buffer)
void x_CheckQInf2Parameters(void)
void x_ProcessSetScope(CQueue *)
void x_ProcessReread(CQueue *)
CNetScheduleServer * m_Server
virtual void OnOverflow(EOverflowReason reason)
Runs when there are insufficient resources to queue a connection, prior to closing it.
virtual void OnError(const string &err_message)
Runs when a socket error is detected.
void x_ProcessFastStatusS(CQueue *)
void x_ProcessSubmit(CQueue *)
static SCommandMap sm_CommandMap[]
void x_ProcessReturn(CQueue *)
void x_ProcessBatchSequenceEnd(CQueue *)
void x_CheckNonAnonymousClient(const string &message)
void x_ProcessHealth(CQueue *)
void x_ProcessListenJob(CQueue *)
void x_ProcessShutdown(CQueue *)
bool x_WorkerNodeCommand(void) const
void x_ProcessReschedule(CQueue *)
void x_PrintCmdRequestStart(const SParsedCmd &cmd)
void x_ProcessStatistics(CQueue *)
void x_ProcessBatchStart(CQueue *)
vector< pair< CJob, string > > m_BatchJobs
SNSCommandArguments m_CommandArguments
void x_ProcessStatus(CQueue *)
NetScheduler threaded server.
const CNetScheduleAccessList & GetAdminHosts(void) const
unsigned int GetReserveDumpSpace(void) const
string ResolveService(const string &service) const
string GetSessionID(void) const
string GetQueueNames(const string &sep) const
string GetDebugGarbage(void) const
SErrorEmulatorParameter GetDebugConnDropBeforeWrite(void) const
unsigned GetHostNetAddr() const
void GetServices(map< string, string > &services) const
string GetAdminClientNames(void) const
SErrorEmulatorParameter GetDebugFDCount(void) const
unsigned GetInactivityTimeout(void) const
unsigned GetScanBatchSize(void) const
string SerializeAlerts(void) const
string GetStateTransitionPerfLogClasses(void) const
string GetNodeID(void) const
bool AdminHostValid(unsigned host) const
bool GetRefuseSubmits() const
unsigned int DecrementCurrentSubmitsCounter(void)
void SetAnybodyCanReconfigure(bool val)
SErrorEmulatorParameter GetDebugConnDropAfterWrite(void) const
void RegisterAlert(EAlertType alert_type, const string &message)
const bool & IsLogNotificationThread() const
string GetStateTransitionPerfLogQueues(void) const
void SetDrainShutdown(void)
unsigned int IncrementCurrentSubmitsCounter(void)
enum EAlertAckResult AcknowledgeAlert(const string &id, const string &user)
string PrintTransitionCounters(void)
const bool & IsLogExecutionWatcherThread() const
SNSRegistryParameters GetAffRegistrySettings(void) const
void CreateDynamicQueue(const CNSClientId &client, const string &qname, const string &qclass, const string &description)
const unsigned int & GetJobCountersInterval() const
const unsigned int & GetStatInterval() const
const bool & IsLogBatchEachJob() const
SErrorEmulatorParameter GetDebugWriteDelay(void) const
CJsonNode SetNSParameters(const SNS_Parameters &new_params, bool limited)
unsigned int GetMaxClientData(void) const
string GetAlerts(void) const
string GetQueueClassesInfo(void) const
void SetShutdownFlag(int signum=0, bool db_was_drained=false)
string GetQueueInfo(void) const
virtual bool ShutdownRequested(void)
Runs synchronously between iterations.
const bool & IsLogCleaningThread() const
SQueueParameters QueueInfo(const string &qname) const
unsigned GetMarkdelBatchSize(void) const
void SetDiskConfigFileChecksum(const string &checksum)
unsigned GetDeleteBatchSize(void) const
string GetServiceToQueueSectionConfig(void) const
unsigned CountActiveJobs() const
bool GetUseHostname(void) const
unsigned int Configure(const IRegistry ®, CJsonNode &diff)
SErrorEmulatorParameter GetDebugMemCount(void) const
const CTime & GetStartTime(void) const
bool IsAdminClientName(const string &name) const
bool IsDrainShutdown(void) const
SErrorEmulatorParameter GetDebugReplyWithGarbage(void) const
double GetPurgeTimeout(void) const
void SetRefuseSubmits(bool val)
void DeleteDynamicQueue(const CNSClientId &client, const string &qname)
string GetLinkedSectionConfig(void) const
CCompoundIDPool GetCompoundIDPool(void) const
const bool & IsLogStatisticsThread() const
CJsonNode ReadServicesConfig(const CNcbiRegistry ®)
string PrintJobsStat(const CNSClientId &client)
bool AnybodyCanReconfigure(void) const
void SetRAMConfigFileChecksum(const string &checksum)
const bool & IsLog() const
SNSRegistryParameters GetScopeRegistrySettings(void) const
string GetQueueConfig(void) const
string GetQueueClassesConfig(void) const
CRef< CQueue > OpenQueue(const string &name)
SNSRegistryParameters GetGroupRegistrySettings(void) const
void ParseArguments(CTempString str, const SNSProtoArgument *arg_descr, TNSProtoParams *params)
TParsedCmd ParseCommand(CTempString command)
TPauseStatus GetPauseStatus(void) const
void SetPauseStatus(const CNSClientId &client, TPauseStatus status)
bool IsSubmitAllowed(unsigned host) const
TJobStatus ConfirmReadingJob(const CNSClientId &client, unsigned int job_id, const string &job_key, CJob &job, const string &auth_token)
int SetClientData(const CNSClientId &client, const string &data, int data_version)
unsigned CountStatus(TJobStatus) const
bool IsProgramAllowed(const string &program_name) const
unsigned int CancelAllJobs(const CNSClientId &client, bool logging)
string PrintNotificationsList(bool verbose) const
void SetAffinity(const CNSClientId &client, const list< string > &aff, ECommandGroup cmd_group)
void SetRefuseSubmits(bool val)
void StatusStatistics(TJobStatus status, TNSBitVector::statistics *st) const
string PrintClientsList(bool verbose) const
bool PutProgressMessage(unsigned int job_id, CJob &job, const string &msg)
unsigned int CancelSelectedJobs(const CNSClientId &client, const string &group, const string &aff_token, const vector< TJobStatus > &statuses, bool logging, vector< string > &warnings)
TJobStatus ReadAndTouchJob(unsigned int job_id, CJob &job, CNSPreciseTime *lifetime)
TJobStatus FailReadingJob(const CNSClientId &client, unsigned int job_id, const string &job_key, CJob &job, const string &auth_token, const string &err_msg, bool no_retries)
TJobStatus SetJobListener(unsigned int job_id, CJob &job, unsigned int address, unsigned short port, const CNSPreciseTime &timeout, bool need_stolen, bool need_progress_msg, size_t *last_event_index)
void ClearWorkerNode(const CNSClientId &client, bool &client_was_found, string &old_session, bool &had_wn_pref_affs, bool &had_reader_pref_affs)
void RegisterQueueResumeNotification(unsigned int address, unsigned short port, bool new_format)
string GetAffinityTokenByID(unsigned int aff_id) const
bool GetJobForReadingOrWait(const CNSClientId &client, unsigned int port, unsigned int timeout, const list< string > *aff_list, bool reader_affinity, bool any_affinity, bool exclusive_new_affinity, bool prioritized_aff, const list< string > *group_list, bool affinity_may_change, bool group_may_change, CJob *job, bool *no_more_jobs, CNSRollbackInterface *&rollback_action, string &added_pref_aff)
TJobStatus JobDelayExpiration(unsigned int job_id, CJob &job, const CNSPreciseTime &tm)
void SetClientScope(const CNSClientId &client)
string PrintTransitionCounters(void) const
string PrintScopesList(bool verbose) const
void CancelWaitRead(const CNSClientId &client)
TJobStatus FailJob(const CNSClientId &client, unsigned int job_id, const string &job_key, CJob &job, const string &auth_token, const string &err_msg, const string &output, int ret_code, bool no_retries, string warning)
TJobStatus ReturnReadingJob(const CNSClientId &client, unsigned int job_id, const string &job_key, CJob &job, const string &auth_token, bool is_ns_rollback, bool blacklist, TJobStatus target_status)
TParameterList GetParameters() const
void MarkClientAsAdmin(const CNSClientId &client)
TJobStatus JobDelayReadExpiration(unsigned int job_id, CJob &job, const CNSPreciseTime &tm)
string MakeJobKey(unsigned int job_id) const
string PrintJobDbStat(const CNSClientId &client, unsigned int job_id, TDumpFields dump_fields)
TJobStatus PutResult(const CNSClientId &client, const CNSPreciseTime &curr, unsigned int job_id, const string &job_key, CJob &job, const string &auth_token, int ret_code, const string &output)
bool GetRefuseSubmits(void) const
unsigned int Submit(const CNSClientId &client, CJob &job, const string &aff_token, const string &group, bool logging, CNSRollbackInterface *&rollback_action)
TJobStatus GetStatusAndLifetime(unsigned int job_id, string &client_ip, string &client_sid, string &client_phid, string &progress_msg, CNSPreciseTime *lifetime)
void GetJobsPerState(const CNSClientId &client, const string &group_token, const string &aff_token, size_t *jobs, vector< string > &warnings) const
list< pair< string, string > > TParameterList
TJobStatus ReturnJob(const CNSClientId &client, unsigned int job_id, const string &job_key, CJob &job, const string &auth_token, string &warning, TJobReturnOption how)
bool IsReaderAllowed(unsigned host) const
string PrintGroupsList(const CNSClientId &client, bool verbose) const
void GetLinkedSections(map< string, map< string, string > > &linked_sections) const
string PrintAllJobDbStat(const CNSClientId &client, const string &group, const string &aff_token, const vector< TJobStatus > &job_statuses, unsigned int start_after_job_id, unsigned int count, bool order_first, TDumpFields dump_fields, bool logging)
TJobStatus RescheduleJob(const CNSClientId &client, unsigned int job_id, const string &job_key, const string &auth_token, const string &aff_token, const string &group, bool &auth_token_ok, CJob &job)
string PrintAffinitiesList(const CNSClientId &client, bool verbose) const
bool GetJobOrWait(const CNSClientId &client, unsigned short port, unsigned int timeout, const list< string > *aff_list, bool wnode_affinity, bool any_affinity, bool exclusive_new_affinity, bool prioritized_aff, bool new_format, const list< string > *group_list, CJob *new_job, CNSRollbackInterface *&rollback_action, string &added_pref_aff)
size_t GetScopeSlotsUsed(void) const
bool IsWorkerAllowed(unsigned host) const
TJobStatus RedoJob(const CNSClientId &client, unsigned int job_id, const string &job_key, CJob &job)
TJobStatus RereadJob(const CNSClientId &client, unsigned int job_id, const string &job_key, CJob &job, bool &no_op)
string PrintJobsStat(const CNSClientId &client, const string &group_token, const string &aff_token, vector< string > &warnings) const
void GetMaxIOSizesAndLinkedSections(unsigned int &max_input_size, unsigned int &max_output_size, map< string, map< string, string > > &linked_sections) const
TJobStatus GetStatusAndLifetimeAndTouch(unsigned int job_id, CJob &job, CNSPreciseTime *lifetime)
void TouchClientsRegistry(CNSClientId &client, bool &client_was_found, bool &session_was_reset, string &old_session, bool &had_wn_pref_affs, bool &had_reader_pref_affs)
void CancelWaitGet(const CNSClientId &client)
list< string > ChangeAffinity(const CNSClientId &client, const list< string > &aff_to_add, const list< string > &aff_to_del, ECommandGroup cmd_group)
TJobStatus Cancel(const CNSClientId &client, unsigned int job_id, const string &job_key, CJob &job, bool is_ns_rollback=false)
~CRequestContextResetter()
CRequestContextResetter()
static unsigned int GetCpuCount(void)
Return number of active CPUs/cores (never less than 1).
static Uint8 GetTotalPhysicalMemorySize(void)
Return the amount of actual/total physical memory, in bytes.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
container_type::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
static SQLCHAR output[256]
static const char * str(char *buf, int n)
bool ReloadConfig(CMetaRegistry::TFlags flags=CMetaRegistry::fReloadIfChanged, IRegistry::TFlags reg_flags=IRegistry::fWithNcbirc)
Reload the configuration file.
const string & GetProgramExecutablePath(EFollowLinks follow_links=eIgnoreLinks) const
Get the application's executable path.
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const string & GetConfigPath(void) const
Get the full path to the configuration file (if any) we ended up using.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
size_t BUF_Read(BUF buf, void *data, size_t size)
size_t BUF_PeekAtCB(BUF buf, size_t pos, size_t(*callback)(void *cbdata, const void *buf, size_t size), void *cbdata, size_t size)
void PrintRequestStop(void)
Print request stop message (for request-driven applications)
CDiagContext_Extra & Print(const string &name, const string &value)
The method does not print the argument, but adds it to the string.
void SetBytesWr(Int8 bytes)
int GetRequestStatus(void) const
Request exit status.
string GetStringUID(TUID uid=0) const
Return string representation of UID.
CDiagContext & GetDiagContext(void)
Get diag context instance.
static void SetRequestContext(CRequestContext *ctx)
Shortcut to CDiagContextThreadData::GetThreadData().SetRequestContext()
void PrintRequestStart(const string &message)
Print request start message (for request-driven applications)
void SetRequestID(TCount rid)
Set request ID.
void SetSessionID(const string &session)
CDiagContext_Extra Extra(void) const
Create a temporary CDiagContext_Extra object.
void SetClientIP(const string &client)
static CRequestContext & GetRequestContext(void)
Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()
TCount GetRequestID(void) const
Get request ID (or zero if not set).
static TPID GetPID(void)
Get cached PID (read real PID if not cached yet).
void SetRequestStatus(int status)
void Flush(void)
Print the message and reset object.
void SetBytesRd(Int8 bytes)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
SIZE_TYPE Size(void) const
Get size (number) of arguments.
TErrCode GetErrCode(void) const
Get error code.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
unsigned ErrCodeToHTTPStatusCode() const
EJobStatus
Job status codes.
virtual const char * GetErrCodeString() const override
Get error code interpreted as text.
static string StatusToString(EJobStatus status)
Printable status type.
@ eDone
Job is ready (computed successfully)
@ eReading
Job has its output been reading.
@ eCanceled
Explicitly canceled.
@ eRunning
Running on a worker node.
@ eJobNotFound
No such job.
@ ePending
Waiting for execution.
@ eFailed
Failed to run (execution timeout)
bool NotNull(void) const THROWS_NONE
Check if pointer is not null â same effect as NotEmpty().
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
void Reset(void)
Reset the containing pointer to null.
bool IsNull(void) const THROWS_NONE
Check if pointer is null â same effect as Empty().
uint64_t Uint8
8-byte (64-bit) unsigned integer
size_t resident_peak
Peak resident set size ("high water mark")
static int GetThreadCount(void)
Get the number of threads in the current process.
size_t total_peak
Peak total memory usage.
size_t resident
Resident/working set size (RSS).
static int GetFileDescriptorsCount(int *soft_limit=NULL, int *hard_limit=NULL)
Get the number of file descriptors consumed by the current process, and optional system wide file des...
size_t total
Total memory usage.
size_t shared
Shared memory usage.
size_t text
Text (code) segment size.
static bool GetMemoryUsage(SMemoryUsage &usage)
Get current process memory usage.
size_t swap
Swap space usage.
size_t lib
Shared library code size.
size_t data
Data segment size.
static bool GetTimes(double *real, double *user, double *sys, EWhat what=eProcess)
Get current process execution times.
size_t stack
Stack size of the initial thread in the process.
bool Write(CNcbiOstream &os, TFlags flags=0) const
Write the registry content to output stream.
EIO_Status Shutdown(EIO_Event how)
Shutdown socket I/O in the specified direction.
virtual EIO_Status GetOSHandle(void *handle_buf, size_t handle_size, EOwnership ownership=eNoOwnership) const
Access to the system-specific socket handle.
static CNCBI_IPAddr GetLoopbackAddress(void)
Loopback address is in network byte order (when "unsigned int")
EIO_Status SetTimeout(EIO_Event event, const STimeout *timeout)
Set timeout for I/O in the specified direction.
void DisableOSSendDelay(bool on_off=true)
static CNCBI_IPAddr GetLocalHostAddress(ESwitch reget=eDefault)
Local host address in network byte order (cached for faster retrieval)
TNCBI_BigCount GetCount(EIO_Event direction) const
void GetPeerAddress(unsigned int *host, unsigned short *port, ENH_ByteOrder byte_order) const
Get peer address.
static string ntoa(const CNCBI_IPAddr &addr)
BSD-like API.
EIO_Status Write(const void *buf, size_t size, size_t *n_written=0, EIO_WriteMethod how=eIO_WritePersist)
Write to socket.
@ eSAF_IP
only numeric IP if INET socket, empty otherwise
static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)
Get a printable version of the specified string.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
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 bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static const string BoolToString(bool value)
Convert bool to string.
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
static string URLEncode(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
URL-encode string.
@ fDoubleFixed
DoubleToString*(): Use n.nnnn format for double conversions.
void GetParameters(SServer_Parameters *params)
EClosePeer
Type of connection closing.
EOverflowReason
Error codes for OnOverflow method in IServer_ConnectionHandler.
void CloseConnection(CSocket *sock)
Close connection.
unsigned int max_threads
Maximum simultaneous threads.
unsigned int max_connections
Maximum # of open connections.
CSocket & GetSocket(void)
Get underlying socket.
unsigned int init_threads
Number of initial threads.
@ eClientClose
Connection closed by other peer.
@ eOurClose
Connection closed by ourselves.
double Restart(void)
Return time elapsed since first Start() or last Restart() call (in seconds).
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
@ eStart
Start timer immediately after creating.
const char * IO_StatusStr(EIO_Status status)
Get the text form of an enum status value.
uint64_t TNCBI_BigCount
Big unsigned integer for file size and position.
@ eIO_Success
everything is fine, no error occurred
@ eIO_ReadWrite
eIO_Read | eIO_Write (also, eCONN_OnFlush)
operation
Bit operations.
const size_t g_ValidJobStatusesSize
const CNetScheduleAPI::EJobStatus g_ValidJobStatuses[]
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
int strncmp(const char *str1, const char *str2, size_t count)
#define NETSCHEDULED_VERSION
#define NETSCHEDULED_FEATURES
#define NETSCHEDULED_STORAGE_VERSION
#define NETSCHEDULED_PROTOCOL_VERSION
#define NETSCHEDULED_BUILD_DATE
unsigned int TNSCommandChecks
const string k_NoAffinityToken
const string k_NoGroupToken
SNSProtoArgument s_BatchArgs[]
const string kEndOfResponse
const string kOKResponsePrefix
static SNSProtoArgument s_AuthArgs[]
static void s_ReadBufToString(BUF buf, string &str)
const string kOKCompleteResponse
static size_t s_BufReadHelper(void *data, const void *ptr, size_t size)
const string kErrNoJobFoundResponse
static const unsigned int kMaxParserErrMsgLength
const size_t kInitialMessageBufferSize
const size_t kMessageBufferIncrement
void SerializeRefuseSubmitState(CNetScheduleServer *server)
const unsigned int kSubmitCounterInitialValue
void NS_ValidateConfigFile(const IRegistry ®, vector< string > &warnings, bool throw_port_exception, bool &decrypting_error)
string NS_GetConfigFileChecksum(const string &file_name, vector< string > &warnings)
Defines NCBI C++ secure resources API.
static SLJIT_INLINE sljit_ins st(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Process memory usage information, in bytes.
bool IsActive(void) const
string job_statuses_string
vector< TJobStatus > job_statuses
void AssignValues(TNSProtoParams ¶ms, const string &command, bool need_to_generate, CSocket &peer_socket, CCompoundIDPool::TInstance id_pool)
unsigned int start_after_job_id
string queue_from_job_key
const SNSProtoCmdDef< Extra > * command
string Serialize(const string &name, const string &prefix, const string &suffix) const
void Read(const IRegistry ®)
string GetPrintableParameters(bool include_class, bool url_encoded) const
size_t gap_blocks
Number of GAP blocks.
size_t bit_blocks
Number of bit blocks.
size_t memory_used
memory usage for all blocks and service tables
Statistical information about bitset's memory allocation details.
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