|
HDK
|
#include <PDG_Service.h>
Inheritance diagram for PDG_Service:Public Member Functions | |
| PDG_Service (const PDG_BaseType *type, const PDGT_ValueArgs &extra_args, bool internal_service) | |
| ~PDG_Service () override | |
| void | setName (const UT_StringHolder &name) |
| const UT_StringHolder & | name () const |
| bool | isInternal () const |
| void | setPersistent (bool persistent) |
| bool | isPersistent () const |
| void | setAutoStart (bool auto_start) |
| bool | isAutoStart () const |
| void | setData (const UT_OptionsHolder &new_data) |
| Sets/gets the custom data dictionary on the service. More... | |
| const UT_OptionsHolder & | data () |
| void | setMqUrl (const UT_StringHolder &url) |
| const UT_StringHolder & | mqUrl () const |
| void | setMqLogLevel (int log_level) |
| int | mqLogLevel () const |
| void | setMqPort (int mq_port) |
| Sets/gets the port used by the MQ relay. More... | |
| int | mqPort () const |
| void | setClientLogDir (const UT_StringHolder &log_dir) |
| const UT_StringHolder & | clientLogDir () const |
| void | setMqLogDir (const UT_StringHolder &log_dir) |
| Sets/gets the directory that the MQ relay writes its logs to. More... | |
| const UT_StringHolder & | mqLogDir () const |
| void | setClientLogType (PDG_ServiceLogType log_type) |
| Sets how the service itself should log output. More... | |
| PDG_ServiceLogType | clientLogType () const |
| void | setEnvVarNames (const UT_StringArray &env_var_names) |
| const UT_StringArray & | envVarNames () const |
| void | setEnvVarValues (const UT_StringArray &env_var_values) |
| const UT_StringArray & | envVarValues () const |
| void | setExtraArguments (const UT_StringArray &args) |
| Sets/gets the extra args array for the service. More... | |
| const UT_StringArray & | extraArguments () const |
| const UT_StringHolder & | command () const |
| Returns the command line string for the service. More... | |
| const UT_StringHolder & | script () const |
| Returns the script file path for the service. More... | |
| void | setServiceSchedulerType (PDG_ServiceSchedulerType type) |
| Sets the service scheduler type. More... | |
| void | setSchedulerTypeName (const UT_StringHolder &type_name) |
| Sets the scheduler type name. More... | |
| void | setScheduler (const UT_StringHolder &name, const UT_StringHolder &context_name) |
| void | clearScheduler () |
| PDG_ServiceSchedulerType | serviceSchedulerType () const |
| Returns the type of scheduler service in use. More... | |
| const UT_StringHolder & | schedulerTypeName () const |
| const UT_StringHolder & | schedulerName () const |
| const UT_StringHolder & | schedulerContextName () const |
| void | setOwner (PDG_ServiceOwner owner) |
| PDG_ServiceOwner | owner () const |
| void | setState (PDG_ServiceState state) |
| Sets/gets the current state of the service. More... | |
| PDG_ServiceState | state () const |
| void | setPoolSize (int pool_size) |
| int | poolSize () const |
| void | setPort (int port) |
| Sets/gets the connection port for the service itself. More... | |
| int | port () const |
| void | setConnectionTimeout (int ms) |
| Sets the service connection timeout in milliseconds. More... | |
| int | connectionTimeout () const |
| void | setMemoryResetType (PDG_ServiceResetType memory_reset_type) |
| Sets the memory limit and reset type for the service. More... | |
| void | setMemoryLimit (exint memory_limit) |
| PDG_ServiceResetType | memoryResetType () const |
| exint | memoryLimit () const |
| bool | isStartingOrRunning () const |
| Returns true if the service is start or is already running. More... | |
| bool | isStoppingOrStopped () const |
| Returns true if the service is stopping, or has already stopped. More... | |
| bool | isRunningOnScheduler (const PDG_Scheduler *scheduler) |
| Returns true if the service is using the specified scheduler. More... | |
| PDG_Scheduler * | runningScheduler () const |
| Returns the scheduler that the service is running on, if any. More... | |
| UT_StringArray | clientNames () const |
| Queries the list of all active service client names. More... | |
| UT_StringHolder | clientName (int client_num) const |
| PDG_ServiceClient * | client (const UT_StringHolder &name) |
| Returns the service client info for a particular client. More... | |
| PDG_ServiceClient * | addPendingClient (const UT_StringHolder &server_address, int server_port, int client_num) |
| PDG_ServiceStartResult | startService (UT_WorkBuffer &errors, const PDG_GraphContext *context, bool background) |
| bool | resetClient (UT_WorkBuffer &errors, const UT_StringHolder &client_name=UT_StringHolder::theEmptyString) |
| bool | restartClient (UT_WorkBuffer &errors, const UT_StringHolder &client_name) |
| bool | stopClient (UT_WorkBuffer &errors, const UT_StringHolder &client_name) |
| bool | killClient (UT_WorkBuffer &errors, const UT_StringHolder &client_name) |
| bool | stopService (UT_WorkBuffer &errors, bool ignore_stopped) |
| bool | killService (UT_WorkBuffer &errors, bool ignore_stopped) |
| bool | resumeService (UT_WorkBuffer &errors, const PDG_GraphContext *context) |
| bool | cleanupService (UT_WorkBuffer &errors, bool stop_mq_server, bool wait_for_clients) |
| PDGN::PDGN_Message * | executeWorkItem (UT_WorkBuffer &errors, const UT_StringHolder &client_name, const PDG_WorkItem *work_item, bool as_native, bool apply_wedges) |
| PDGN::PDGN_Message * | executeWorkItem (UT_WorkBuffer &errors, const UT_StringHolder &client_name, const PDG_WorkItem *work_item, const UT_WorkBuffer &script_buffer, bool as_native, bool apply_wedges) |
| void | startPollingClient (const PDG_GraphContext *context) |
| void | stopPollingClient (bool wait) |
| const UT_StringHolder & | pollingClientName () const |
| Returns the name of the polling client, if one exists. More... | |
| bool | hasPollingClient () const |
| Returns true if the service has an active polling client. More... | |
| PDGN::PDGN_PollingClientNNG * | getPollingClient () const |
| UT_StringHolder | getCommand (const char *server_address, int server_port, int client_num) const |
| void | getCommand (UT_StringArray &command_tokens, const char *server_address, int server_port, int client_num) const |
| bool | ping (int client_num, UT_WorkBuffer &errors) const |
| bool | ping (UT_WorkBuffer &errors) const |
Public Member Functions inherited from PDGT_TypeInstance< EnumType > | |
| PDGT_TypeInstance () | |
| PDGT_TypeInstance (const PDGT_BaseType< EnumType > *base_type, const PDGT_ValueArgs &extra_args) | |
| virtual | ~PDGT_TypeInstance () |
| virtual int64 | getMemoryUsage (bool inclusive) const |
| virtual bool | reloadInstance (UT_WorkBuffer &errors) |
| const BaseType * | type () const |
| const UT_StringHolder & | typeName () const |
| const PDGT_ValueArgs & | extraArgs () const |
| bool | compareType (const BaseType *other_type, bool deep=true) const |
| void | setReloading (bool is_reloading) |
| bool | isReloading () const |
Friends | |
| class | PDG_ServiceScheduler |
| class | PDG_ServiceManager |
Additional Inherited Members | |
Public Types inherited from PDGT_TypeInstance< EnumType > | |
| using | BaseType = PDGT_BaseType< EnumType > |
Protected Attributes inherited from PDGT_TypeInstance< EnumType > | |
| const BaseType * | myBaseType |
| PDGT_ValueArgs | myExtraArgs |
| bool | myReloading |
Definition at line 43 of file PDG_Service.h.
| PDG_Service::PDG_Service | ( | const PDG_BaseType * | type, |
| const PDGT_ValueArgs & | extra_args, | ||
| bool | internal_service | ||
| ) |
Constructs a new service instance with a default pool size of 1, and no connection information.
|
override |
| PDG_ServiceClient* 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
| PDG_ServiceClient* PDG_Service::client | ( | const UT_StringHolder & | name | ) |
Returns the service client info for a particular client.
|
inline |
Definition at line 113 of file PDG_Service.h.
|
inline |
Definition at line 125 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.
| const UT_StringHolder& PDG_Service::command | ( | ) | const |
Returns the command line string for the service.
|
inline |
Definition at line 223 of file PDG_Service.h.
|
inline |
Definition at line 86 of file PDG_Service.h.
|
inline |
Definition at line 133 of file PDG_Service.h.
|
inline |
Definition at line 141 of file PDG_Service.h.
| PDGN::PDGN_Message* PDG_Service::executeWorkItem | ( | UT_WorkBuffer & | errors, |
| const UT_StringHolder & | client_name, | ||
| const PDG_WorkItem * | work_item, | ||
| bool | as_native, | ||
| bool | apply_wedges | ||
| ) |
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, | ||
| bool | as_native, | ||
| bool | apply_wedges | ||
| ) |
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.
|
inline |
Definition at line 147 of file PDG_Service.h.
| 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 379 of file PDG_Service.h.
|
inline |
Returns true if the service has an active polling client.
Definition at line 374 of file PDG_Service.h.
|
inline |
Definition at line 80 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 64 of file PDG_Service.h.
|
inline |
Definition at line 73 of file PDG_Service.h.
| bool PDG_Service::isRunningOnScheduler | ( | const PDG_Scheduler * | scheduler | ) |
Returns true if the service is using the specified scheduler.
| 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.
| bool PDG_Service::killClient | ( | UT_WorkBuffer & | errors, |
| const UT_StringHolder & | client_name | ||
| ) |
Immediately kills the process associated with a service client. The client can be started again at a later point using restartClient. If client_name is empty string all clients are stoppped.
| bool PDG_Service::killService | ( | UT_WorkBuffer & | errors, |
| bool | ignore_stopped | ||
| ) |
Kills the service if it's running, and returns a boolean to indiate the status.
|
inline |
Definition at line 239 of file PDG_Service.h.
|
inline |
Definition at line 237 of file PDG_Service.h.
|
inline |
Definition at line 119 of file PDG_Service.h.
|
inline |
Definition at line 100 of file PDG_Service.h.
|
inline |
Definition at line 106 of file PDG_Service.h.
|
inline |
Definition at line 93 of file PDG_Service.h.
|
inline |
Definition at line 59 of file PDG_Service.h.
|
inline |
Definition at line 198 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
| bool PDG_Service::ping | ( | UT_WorkBuffer & | errors | ) | const |
Pings the first connected 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 211 of file PDG_Service.h.
|
inline |
Definition at line 217 of file PDG_Service.h.
| 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.
| bool PDG_Service::resumeService | ( | UT_WorkBuffer & | errors, |
| const PDG_GraphContext * | context | ||
| ) |
Resumes any service clients that were stopped previously and returns a boolean to indicate the status. Has no effect on clients that are already running.
| PDG_Scheduler* PDG_Service::runningScheduler | ( | ) | const |
Returns the scheduler that the service is running on, if any.
|
inline |
Returns the name of the graph that owns the scheduler that created the service, if it's a scheduler service
Definition at line 191 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 186 of file PDG_Service.h.
|
inline |
Returns the type name of the scheduler associated with the service, if it's a scheduler service
Definition at line 181 of file PDG_Service.h.
| const UT_StringHolder& PDG_Service::script | ( | ) | const |
Returns the script file path for the service.
|
inline |
Returns the type of scheduler service in use.
Definition at line 176 of file PDG_Service.h.
|
inline |
Sets/gets the autostart flag, which indicates that the service will start automatically when work items need to use it.
Definition at line 78 of file PDG_Service.h.
|
inline |
Sets/gets the directory that service clients should write their log files to.
Definition at line 111 of file PDG_Service.h.
|
inline |
Sets how the service itself should log output.
Definition at line 123 of file PDG_Service.h.
Sets the service connection timeout in milliseconds.
Definition at line 221 of file PDG_Service.h.
|
inline |
Sets/gets the custom data dictionary on the service.
Definition at line 84 of file PDG_Service.h.
|
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 131 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 139 of file PDG_Service.h.
|
inline |
Sets/gets the extra args array for the service.
Definition at line 145 of file PDG_Service.h.
Definition at line 232 of file PDG_Service.h.
|
inline |
Sets the memory limit and reset type for the service.
Definition at line 227 of file PDG_Service.h.
|
inline |
Sets/gets the directory that the MQ relay writes its logs to.
Definition at line 117 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 98 of file PDG_Service.h.
Sets/gets the port used by the MQ relay.
Definition at line 104 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 91 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 57 of file PDG_Service.h.
|
inline |
Sets/gets the service owner type – either a session service or a scheduler service
Definition at line 196 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 71 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 209 of file PDG_Service.h.
Sets/gets the connection port for the service itself.
Definition at line 215 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.
| void PDG_Service::setSchedulerTypeName | ( | const UT_StringHolder & | type_name | ) |
Sets the scheduler type name.
| void PDG_Service::setServiceSchedulerType | ( | PDG_ServiceSchedulerType | type | ) |
Sets the service scheduler type.
|
inline |
Sets/gets the current state of the service.
Definition at line 202 of file PDG_Service.h.
| void PDG_Service::startPollingClient | ( | const PDG_GraphContext * | context | ) |
Starts a background thread that polls the ready listener until all service clients have connected. If a graph context is passed in, the polling client will cancel automatically if the cook associated with the context is canceled
| PDG_ServiceStartResult PDG_Service::startService | ( | UT_WorkBuffer & | errors, |
| const PDG_GraphContext * | context, | ||
| 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 204 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 | ( | bool | wait | ) |
Stops the ready listener. If wait is true then the method will block until pending clients have started, otherwise it will forcible stop the polling client
| 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.
|
friend |
Definition at line 407 of file PDG_Service.h.
|
friend |
Definition at line 406 of file PDG_Service.h.