Methods ¶
Instance Methods ¶
addClients(scheduler=None)
→ pdg.ServiceAddClientBlock
Opens a context manager that waits for any pending clients to connect. If a
scheduler is passed in, the context manager can be interrupted if the
scheduler’s cook is canceled before the service clients are initialized.
addPendingClient(server_addr, server_port, client_index)
→ pdg.ServiceClientInfo
Adds a client that’s pending connection, and returns its client info. This
method should be called in a with statement using pdg.Service.addClients.
client(client_name)
→ pdg.ServiceClientInfo
Return the client info given the name of the client.
schedulerContextName()
→ str
Returns the name of the graph context of the scheduler associated with the service.
schedulerName()
→ str
Returns the name of the scheduler associated with the service.
setScheduler(name, context_name)
Stores the name of the scheduler instance and its graph context associated with the service, which is used to stop and start the service.
getCommand(server_address, server_port, client_num)
→ str
Returns a service client’s command string, which can be used by the caller to start the client process. It is the responsibility of the caller to expand any environment variables or PDG tokens in the command string.
getCommandArgs(server_address, server_port, client_num)
→ list
Returns a service client’s command as a list of arguments, which can be used by the caller to start the client process. It is the responsibility of the caller to expand any environment variables or PDG tokens in the argument list.
getPollingClient()
: PDGNPollingClient
Returns the polling client for this service’s MQ server, if applicable. Returns None if there is none; for example, when the service is idle.
getServiceClientName(client_num)
→ str
This method returns the name of the client with the provided client number.
The client number is zero-indexed and must be between 0 and poolSize - 1,
inclusive.
stop(stop_mq_server, wait_for_clients)
→ bool
Stops the service. When stop_mq_server is False, this method will not
stop the MQ server. When wait_for_clients is True, this method will not
return until all of the clients have shutdown and disconnected from the MQ
server. Returns True for success and False for failure.
clearScheduler()
When the service is a scheduler service, this method will clear the scheduler associated wtih the service. The scheduler must be set again before the service can be started.
clients
: list
of str
Property
The list of client names that have been added to the service.
clientLogDir
: str
Property
The directory where logfiles will be written by client instances.
clientLogType
: pdg.serviceClientLogType
Property
The log type used by client instances.
command
: str
Property
The command line arguments that the PDG service manager will use to start client instances of the service.
connectionTimeout
: str
Property
Stores the connection timeout used by the service. The timeout is used for all connections between service clients, the MQ server, and Houdini.
data
: object
Property
An pdg.Dictionary containing custom information that the scheduler associated with the registered service needs to start and stop the service.
envVarNames
: list
of str'
Property
The names of the environment variables to be added to the environment for this service’s processes.
envVarValues
: list
of str
Property
The values of the environment variables to be added to the environment for this service’s processes.
extraArguments
: list
of str
Property
The list of extra arguments to append to the end of the service job’s command line
isAutoStart
: bool
Property
Indicates if the service should be automatically started on the first PDG graph cook where the service is used (if the service is not already running).
isInternal
: bool
Property
Indicates whether the service is internal to PDG. Internal services are not available for the user to configure.
isPersistent
: bool
Property
Indicates whether or not the service is saved to the pdgservices.json
file when the pdg.ServiceManager saves service definitions to disk.
memoryLimit
: `int
Property
The memory limit for service clients. When this limit is reached, the client
is reset using the operation defined by the memoryResetType property.
memoryResetType
: pdg.serviceResetType
Property
The type of reset operation to perform a when service client exceeds the memory limit.
mqLogDir
: str
Property
The directory where the log of the MQ server created for the service will be written to.
mqLogLevel
: int
Property
The logging level of the MQ server that is created for the service.
(0 = None, 1 = Errors, 2 = Warnings, 3 = All)
mqPort
: int
Property
Stores the port that the MQ server associated with the service is using.
mqUrl
: str
Property
Stores the URL of the MQ server that the service is using.
name
: str
Property
The name of the service.
owner
: pdg.serviceOwner
Property
Indicates whether the service is owned by a scheduler node or the Houdini session.
poolSize
: int
Property
The number of clients available in the service pool.
port
: int
Property
The port that the service will use.
runningScheduler
: pdg.Scheduler
Property
Returns the scheduler instance used to create service client jobs, if the service is a pdg.serviceOwner.Scheduler service.
serviceSchedulerType
: pdg.serviceSchedulerType
Property
Configures how the service finds its scheduler, if the service was created
as a pdg.serviceOwner.Scheduler service. The type value passed in
should be one of the pdg.serviceSchedulerType enum values.
schedulerTypeName
: str
Property
The type name for the scheduler to use for creating service clients. The first scheduler of that type will be used to create the client processes when the service starts. This option is only meaningful when creating a pdg.serviceOwner.Scheduler service with the pdg.serviceSchedulerType.FirstType service scheduler type.
script
: str
Property
The path to the script that defines the service logic.
state
: pdg.serviceState
Property
Indicates the state of the service (stopped, starting, running).