HDK
|
#include <PDG_Service.h>
Classes | |
struct | ClientInfo |
Service client array entry. More... | |
Public Types | |
enum | ServiceAcquireResult { eServiceAcquireSuccess, eServiceAcquireSuccessLocked, eServiceAcquireBusy, eServiceAcquireLocked, eServiceAcquireInvalidLock } |
Enumeration of return codes from acquireClient. More... | |
Public Types inherited from PDGT_TypeInstance< EnumType > | |
using | BaseType = PDGT_BaseType< EnumType > |
Static Public Attributes | |
static const UT_StringHolder | theDataVersion |
Service data format version. More... | |
Additional Inherited Members | |
Protected Attributes inherited from PDGT_TypeInstance< EnumType > | |
const BaseType * | myBaseType |
PDGT_ValueArgs | myExtraArgs |
bool | myReloading |
Definition at line 40 of file PDG_Service.h.
Enumeration of return codes from acquireClient.
Definition at line 47 of file PDG_Service.h.
PDG_Service::PDG_Service | ( | const PDG_BaseType * | type, |
const PDGT_ValueArgs & | extra_args, | ||
const UT_StringHolder & | service_command, | ||
bool | internal_service | ||
) |
Constructs a new service instance with a default pool size of 1, and no connection information.
|
override |
ServiceAcquireResult PDG_Service::acquireClient | ( | UT_StringHolder & | client_name, |
PDG_WorkItemID | item_lock | ||
) |
Acquires a client, which reserves it for the caller.
ClientInfo* PDG_Service::addPendingClient | ( | const UT_StringHolder & | server_address, |
int | server_port, | ||
int | client_num | ||
) |
Adds a pending service client, which can be waiting on using waitForClients
bool PDG_Service::cleanupService | ( | UT_WorkBuffer & | errors, |
bool | stop_mq_server, | ||
bool | wait_for_clients | ||
) |
Cleans up the clients in the service. This method is public so that schedulers can call it on services they manage.
void PDG_Service::clearScheduler | ( | ) |
Clears the scheduler information associated with a scheduler service
ClientInfo* PDG_Service::client | ( | const UT_StringHolder & | name | ) |
Returns the service client info for a particular client.
|
inline |
Definition at line 201 of file PDG_Service.h.
|
inline |
Definition at line 213 of file PDG_Service.h.
UT_StringHolder PDG_Service::clientName | ( | int | client_num | ) | const |
Queries the name of a particular service client, using its client number
UT_StringArray PDG_Service::clientNames | ( | ) | const |
Queries the list of all active service client names.
|
inline |
Definition at line 269 of file PDG_Service.h.
|
inline |
Definition at line 288 of file PDG_Service.h.
|
inline |
Definition at line 174 of file PDG_Service.h.
|
inline |
Definition at line 221 of file PDG_Service.h.
|
inline |
Definition at line 229 of file PDG_Service.h.
PDGN::PDGN_Message* PDG_Service::executeWorkItem | ( | UT_WorkBuffer & | errors, |
const UT_StringHolder & | client_name, | ||
const PDG_WorkItem * | work_item | ||
) |
Submits a work item to a service client asynchronously, and returns the pending message handle for the job.
PDGN::PDGN_Message* PDG_Service::executeWorkItem | ( | UT_WorkBuffer & | errors, |
const UT_StringHolder & | client_name, | ||
const PDG_WorkItem * | work_item, | ||
const UT_WorkBuffer & | script_buffer | ||
) |
Submits a work item to a service client asychronously, and returns the pending messae handle for the job. This variant of the method allows the caller to supply a custom script that will run instead of the standard job script or script data associated with the work item.
UT_StringHolder PDG_Service::getCommand | ( | const char * | server_address, |
int | server_port, | ||
int | client_num | ||
) | const |
Returns the command for the service client with the specified client number, as a string.
void PDG_Service::getCommand | ( | UT_StringArray & | command_tokens, |
const char * | server_address, | ||
int | server_port, | ||
int | client_num | ||
) | const |
Returns the command for the service client with the specified client number, as an array of arguments
|
inline |
Definition at line 412 of file PDG_Service.h.
|
inline |
Returns true if the service has errors when starting.
Definition at line 161 of file PDG_Service.h.
|
inline |
Returns true if the service has an active polling client.
Definition at line 407 of file PDG_Service.h.
void PDG_Service::incrementStartingClientsCount | ( | ) |
Increments the number of actively starting client.
|
inline |
Definition at line 168 of file PDG_Service.h.
|
inline |
Returns true if the service is internal to PDG. Internal services cannot be directly managed by users.
Definition at line 148 of file PDG_Service.h.
|
inline |
Definition at line 157 of file PDG_Service.h.
bool PDG_Service::isStartingOrRunning | ( | ) | const |
Returns true if the service is start or is already running.
bool PDG_Service::isStoppingOrStopped | ( | ) | const |
Returns true if the service is stopping, or has already stopped.
|
inline |
Definition at line 304 of file PDG_Service.h.
|
inline |
Definition at line 302 of file PDG_Service.h.
|
inline |
Definition at line 207 of file PDG_Service.h.
|
inline |
Definition at line 188 of file PDG_Service.h.
|
inline |
Definition at line 194 of file PDG_Service.h.
|
inline |
Definition at line 181 of file PDG_Service.h.
|
inline |
Definition at line 143 of file PDG_Service.h.
|
inline |
Definition at line 256 of file PDG_Service.h.
bool PDG_Service::ping | ( | int | client_num, |
UT_WorkBuffer & | errors | ||
) | const |
Pings the specified client, and returns true if the client was reachable
const UT_StringHolder& PDG_Service::pollingClientName | ( | ) | const |
Returns the name of the polling client, if one exists.
|
inline |
Definition at line 276 of file PDG_Service.h.
|
inline |
Definition at line 282 of file PDG_Service.h.
bool PDG_Service::releaseClient | ( | UT_WorkBuffer & | errors, |
const UT_StringHolder & | client_name, | ||
PDG_ServiceResetWhen | reset_when, | ||
PDG_ServiceResetType | reset_type, | ||
int64 | memory_usage | ||
) |
Releases a client that was previously acquired, but does not unlock it.
bool PDG_Service::resetClient | ( | UT_WorkBuffer & | errors, |
const UT_StringHolder & | client_name = UT_StringHolder::theEmptyString |
||
) |
Resets a specific service client, or all clients if empty string is passed in as the client_name
bool PDG_Service::restartClient | ( | UT_WorkBuffer & | errors, |
const UT_StringHolder & | client_name | ||
) |
Restarts a service client. If client_name is empty string all clients are restarted.
|
inline |
Returns the name of the graph that owns the scheduler that created the service, if it's a scheduler service
Definition at line 249 of file PDG_Service.h.
|
inline |
Returns the name of the scheduler associated with the service, if it's a scheduler service
Definition at line 244 of file PDG_Service.h.
PDG_Scheduler* PDG_Service::serviceScheduler | ( | UT_WorkBuffer & | errors | ) | const |
Queries and returns the scheduler associated with the service, if the service is a scheduler service
|
inline |
Sets/gets the autostart flag, which indicates that the service will start automatically when work items need to use it.
Definition at line 166 of file PDG_Service.h.
|
inline |
Sets/gets the directory that service clients should write their log files to.
Definition at line 199 of file PDG_Service.h.
|
inline |
Sets how the service itself should log output.
Definition at line 211 of file PDG_Service.h.
|
inline |
Sets/gets the command line string that should be used to start clients running in the service pool
Definition at line 267 of file PDG_Service.h.
Sets the service connection timeout in milliseconds.
Definition at line 286 of file PDG_Service.h.
void PDG_Service::setData | ( | PY_PyObject * | new_data | ) |
Sets/gets an opaque Python data object that can be stored on the service.
|
inline |
Sets/gets the names for the environment variables to be set in this job's environment. This only applies if the service does not have a scheduler.
Definition at line 219 of file PDG_Service.h.
|
inline |
Sets/gets the values for the environment variables to be set in this job's environment. This only applies if the service does not have a scheduler.
Definition at line 227 of file PDG_Service.h.
Definition at line 297 of file PDG_Service.h.
|
inline |
Sets the memory limit and reset type for the service.
Definition at line 292 of file PDG_Service.h.
|
inline |
Sets/gets the directory that the MQ relay writes its logs to.
Definition at line 205 of file PDG_Service.h.
Sets/gets the log level for the MQ process that relays messages between clients and the PDG graph
Definition at line 186 of file PDG_Service.h.
Sets/gets the port used by the MQ relay.
Definition at line 192 of file PDG_Service.h.
|
inline |
Sets/gets the MQ url that the service should use to relay messages between service clients and the PDG graph
Definition at line 179 of file PDG_Service.h.
|
inline |
Sets/gets the unique name for the service. The name of the service is unique to the PDG_ServiceManager that created it.
Definition at line 141 of file PDG_Service.h.
|
inline |
Sets/gets the service owner type – either a session service or a scheduler service
Definition at line 254 of file PDG_Service.h.
|
inline |
Sets/gets the persistent flag, which determines whether a service should be persisted to the pdgservice JSON configuration file. A service that isn't persistent will be lost when the Houdini session is closed.
Definition at line 155 of file PDG_Service.h.
Sets/gets the pool size for the service, which determines the number of concurrent client processes that service executes
Definition at line 274 of file PDG_Service.h.
Sets/gets the connection port for the service itself.
Definition at line 280 of file PDG_Service.h.
void PDG_Service::setScheduler | ( | const UT_StringHolder & | name, |
const UT_StringHolder & | context_name | ||
) |
For scheduler services, sets the name of the scheduler and graph that created the service.
|
inline |
Sets/gets the current state of the service.
Definition at line 260 of file PDG_Service.h.
void PDG_Service::startPollingClient | ( | ) |
Starts a background thread that polls the ready listener until all service clients have connected
PDG_ServiceStartResult PDG_Service::startService | ( | UT_WorkBuffer & | errors, |
bool | background | ||
) |
Stats a service pool. If background is true the service processes are start asynchronously, and control immediately returns after calling this function. It's up to the caller to ensure that the service has started before using it. Returns either success, failure, or already- running.
|
inline |
Definition at line 262 of file PDG_Service.h.
bool PDG_Service::stopClient | ( | UT_WorkBuffer & | errors, |
const UT_StringHolder & | client_name | ||
) |
Stops a service client and kills the process associated with it. The client can be started again at a later point using restartClient. If client_name is empty string all clients are stoppped.
void PDG_Service::stopPollingClient | ( | ) |
This will force stop the ready listener. If you want to wait for it to complete, you should call waitForClients() instead.
bool PDG_Service::stopService | ( | UT_WorkBuffer & | errors, |
bool | ignore_stopped | ||
) |
Stops the service if it's running, and returns a boolean to indiate the status.
bool PDG_Service::unlockClient | ( | PDG_WorkItemID | item_lock, |
PDG_ServiceResetType | reset_type, | ||
UT_WorkBuffer & | errors | ||
) |
Unlocks a service client.
void PDG_Service::waitForClients | ( | ) |
Waits for all pending service clients to connect, and then terminates the ready listener
|
static |
Service data format version.
Definition at line 44 of file PDG_Service.h.