NCBI C++ ToolKit
ns_server.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: ns_server.cpp 89004 2020-02-11 19:47:28Z satskyse $
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: Anatoliy Kuznetsov, Victor Joukov
27  *
28  * File Description: NetScheduler threaded server
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
34 #include "ns_server.hpp"
35 #include "ns_ini_params.hpp"
36 #include "queue_database.hpp"
37 #include "ns_types.hpp"
38 
39 #include <corelib/request_ctx.hpp>
40 
42 
43 
45 
46 //////////////////////////////////////////////////////////////////////////
47 /// NetScheduler threaded server implementation
49  bool diskless)
50  : m_BackgroundHost(this),
51  m_Port(0),
52  m_HostNetAddr(0),
53  m_Shutdown(false),
54  m_SigNum(0),
55  m_InactivityTimeout(default_network_timeout),
56  m_QueueDB(NULL),
57  m_StartTime(GetFastLocalTime()),
58  m_LogFlag(default_is_log),
59  m_LogBatchEachJobFlag(default_log_batch_each_job),
60  m_LogNotificationThreadFlag(default_log_notification_thread),
61  m_LogCleaningThreadFlag(default_log_cleaning_thread),
62  m_LogExecutionWatcherThreadFlag(default_log_execution_watcher_thread),
63  m_LogStatisticsThreadFlag(default_log_statistics_thread),
64  m_RefuseSubmits(false),
65  m_UseHostname(default_use_hostname),
66  m_Diskless(diskless),
67  m_DBDrained(false),
68  m_DeleteBatchSize(default_del_batch_size),
69  m_MarkdelBatchSize(default_markdel_batch_size),
70  m_ScanBatchSize(default_scan_batch_size),
71  m_PurgeTimeout(default_purge_timeout),
72  m_StatInterval(default_stat_interval),
73  m_JobCountersInterval(default_job_counters_interval),
74  m_MaxClientData(default_max_client_data),
75  m_NodeID("not_initialized"),
76  m_SessionID("s" + x_GenerateGUID()),
77  m_StartIDs(dbpath, diskless),
78  m_AnybodyCanReconfigure(false),
79  m_ReserveDumpSpace(default_reserve_dump_space)
80 {
82  sm_netschedule_server = this;
83 }
84 
85 
87 {
88  delete m_QueueDB;
89 }
90 
91 
93 {
94  // port must be set before listening
95  _ASSERT(m_Port);
96  AddListener(factory, m_Port);
97 }
98 
99 
100 // Returns what was changed
102  bool limited)
103 {
104  CJsonNode what_changed = CJsonNode::NewObjectNode();
106  bool new_val;
107 
108  if (m_LogFlag != params.is_log) {
110  values.AppendBoolean(m_LogFlag);
111  values.AppendBoolean(params.is_log);
112  changes.SetByKey("log", values);
113  }
114  m_LogFlag = params.is_log;
115 
116  new_val = (params.log_batch_each_job && m_LogFlag);
117  if (m_LogBatchEachJobFlag != new_val) {
120  values.AppendBoolean(new_val);
121  changes.SetByKey("log_batch_each_job", values);
122  }
123  m_LogBatchEachJobFlag = new_val;
124 
125  new_val = (params.log_notification_thread && m_LogFlag);
126  if (m_LogNotificationThreadFlag != new_val) {
129  values.AppendBoolean(new_val);
130  changes.SetByKey("log_notification_thread", values);
131  }
132  m_LogNotificationThreadFlag = new_val;
133 
134  new_val = (params.log_cleaning_thread && m_LogFlag);
135  if (m_LogCleaningThreadFlag != new_val) {
138  values.AppendBoolean(new_val);
139  changes.SetByKey("log_cleaning_thread", values);
140  }
141  m_LogCleaningThreadFlag = new_val;
142 
143  new_val = (params.log_execution_watcher_thread&& m_LogFlag);
144  if (m_LogExecutionWatcherThreadFlag != new_val) {
147  values.AppendBoolean(new_val);
148  changes.SetByKey("log_execution_watcher_thread", values);
149  }
151 
152  new_val = (params.log_statistics_thread && m_LogFlag);
153  if (m_LogStatisticsThreadFlag != new_val) {
156  values.AppendBoolean(new_val);
157  changes.SetByKey("log_statistics_thread", values);
158  }
159  m_LogStatisticsThreadFlag = new_val;
160 
161  if (m_StatInterval != params.stat_interval) {
164  values.AppendInteger(params.stat_interval);
165  changes.SetByKey("stat_interval", values);
166  }
167  m_StatInterval = params.stat_interval;
168 
172  values.AppendInteger(params.job_counters_interval);
173  changes.SetByKey("job_counters_interval", values);
174  }
176 
177  if (m_MaxClientData != params.max_client_data) {
180  values.AppendInteger(params.max_client_data);
181  changes.SetByKey("max_client_data", values);
182  }
184 
185  CJsonNode accepted_hosts = m_AdminHosts.SetHosts(params.admin_hosts);
186  if (accepted_hosts.GetSize() > 0)
187  changes.SetByKey("admin_host", accepted_hosts);
188 
189  CJsonNode admin_diff = x_SetFromList(params.admin_client_names,
192  if (admin_diff.GetSize() > 0)
193  changes.SetByKey("admin_client_name", admin_diff);
194 
195  CJsonNode state_transition_perf_log_queues_diff =
199  if (state_transition_perf_log_queues_diff.GetSize() > 0)
200  changes.SetByKey("state_transition_perf_log_queues",
201  state_transition_perf_log_queues_diff);
202 
203  CJsonNode state_transition_perf_log_classes_diff =
207  if (state_transition_perf_log_classes_diff.GetSize() > 0)
208  changes.SetByKey("state_transition_perf_log_classes",
209  state_transition_perf_log_classes_diff);
210 
211  if (m_InactivityTimeout != params.network_timeout) {
214  values.AppendInteger(params.network_timeout);
215  changes.SetByKey("network_timeout", values);
216  }
218 
219  if (m_ReserveDumpSpace != params.reserve_dump_space) {
222  values.AppendInteger(params.reserve_dump_space);
223  changes.SetByKey("reserve_dump_space", values);
224  }
226 
227 
228  if (limited) {
229  // max_connections CServer parameter could be changed on the fly via
230  // the RECO command. So check if it was changed.
231  SServer_Parameters current_params;
232  CServer::GetParameters(&current_params);
233  if (current_params.max_connections != params.max_connections) {
235  values.AppendInteger(current_params.max_connections);
236  values.AppendInteger(params.max_connections);
237  changes.SetByKey("max_connections", values);
238 
239  current_params.max_connections = params.max_connections;
240  CServer::SetParameters(current_params);
241  }
242  }
243 
244 
245  if (changes.GetSize() > 0)
246  what_changed.SetByKey("server_changes", changes);
247 
248  #if defined(_DEBUG) && !defined(NDEBUG)
255  debug_garbage = params.debug_garbage;
256  #endif
257 
258  if (limited)
259  return what_changed;
260 
261 
262  CServer::SetParameters(params);
263  m_Port = params.port;
265  m_UseHostname = params.use_hostname;
266  if (m_UseHostname)
268  else
270 
271  // Purge related parameters
275  m_PurgeTimeout = params.purge_timeout;
276 
280 
281  // The difference is required only at the stage of RECO.
282  // RECO always calls the function with the limited flag so there is no need
283  // to provide the difference here
284  return CJsonNode::NewObjectNode();
285 }
286 
287 
288 // Return: difference
289 // Note: it is always called after the configuration is validated so
290 // no messages should be logged
292 {
294  const string section = "service_to_queue";
295  map< string, string > new_services;
296 
297  // Read the new list -- new alerts if so
298  list<string> entries;
299  reg.EnumerateEntries(section, &entries);
300 
301 
302  for (list<string>::const_iterator k = entries.begin();
303  k != entries.end(); ++k) {
304  string service_name = *k;
305  string qname = reg.Get("service_to_queue", service_name);
306  if (qname.empty())
307  continue;
308 
309  // Check that the queue name has been provided
310  if (!m_QueueDB->QueueExists(qname))
311  continue;
312 
313  // Config line is fine, memorize it
314  new_services[service_name] = qname;
315  }
316 
317  // Compare with the old list -- combine report string
318  CJsonNode new_items = CJsonNode::NewArrayNode();
319  CJsonNode deleted_items = CJsonNode::NewArrayNode();
320  CJsonNode changed_items = CJsonNode::NewObjectNode();
321 
322  for (map< string, string>::const_iterator k = new_services.begin();
323  k != new_services.end(); ++k) {
325  for (found = m_Services.begin(); found != m_Services.end(); ++found)
326  if (NStr::CompareNocase(found->first, k->first) == 0)
327  break;
328 
329  if (found == m_Services.end()) {
330  new_items.AppendString(k->first);
331  continue;
332  }
333  if (found->second != k->second) {
335  vals.AppendString(found->second);
336  vals.AppendString(k->second);
337  changed_items.SetByKey(k->first, vals);
338  }
339  }
340 
342  k != m_Services.end(); ++k) {
344  for (found = new_services.begin(); found != new_services.end(); ++found)
345  if (NStr::CompareNocase(found->first, k->first) == 0)
346  break;
347 
348  if (found == new_services.end())
349  deleted_items.AppendString(k->first);
350  }
351 
352 
353  if (new_items.GetSize() > 0)
354  diff.SetByKey("services_added", new_items);
355 
356  if (deleted_items.GetSize() > 0)
357  diff.SetByKey("services_deleted", deleted_items);
358 
359  if (changed_items.GetSize() > 0)
360  diff.SetByKey("services_changed", changed_items);
361 
362  // Set the current as the new one
364  m_Services = new_services;
365  return diff;
366 }
367 
368 
370 {
371  return m_Shutdown;
372 }
373 
374 
376 {
377  delete m_QueueDB;
378  m_QueueDB = qdb;
379 }
380 
381 
382 void CNetScheduleServer::SetShutdownFlag(int signum, bool db_was_drained)
383 {
384  if (!m_Shutdown) {
385  m_Shutdown = true;
386  m_SigNum = signum;
387  m_DBDrained = db_was_drained;
388  }
389 }
390 
391 
392 // Queue handling
393 unsigned int CNetScheduleServer::Configure(const IRegistry & reg,
394  CJsonNode & diff)
395 {
396  return m_QueueDB->Configure(reg, diff);
397 }
398 
400 {
401  return m_QueueDB->CountActiveJobs();
402 }
403 
404 
406 {
407  return m_QueueDB->OpenQueue(name);
408 }
409 
410 
412  const string & qname,
413  const string & qclass,
414  const string & description)
415 {
416  m_QueueDB->CreateDynamicQueue(client, qname, qclass, description);
417 }
418 
419 
421  const std::string& qname)
422 {
424 }
425 
426 
428 CNetScheduleServer::QueueInfo(const string & qname) const
429 {
430  return m_QueueDB->QueueInfo(qname);
431 }
432 
433 
435 {
436  return m_QueueDB->GetQueueNames(sep);
437 }
438 
439 
441 {
443 }
444 
445 
447 {
448  return m_QueueDB->PrintJobsStat(client);
449 }
450 
451 
453 {
454  return m_QueueDB->GetQueueClassesInfo();
455 }
456 
457 
459 {
461 }
462 
463 
465 {
466  return m_QueueDB->GetQueueInfo();
467 }
468 
469 
471 {
472  return m_QueueDB->GetQueueConfig();
473 }
474 
475 
477 {
479 }
480 
481 
483 {
484  string output;
487 
488  if (m_Services.empty())
489  return output;
490 
491  output = "\n[service_to_queue]";
492  for (k = m_Services.begin(); k != m_Services.end(); ++k) {
493  if (!output.empty())
494  output += "\n";
495  output += k->first + "=\"" + k->second + "\"";
496  }
497 
498  return output;
499 }
500 
501 
502 string CNetScheduleServer::ResolveService(const string & service) const
503 {
506 
507  for (k = m_Services.begin(); k != m_Services.end(); ++k) {
508  if (NStr::CompareNocase(k->first, service) == 0)
509  return k->second;
510  }
511  return "";
512 }
513 
514 
516 {
518  services = m_Services;
519 }
520 
521 
522 bool CNetScheduleServer::AdminHostValid(unsigned host) const
523 {
524  return m_AdminHosts.IsAllowed(host);
525 }
526 
527 
528 bool CNetScheduleServer::IsAdminClientName(const string & name) const
529 {
531 
532  for (vector<string>::const_iterator k(m_AdminClientNames.begin());
533  k != m_AdminClientNames.end(); ++k)
534  if (*k == name)
535  return true;
536  return false;
537 }
538 
540 {
541  string ret;
543 
544  for (vector<string>::const_iterator k(m_AdminClientNames.begin());
545  k != m_AdminClientNames.end(); ++k) {
546  if (!ret.empty())
547  ret += ", ";
548  ret += *k;
549  }
550  return ret;
551 }
552 
553 
555 {
556  string ret;
558 
559  for (vector<string>::const_iterator
561  k != m_StateTransitionPerfLogQueues.end(); ++k) {
562  if (!ret.empty())
563  ret += ", ";
564  ret += *k;
565  }
566  return ret;
567 }
568 
569 
571 {
572  string ret;
574 
575  for (vector<string>::const_iterator
577  k != m_StateTransitionPerfLogClasses.end(); ++k) {
578  if (!ret.empty())
579  ret += ", ";
580  ret += *k;
581  }
582  return ret;
583 }
584 
585 
586 bool
588  const string & class_name) const
589 {
591  for (vector<string>::const_iterator
593  k != m_StateTransitionPerfLogQueues.end(); ++k) {
594  if (*k == "*")
595  return true;
596  if (NStr::CompareNocase(*k, queue_name) == 0)
597  return true;
598  }
599 
600  if (!class_name.empty()) {
601  for (vector<string>::const_iterator
603  k != m_StateTransitionPerfLogClasses.end(); ++k) {
604  if (*k == "*")
605  return true;
606  if (NStr::CompareNocase(*k, class_name) == 0)
607  return true;
608  }
609  }
610 
611  return false;
612 }
613 
614 
616 {
617  return m_Alerts.GetURLEncoded();
618 }
619 
620 
622 {
623  return m_Alerts.Serialize();
624 }
625 
626 
627 enum EAlertAckResult
628 CNetScheduleServer::AcknowledgeAlert(const string & id,
629  const string & user)
630 {
631  return m_Alerts.Acknowledge(id, user);
632 }
633 
634 
635 enum EAlertAckResult
637  const string & user)
638 {
639  return m_Alerts.Acknowledge(alert_type, user);
640 }
641 
642 
644  const string & message)
645 {
646  m_Alerts.Register(alert_type, message);
647 }
648 
649 
650 // The method is called after the database is created or loaded.
651 // This guarantees that the directory is there.
652 // The file with an identifier could be read or created safely.
653 // Returns: true if everything is fine.
654 void CNetScheduleServer::InitNodeID(const string & db_path)
655 {
656  if (m_Diskless) {
657  m_NodeID = "n" + x_GenerateGUID();
658  return;
659  }
660 
661  CFile node_id_file(CFile::MakePath(
663  kNodeIDFileName));
664 
665  if (node_id_file.Exists()) {
666  // File exists, read the ID from it
667  CFileIO f;
668  char buffer[64];
669 
670  f.Open(node_id_file.GetPath(), CFileIO_Base::eOpen,
672  size_t n = f.Read(buffer, sizeof(buffer));
673 
674  m_NodeID = string(buffer, n);
676  f.Close();
677  } else {
678  // No file, need to be created
679  m_NodeID = "n" + x_GenerateGUID();
680 
681  CFileIO f;
682  f.Open(node_id_file.GetPath(), CFileIO_Base::eCreate,
684  f.Write(m_NodeID.data(), m_NodeID.size());
685  f.Close();
686  }
687 }
688 
689 
691 {
692  return sm_netschedule_server;
693 }
694 
695 
697 {
698  // This method is called by the CServer::Run() when all the threads are
699  // shut down but the port is still posessed
700 
701  // If it was a signal initiated shutdown then it is a good idea to log it.
702  // The signal number is set to non-zero value only in case of an OS signal
703  if (m_SigNum != 0) {
704  if (IsLog()) {
705  // Imitate the SHUTDOWN command logging with an extra information
706  // about the signal number
708  ctx.Reset(new CRequestContext());
709  ctx->SetRequestID();
710 
711  CDiagContext & diag_context = GetDiagContext();
712  diag_context.SetRequestContext(ctx);
713  CDiagContext_Extra extra = diag_context.PrintRequestStart();
714 
715  extra.Print("_type", "cmd")
716  .Print("_queue", "")
717  .Print("cmd", "SHUTDOWN")
718  .Print("signum", m_SigNum);
719  extra.Flush();
720 
721  ctx->SetRequestStatus(200);
722  diag_context.PrintRequestStop();
723  ctx.Reset();
724  diag_context.SetRequestContext(NULL);
725  }
726  }
727 
728  m_QueueDB->Close();
729 }
730 
731 
733 {
734  // Naive implementation of the unique identifier.
736  Int8 current_time = time(0);
737 
738  return to_string((pid << 32) | current_time);
739 }
740 
741 
742 CJsonNode
744  vector<string> & to,
745  CRWLock & lock)
746 {
748  CWriteLockGuard guard(lock);
749  vector<string> old = to;
750 
751  to.clear();
752  NStr::Split(from, ";, \n\r", to,
754  sort(to.begin(), to.end());
755 
756  if (old != to) {
757  CJsonNode old_vals = CJsonNode::NewArrayNode();
758  CJsonNode new_vals = CJsonNode::NewArrayNode();
759 
760  for (vector<string>::const_iterator k = old.begin();
761  k != old.end(); ++k)
762  old_vals.AppendString(*k);
763  for (vector<string>::const_iterator k = to.begin();
764  k != to.end(); ++k)
765  new_vals.AppendString(*k);
766 
767  diff.Append(old_vals);
768  diff.Append(new_vals);
769  }
770  return diff;
771 }
772 
773 
774 
775 void CNetScheduleServer::SetRAMConfigFileChecksum(const string & checksum)
776 {
777  m_RAMConfigFileChecksum = checksum;
778 }
779 
780 
782 {
783  m_DiskConfigFileChecksum = checksum;
784 }
785 
786 
788 {
789  return m_QueueDB->GetPauseQueues();
790 }
791 
792 
794 {
796 }
797 
798 
800 {
801  return m_QueueDB->GetDataPath();
802 }
Temporary object for holding extra message arguments.
Definition: ncbidiag.hpp:1828
Class for support low level input/output for files.
Definition: ncbifile.hpp:3475
CFile –.
Definition: ncbifile.hpp:1604
JSON node abstraction.
void AppendBoolean(bool value)
For an array node, add a boolean node at the end of the array.
size_t GetSize() const
For a container node (that is, either an array or an object), return the number of elements in the co...
static CJsonNode NewArrayNode()
Create a new JSON array node.
void AppendInteger(Int8 value)
For an array node, add a integer node at the end of the array.
void AppendString(const string &value)
For an array node, add a string node at the end of the array.
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 Append(CJsonNode::TInstance value)
For an array node, add a new element at the end of the array.
string GetURLEncoded(void) const
Definition: ns_alert.cpp:164
string Serialize(void) const
Definition: ns_alert.cpp:185
enum EAlertAckResult Acknowledge(const string &alert_id, const string &user)
Definition: ns_alert.cpp:109
void Register(enum EAlertType alert_type, const string &message)
Definition: ns_alert.cpp:84
CNcbiRegistry –.
Definition: ncbireg.hpp:913
bool IsAllowed(unsigned int ha) const
Definition: access_list.cpp:42
CJsonNode SetHosts(const string &host_names)
Definition: access_list.cpp:54
NetScheduler threaded server.
Definition: ns_server.hpp:57
unsigned int m_MaxClientData
Definition: ns_server.hpp:257
string ResolveService(const string &service) const
Definition: ns_server.cpp:502
string GetQueueNames(const string &sep) const
Definition: ns_server.cpp:434
CFastMutex m_ServicesLock
Definition: ns_server.hpp:280
unsigned int m_ReserveDumpSpace
Definition: ns_server.hpp:292
void GetServices(map< string, string > &services) const
Definition: ns_server.cpp:515
map< string, string > m_Services
Definition: ns_server.hpp:281
string GetAdminClientNames(void) const
Definition: ns_server.cpp:539
CJsonNode x_SetFromList(const string &from, vector< string > &to, CRWLock &lock)
Definition: ns_server.cpp:743
unsigned int m_JobCountersInterval
Definition: ns_server.hpp:255
static CNetScheduleServer * GetInstance(void)
Definition: ns_server.cpp:690
string SerializeAlerts(void) const
Definition: ns_server.cpp:621
unsigned int m_ScanBatchSize
Definition: ns_server.hpp:252
string GetStateTransitionPerfLogClasses(void) const
Definition: ns_server.cpp:570
bool AdminHostValid(unsigned host) const
Definition: ns_server.cpp:522
unsigned int m_StatInterval
Definition: ns_server.hpp:254
static CNetScheduleServer * sm_netschedule_server
Definition: ns_server.hpp:269
void RegisterAlert(EAlertType alert_type, const string &message)
Definition: ns_server.cpp:643
bool m_LogCleaningThreadFlag
Definition: ns_server.hpp:235
SErrorEmulatorParameter debug_write_delay
Definition: ns_server.hpp:304
SNSRegistryParameters m_ScopeRegistrySettings
Definition: ns_server.hpp:264
CNSAlerts m_Alerts
Definition: ns_server.hpp:278
string GetStateTransitionPerfLogQueues(void) const
Definition: ns_server.cpp:554
vector< string > m_AdminClientNames
Definition: ns_server.hpp:272
unsigned int m_DeleteBatchSize
Definition: ns_server.hpp:250
vector< string > GetRefuseSubmitQueues(void) const
Definition: ns_server.cpp:793
string m_DiskConfigFileChecksum
Definition: ns_server.hpp:288
enum EAlertAckResult AcknowledgeAlert(const string &id, const string &user)
Definition: ns_server.cpp:628
string PrintTransitionCounters(void)
Definition: ns_server.cpp:440
CNetScheduleServer(const string &dbpath, bool diskless)
NetScheduler threaded server implementation.
Definition: ns_server.cpp:48
void CreateDynamicQueue(const CNSClientId &client, const string &qname, const string &qclass, const string &description)
Definition: ns_server.cpp:411
SNSRegistryParameters m_AffRegistrySettings
Definition: ns_server.hpp:262
unsigned int m_InactivityTimeout
Definition: ns_server.hpp:227
CJsonNode SetNSParameters(const SNS_Parameters &new_params, bool limited)
Definition: ns_server.cpp:101
CNetScheduleAccessList m_AdminHosts
Definition: ns_server.hpp:267
string GetAlerts(void) const
Definition: ns_server.cpp:615
string GetQueueClassesInfo(void) const
Definition: ns_server.cpp:452
void SetShutdownFlag(int signum=0, bool db_was_drained=false)
Definition: ns_server.cpp:382
SErrorEmulatorParameter debug_fd_count
Definition: ns_server.hpp:302
string GetQueueInfo(void) const
Definition: ns_server.cpp:464
void SetQueueDB(CQueueDataBase *qdb)
Definition: ns_server.cpp:375
virtual bool ShutdownRequested(void)
Runs synchronously between iterations.
Definition: ns_server.cpp:369
CQueueDataBase * m_QueueDB
Definition: ns_server.hpp:228
SQueueParameters QueueInfo(const string &qname) const
Definition: ns_server.cpp:428
bool m_LogStatisticsThreadFlag
Definition: ns_server.hpp:237
void SetDiskConfigFileChecksum(const string &checksum)
Definition: ns_server.cpp:781
string GetServiceToQueueSectionConfig(void) const
Definition: ns_server.cpp:482
void AddDefaultListener(IServer_ConnectionFactory *factory)
Definition: ns_server.cpp:92
unsigned CountActiveJobs() const
Definition: ns_server.cpp:399
SErrorEmulatorParameter debug_mem_count
Definition: ns_server.hpp:303
virtual void Exit()
Cleanup the server.
Definition: ns_server.cpp:696
map< string, int > GetPauseQueues(void) const
Definition: ns_server.cpp:787
CRWLock m_STPerfLogQCLock
Definition: ns_server.hpp:274
string x_GenerateGUID(void) const
Definition: ns_server.cpp:732
unsigned int Configure(const IRegistry &reg, CJsonNode &diff)
Definition: ns_server.cpp:393
virtual ~CNetScheduleServer()
Definition: ns_server.cpp:86
bool IsAdminClientName(const string &name) const
Definition: ns_server.cpp:528
CAtomicCounter m_CurrentSubmitsCounter
Definition: ns_server.hpp:245
bool ShouldPerfLogTransitions(const string &queue_name, const string &class_name) const
Definition: ns_server.cpp:587
SErrorEmulatorParameter debug_reply_with_garbage
Definition: ns_server.hpp:307
SNSRegistryParameters m_GroupRegistrySettings
Definition: ns_server.hpp:263
void DeleteDynamicQueue(const CNSClientId &client, const string &qname)
Definition: ns_server.cpp:420
bool m_LogExecutionWatcherThreadFlag
Definition: ns_server.hpp:236
string GetLinkedSectionConfig(void) const
Definition: ns_server.cpp:476
void InitNodeID(const string &db_path)
Definition: ns_server.cpp:654
string m_RAMConfigFileChecksum
Definition: ns_server.hpp:287
unsigned m_HostNetAddr
Definition: ns_server.hpp:223
string GetDataPath(void) const
Definition: ns_server.cpp:799
CJsonNode ReadServicesConfig(const CNcbiRegistry &reg)
Definition: ns_server.cpp:291
string PrintJobsStat(const CNSClientId &client)
Definition: ns_server.cpp:446
SErrorEmulatorParameter debug_conn_drop_before_write
Definition: ns_server.hpp:305
SErrorEmulatorParameter debug_conn_drop_after_write
Definition: ns_server.hpp:306
void SetRAMConfigFileChecksum(const string &checksum)
Definition: ns_server.cpp:775
const bool & IsLog() const
Definition: ns_server.hpp:62
unsigned int m_MarkdelBatchSize
Definition: ns_server.hpp:251
bool m_LogNotificationThreadFlag
Definition: ns_server.hpp:234
string GetQueueConfig(void) const
Definition: ns_server.cpp:470
string GetQueueClassesConfig(void) const
Definition: ns_server.cpp:458
CRWLock m_AdminClientsLock
Definition: ns_server.hpp:271
vector< string > m_StateTransitionPerfLogClasses
Definition: ns_server.hpp:276
CRef< CQueue > OpenQueue(const string &name)
Definition: ns_server.cpp:405
vector< string > m_StateTransitionPerfLogQueues
Definition: ns_server.hpp:275
string PrintJobsStat(const CNSClientId &client)
SQueueParameters QueueInfo(const string &qname) const
string GetQueueConfig(void) const
time_t Configure(const IRegistry &reg, CJsonNode &diff)
void CreateDynamicQueue(const CNSClientId &client, const string &qname, const string &qclass, const string &description="")
string GetDataPath(void) const
string GetQueueInfo(void) const
void DeleteDynamicQueue(const CNSClientId &client, const string &qname)
map< string, int > GetPauseQueues(void) const
string GetQueueClassesConfig(void) const
bool QueueExists(const string &qname) const
vector< string > GetRefuseSubmitQueues(void) const
string GetQueueNames(const string &sep) const
string PrintTransitionCounters(void)
string GetLinkedSectionConfig(void) const
unsigned int CountActiveJobs(void) const
CRef< CQueue > OpenQueue(const string &name)
string GetQueueClassesInfo(void) const
CRWLock –.
Definition: ncbimtx.hpp:953
CRef –.
Definition: ncbiobj.hpp:618
IRegistry –.
Definition: ncbireg.hpp:73
IServer_ConnectionFactory::
Definition: server.hpp:388
container_type::const_iterator const_iterator
Definition: map.hpp:53
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
bool empty() const
Definition: map.hpp:149
CS_CONTEXT * ctx
Definition: t0006.c:12
#define false
Definition: bool.h:36
static SQLCHAR output[256]
Definition: print.c:5
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
void Set(TValue new_value) THROWS_NONE
Set atomic counter value.
Definition: ncbicntr.hpp:185
void PrintRequestStop(void)
Print request stop message (for request-driven applications)
Definition: ncbidiag.cpp:2778
CDiagContext_Extra & Print(const string &name, const string &value)
The method does not print the argument, but adds it to the string.
Definition: ncbidiag.cpp:2622
CDiagContext & GetDiagContext(void)
Get diag context instance.
Definition: logging.cpp:818
static void SetRequestContext(CRequestContext *ctx)
Shortcut to CDiagContextThreadData::GetThreadData().SetRequestContext()
Definition: ncbidiag.cpp:1907
void PrintRequestStart(const string &message)
Print request start message (for request-driven applications)
Definition: ncbidiag.cpp:2762
void Flush(void)
Print the message and reset object.
Definition: ncbidiag.cpp:2332
static string MakePath(const string &dir=kEmptyStr, const string &base=kEmptyStr, const string &ext=kEmptyStr)
Assemble a path from basic components.
Definition: ncbifile.cpp:413
static string AddTrailingPathSeparator(const string &path)
Add trailing path separator, if needed.
Definition: ncbifile.cpp:455
const string & GetPath(void) const
Get entry path.
Definition: ncbifile.hpp:3910
virtual bool Exists(void) const
Check existence of file.
Definition: ncbifile.hpp:4038
@ eRead
File can be read.
Definition: ncbifile.hpp:3435
@ eReadWrite
File can be read and written.
Definition: ncbifile.hpp:3437
@ eOpen
Open an existing file, or create a new one.
Definition: ncbifile.hpp:3425
@ eCreate
Create a new file, or truncate an existing one.
Definition: ncbifile.hpp:3421
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
static TPid GetPid(void)
Get process identifier (pid) for the current process.
virtual const string & Get(const string &section, const string &name, TFlags flags=0) const
Get the parameter value.
Definition: ncbireg.cpp:262
virtual void EnumerateEntries(const string &section, list< string > *entries, TFlags flags=fAllLayers) const
Enumerate parameter names for a specified section.
Definition: ncbireg.cpp:514
static string gethostname(ESwitch log=eOff)
Return empty string on error.
static string ntoa(unsigned int host)
BSD-like API. NB: when int, "host" must be in network byte order.
static unsigned int gethostbyname(const string &host, ESwitch log=eOff)
Return 0 on error.
#define kEmptyStr
Definition: ncbistr.hpp:123
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
Definition: ncbistr.cpp:219
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.
Definition: ncbistr.cpp:3461
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3201
@ fSplit_Truncate
Definition: ncbistr.hpp:2501
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
Definition: ncbistr.hpp:2498
@ eTrunc_End
Truncate trailing spaces only.
Definition: ncbistr.hpp:2241
void GetParameters(SServer_Parameters *params)
Definition: server.cpp:631
void AddListener(IServer_ConnectionFactory *factory, unsigned short port)
Register a listener.
Definition: server.cpp:605
unsigned short m_Port
TCP port to listen on.
void SetParameters(const SServer_Parameters &new_params)
Definition: server.cpp:618
unsigned int max_connections
Maximum # of open connections.
Definition: server.hpp:436
CTime GetFastLocalTime(void)
Quick and dirty getter of local time.
Definition: ncbitime.cpp:4166
yy_size_t n
constexpr auto sort(_Init &&init)
T signum(T x_)
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
EAlertAckResult
Definition: ns_alert.hpp:63
EAlertType
Definition: ns_alert.hpp:46
const bool default_log_batch_each_job
const double default_purge_timeout
const unsigned int default_stat_interval
const bool default_log_cleaning_thread
const bool default_log_execution_watcher_thread
const unsigned int default_max_client_data
const bool default_log_notification_thread
const unsigned int default_markdel_batch_size
const bool default_is_log
const unsigned int default_reserve_dump_space
const unsigned int default_del_batch_size
const unsigned int default_job_counters_interval
const bool default_log_statistics_thread
const bool default_use_hostname
const unsigned int default_scan_batch_size
const unsigned int default_network_timeout
USING_NCBI_SCOPE
Definition: ns_server.cpp:41
const unsigned int kSubmitCounterInitialValue
Definition: ns_server.hpp:49
const string kNodeIDFileName("NODE_ID")
static pcre_uint8 * buffer
Definition: pcretest.c:1051
Defines CRequestContext class for NCBI C++ diagnostic API.
static CNamedPipeClient * client
SNSRegistryParameters group_reg
string state_transition_perf_log_classes
unsigned int del_batch_size
SErrorEmulatorParameter debug_mem_count
string state_transition_perf_log_queues
SErrorEmulatorParameter debug_fd_count
unsigned int stat_interval
unsigned int markdel_batch_size
SErrorEmulatorParameter debug_write_delay
unsigned int reserve_dump_space
SNSRegistryParameters affinity_reg
unsigned short port
SErrorEmulatorParameter debug_conn_drop_after_write
SErrorEmulatorParameter debug_conn_drop_before_write
unsigned int scan_batch_size
SErrorEmulatorParameter debug_reply_with_garbage
unsigned int job_counters_interval
SNSRegistryParameters scope_reg
unsigned int max_client_data
SServer_Parameters::
Definition: server.hpp:434
#define _ASSERT
static wxAcceleratorEntry entries[3]
Modified on Wed Apr 17 13:08:28 2024 by modify_doxy.py rev. 669887