CNetScheduleAPI Class Reference
[Client API to NCBI NetSchedule]

Search Toolkit Book for CNetScheduleAPI

#include <netschedule_api.hpp>

List of all members.


Detailed Description

Client API for NCBI NetSchedule server.

This API is logically divided into two sections: Job Submitter API and Worker Node API.

As objects of this class are only smart pointers to the real implementation, it is advisable that these objects are allocated on the stack rather than the heap.

See also:
CNetServiceException, CNetScheduleException

Definition at line 86 of file netschedule_api.hpp.

Private Types

typedef unsigned TJobMask
typedef pair< string, string > TJobTag
 Key-value pair, value can be empty.
typedef vector< TJobTagTJobTags
enum  EJobStatus {
  eJobNotFound = -1, ePending = 0, eRunning, eReturned,
  eCanceled, eFailed, eDone, eReading,
  eConfirmed, eReadFailed, eTimeout, eReadTimeout,
  eLastStatus
}
 Job status codes NB: eReturned, eTimeout and eReadTimeout states are visible only in job history, and ePending cannot be there. More...
enum  EJobMask {
  eEmptyMask = 0, eExclusiveJob = (1 << 0), eOutOfOrder = (1 << 1), eForEachNode = (1 << 2),
  eSystemJob = (1 << 3), eUserMask = (1 << 16)
}
 Job masks. More...
enum  EConnectionMode { eCloseConnection, eKeepConnection }
 Connection management options. More...

Private Member Functions

 NCBI_NET_COMPONENT (NetScheduleAPI)
 CNetScheduleAPI (const string &service_name, const string &client_name, const string &queue_name)
 Construct the client without linking it to any particular server.
void SetProgramVersion (const string &pv)
 Set program version (like: MyProgram v.
const string & GetProgramVersion () const
 Get program version string.
const string & GetQueueName () const
 Return Queue name.
CNetScheduleSubmitter GetSubmitter ()
CNetScheduleExecuter GetExecuter (unsigned short control_port=0)
 Create an instance of CNetScheduleExecuter.
CNetScheduleAdmin GetAdmin ()
CNetService GetService ()
const SServerParamsGetServerParams ()
EJobStatus GetJobDetails (CNetScheduleJob &job)
 Get job details.
void GetProgressMsg (CNetScheduleJob &job)
void SetCommunicationTimeout (const STimeout &to)
NCBI_DEPRECATED void SetConnMode (EConnectionMode conn_mode)
 Please do not use this method.

Static Private Member Functions

static string StatusToString (EJobStatus status)
 Printable status type.
static EJobStatus StringToStatus (const string &status_str)
 Parse status string into enumerator value.

Classes

struct  SServerParams


Member Typedef Documentation

typedef unsigned CNetScheduleAPI::TJobMask [private]
 

Definition at line 176 of file netschedule_api.hpp.

typedef pair<string,string> CNetScheduleAPI::TJobTag [private]
 

Key-value pair, value can be empty.

Definition at line 179 of file netschedule_api.hpp.

typedef vector<TJobTag> CNetScheduleAPI::TJobTags [private]
 

Definition at line 180 of file netschedule_api.hpp.


Member Enumeration Documentation

enum CNetScheduleAPI::EConnectionMode [private]
 

Connection management options.

Enumerator:
eCloseConnection  Close connection after each call.

This mode frees server side resources, but reconnection can be costly because of the network overhead

eKeepConnection  Keep connection open (default).

This mode occupies server side resources(session thread), use this mode very carefully

Definition at line 213 of file netschedule_api.hpp.

enum CNetScheduleAPI::EJobMask [private]
 

Job masks.

Enumerator:
eEmptyMask 
eExclusiveJob  Exclusive job - the node executes only this job, even if there are processor resources.
eOutOfOrder  This jobs comes to the node before every regular jobs.
eForEachNode  This job will be scheduled to every active node.
eSystemJob  This job should be interpreted by client library, not client itself Can contain control information, e.g.

instruction for node to die

eUserMask  User's masks start from here.

Definition at line 160 of file netschedule_api.hpp.

enum CNetScheduleAPI::EJobStatus [private]
 

Job status codes NB: eReturned, eTimeout and eReadTimeout states are visible only in job history, and ePending cannot be there.

Enumerator:
eJobNotFound  No such job.
ePending  Waiting for execution.
eRunning  Running on a worker node.
eReturned  Returned back to the queue (to be rescheduled).
eCanceled  Explicitly canceled.
eFailed  Failed to run (execution timeout).
eDone  Job is ready (computed successfully).
eReading  Job has its output been reading.
eConfirmed  Final state - read confirmed.
eReadFailed  Final state - read failed.
eTimeout  Execution canceled due to timeout.
eReadTimeout  Reading timed out.
eLastStatus  Fake status (do not use).

Definition at line 124 of file netschedule_api.hpp.


Constructor & Destructor Documentation

CNetScheduleAPI::CNetScheduleAPI const string &  service_name,
const string &  client_name,
const string &  queue_name
[private]
 

Construct the client without linking it to any particular server.

Actual server (host and port) will be extracted from the job key

Parameters:
service_name Name of the service to connect to (format: LB service name or host:port)
client_name Name of the client program (project)
queue_name Name of the job queue

Definition at line 156 of file netschedule_api.cpp.


Member Function Documentation

CNetScheduleAdmin CNetScheduleAPI::GetAdmin  )  [private]
 

Definition at line 270 of file netschedule_api.cpp.

Referenced by CNSInfoCollector::DropQueue(), CNSInfoCollector::GetQueues(), CWNodeShutdownAction::operator()(), CNetScheduleControl::Run(), CNetScheduleCheck::Run(), and CNSInfoCollector::TraverseNodes().

CNetScheduleExecuter CNetScheduleAPI::GetExecuter unsigned short  control_port = 0  )  [private]
 

Create an instance of CNetScheduleExecuter.

Parameters:
port Control port that the worker node will be listening to. If omitted, the INIT command will not be sent to NetSchedule.

Definition at line 265 of file netschedule_api.cpp.

Referenced by CSampleNetScheduleNode::Run(), and CNetScheduleCheck::Run().

CNetScheduleAPI::EJobStatus CNetScheduleAPI::GetJobDetails CNetScheduleJob job  )  [private]
 

Get job details.

These attributes are not supported yet

Definition at line 281 of file netschedule_api.cpp.

References CNetScheduleJob::affinity, eCanceled, eConfirmed, eDone, eFailed, ePending, eReadFailed, eReading, eReturned, CNetScheduleJob::error_msg, eRunning, CNetScheduleJob::input, CNetScheduleJob::job_id, CNetScheduleJob::mask, CNetScheduleJob::output, NStr::ParseEscapes(), CNetScheduleJob::progress_msg, CNetScheduleJob::ret_code, and CNetScheduleJob::tags.

Referenced by CNSJobInfo::x_Load().

const string & CNetScheduleAPI::GetProgramVersion  )  const [private]
 

Get program version string.

Definition at line 170 of file netschedule_api.cpp.

void CNetScheduleAPI::GetProgressMsg CNetScheduleJob job  )  [private]
 

Definition at line 451 of file netschedule_api.cpp.

References CNetScheduleJob::job_id, NStr::ParseEscapes(), and CNetScheduleJob::progress_msg.

Referenced by CNSJobInfo::x_Load().

const string & CNetScheduleAPI::GetQueueName  )  const [private]
 

Return Queue name.

Definition at line 175 of file netschedule_api.cpp.

Referenced by CGridWorkerNode::GetQueueName(), and CGridWorkerNode::x_AreMastersBusy().

const CNetScheduleAPI::SServerParams & CNetScheduleAPI::GetServerParams  )  [private]
 

Definition at line 446 of file netschedule_api.cpp.

Referenced by CGridWorkerNode::GetServerOutputSize(), and SNetScheduleSubmitterImpl::SubmitJobImpl().

CNetService CNetScheduleAPI::GetService  )  [private]
 

Definition at line 275 of file netschedule_api.cpp.

Referenced by CGridWorkerNode::GetClientName(), CGridWorkerNode::GetServiceName(), CGridWorkerNode::IsTimeToRebalance(), SetCommunicationTimeout(), SetConnMode(), and CGridWorkerNode::x_AreMastersBusy().

CNetScheduleSubmitter CNetScheduleAPI::GetSubmitter  )  [private]
 

Definition at line 260 of file netschedule_api.cpp.

Referenced by CNSInfoCollector::CancelJob(), CGridClientApp::Init(), CSampleNetScheduleClient::Run(), and CNetScheduleCheck::Run().

CNetScheduleAPI::NCBI_NET_COMPONENT NetScheduleAPI   )  [private]
 

void CNetScheduleAPI::SetCommunicationTimeout const STimeout to  )  [inline, private]
 

Definition at line 209 of file netschedule_api.hpp.

References GetService(), and CNetService::SetCommunicationTimeout().

NCBI_DEPRECATED void CNetScheduleAPI::SetConnMode EConnectionMode  conn_mode  )  [inline, private]
 

Please do not use this method.

The eKeepConnection connection mode is the default now.

Definition at line 227 of file netschedule_api.hpp.

References eCloseConnection, eOff, eOn, GetService(), and CNetService::SetPermanentConnection().

void CNetScheduleAPI::SetProgramVersion const string &  pv  )  [private]
 

Set program version (like: MyProgram v.

1.2.3)

Program version is passed to NetSchedule queue so queue controls versions and does not allow obsolete clients to connect and submit or execute jobs

Definition at line 163 of file netschedule_api.cpp.

Referenced by CGridClientApp::Init(), CGridCgiApplication::InitGridClient(), and CRemoteAppDispatcher::x_CreateNSClient().

string CNetScheduleAPI::StatusToString EJobStatus  status  )  [static, private]
 

Printable status type.

Definition at line 180 of file netschedule_api.cpp.

References _ASSERT, eCanceled, eConfirmed, eDone, eFailed, eJobNotFound, ePending, eReadFailed, eReading, eReadTimeout, eReturned, eRunning, eTimeout, and kEmptyStr.

Referenced by CQueue::Cancel(), CJob::GetField(), CJobRun::GetField(), CNetScheduleAdmin::PrintQueue(), CJobStatusTracker::PrintStatusMatrix(), CNetScheduleHandler::ProcessDump(), CNetScheduleHandler::ProcessStatusSnapshot(), CNSInfoRenderer::RenderJob(), CNSInfoRenderer::RenderJobByStatus(), CJobStatusTracker::ReportInvalidStatus(), CNSInfoCollector::TraverseJobs(), CGridCgiApplication::x_CheckJobStatus(), CQueue::x_PrintJobStat(), CQueue::x_PrintShortJobStat(), and CNetScheduleHandler::x_StatisticsNew().

CNetScheduleAPI::EJobStatus CNetScheduleAPI::StringToStatus const string &  status_str  )  [static, private]
 

Parse status string into enumerator value.

Acceptable string values: Pending, Running, Returned, Canceled, Failed, Done, Reading, Confirmed, ReadFailed, Timeout, ReadTimeout Abbreviated Pend, Run, Return, Cancel, Fail

Returns:
eJobNotFound if string cannot be parsed

Definition at line 202 of file netschedule_api.cpp.

References NStr::CompareNocase(), eCanceled, eConfirmed, eDone, eFailed, eJobNotFound, ePending, eReadFailed, eReading, eReadTimeout, eReturned, eRunning, and eTimeout.

Referenced by CQueryFunctionEQ::Evaluate(), CNetScheduleHandler::ProcessPrintQueue(), CNSRemoveJobControlApp::Run(), and CNetScheduleAdmin::StatusSnapshot().


The documentation for this class was generated from the following files:
Generated on Wed Dec 9 08:03:12 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Wed Dec 09 08:19:32 2009 by modify_doxy.py rev. 173732