WattsonRemoteService#
- class wattson.services.wattson_remote_service.WattsonRemoteService(wattson_client: WattsonClient, service_id: int | None = None, auto_sync: bool = True)#
Bases:
WattsonRemoteObject
,WattsonServiceInterface
A remote representation for a WattsonService
Methods
call
callable_methods
Whether this service is connected to a WattsonService (i.e., whether the associated WattsonService exists)
expand_configuration
from_service_configuration
get_artifact_paths
get_configuration
get_info
get_original_class
- returns:
The PID of the service process or None if the service is not running.
Returns the service's priority
Returns the command to be executed for starting this service on the network node
- returns:
Whether the service has been killed.
- returns:
Whether the service is currently running.
Sends the SIGKILL to the process.
Polls the service process.
Restarts the service.
set_configuration
Start the service.
Stop the service.
Synchronize internal state from API information.
Synchronizes the service state with the actual service.
Waits for the service process to terminate.
Attributes
configuration
deployment_class_name
expanded_configuration
id
name
- __init__(wattson_client: WattsonClient, service_id: int | None = None, auto_sync: bool = True)#
- connected() bool #
Whether this service is connected to a WattsonService (i.e., whether the associated WattsonService exists)
- Returns:
True iff the associated WattsonService exists.
- Return type:
bool
- get_pid() int | None #
- Returns:
The PID of the service process or None if the service is not running.
- Return type:
Optional[int]
- get_priority() ServicePriority #
Returns the service’s priority
- Returns:
The associated ServicePriority object
- Return type:
- get_start_command() List[str] #
Returns the command to be executed for starting this service on the network node
- Returns:
The start command as a list of strings.
- Return type:
List[str]
- is_killed() bool #
- Returns:
Whether the service has been killed.
- Return type:
bool
- is_running() bool #
- Returns:
Whether the service is currently running.
- Return type:
bool
- kill() bool #
Sends the SIGKILL to the process.
- Returns:
True iff the service has been terminated.
- Return type:
bool
- poll() int | None #
Polls the service process.
- Returns:
None or the return code of the process.
- Return type:
Optional[int]
- restart(refresh_config: bool = False) bool #
Restarts the service. Shortcut for (blocking) stop and start calls.
- Parameters:
refresh_config (bool, optional) – Whether to refresh the config even if it already exists (Default value = False)
- Returns:
Whether the service has been restarted successfully.
- Return type:
bool
- start(refresh_config: bool = False) bool #
Start the service.
- Parameters:
refresh_config (bool, optional) – Whether to refresh the config even if it already exists. (Default value = False)
- Returns:
True iff the service has been started.
- Return type:
bool
- stop(wait_seconds: float = 5, auto_kill: bool = True, async_callback: Callable[[WattsonServiceInterface], None] | None = None) bool #
Stop the service.
- Parameters:
wait_seconds (float, optional) – Number of seconds to wait for the service to gracefully terminate. (Default value = 5)
auto_kill (bool, optional) – Whether to kill the service automatically after the waiting timeout has been exceeded. (Default value = False)
async_callback (Optional[Callable[['WattsonServiceInterface'], None]], optional) – An optional callback to call once the service has terminated. Makes the stop method return immediately. (Default value = None)
- Returns:
None if an async_callback is given, else True iff the service has been terminated.
- Return type:
bool
- sync_from_remote_representation(service_info: WattsonRemoteServiceRepresentation) bool #
Synchronize internal state from API information.
- Parameters:
service_info (WattsonRemoteServiceRepresentation) – API information of the WattsonService
- synchronize(force: bool = False, block: bool = True)#
Synchronizes the service state with the actual service.
- Parameters:
force (bool, optional) – (Default value = False)
block (bool, optional) – (Default value = True)
- wait(timeout: float | None = None) int #
Waits for the service process to terminate. If a timeout is given and the process does not terminate during the timeout, a TimeoutExpired exception is thrown.
- Parameters:
timeout (Optional[float], optional) – An optional timeout. (Default value = None)
- Returns:
The processes return code.
- Return type:
int