commands
drunc.process_manager.interface.commands
Classes
Functions:
boot(obj, user, session_name, configuration_file, configuration_id, override_logs, controller_log_level)
Boot a session with the given configuration file and configuration ID.
Calls the process manager driver to boot a session with the specified parameters. If there are already running processes for the given session name, it prompts the user for confirmation before proceeding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
user
|
str
|
The user for whom the session is being booted. |
required |
session_name
|
str
|
The name of the session to be booted. |
required |
configuration_file
|
str
|
The path to the configuration file to be used for booting the session. |
required |
configuration_id
|
str
|
The ID of the configuration to be used for booting the session. |
required |
override_logs
|
bool
|
A boolean indicating whether to override existing logs or not. |
required |
controller_log_level
|
str | None
|
An optional log level to override the configuration defined log level of the controller. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
InterruptedCommand
|
If the command is interrupted by the user. |
Exception
|
If any other exception occurs during the boot process. |
Source code in drunc/process_manager/interface/commands.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
dummy_boot(obj, user, n_processes, sleep, n_sleeps, session_name)
Boot a session with the given number of dummy processes.
The dummy processes will sleep for the specified duration and number of times. This command used for testing the process manager without running actual processes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
user
|
str
|
The user for whom the session is being booted. |
required |
n_processes
|
int
|
The number of dummy processes to boot. |
required |
sleep
|
int
|
The duration in seconds for which each dummy process will sleep. |
required |
n_sleeps
|
int
|
The number of times each dummy process will sleep. |
required |
session_name
|
str
|
The name of the session to be booted. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
InterruptedCommand
|
If the command is interrupted by the user. |
Source code in drunc/process_manager/interface/commands.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
flush(obj, query, width)
Flush processes matching the given query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
query
|
ProcessQuery
|
The query to match processes to be flushed. |
required |
width
|
int | None
|
The width of the table to display the flushed processes. If None, the width will be automatically calculated. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the flush process. |
Source code in drunc/process_manager/interface/commands.py
flush_decorators(f)
Decorator function to add click options to the 'flush' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
FC
|
The function to be decorated. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[FC], FC]
|
The decorated function with added options for the 'flush' command. |
Source code in drunc/process_manager/interface/commands.py
flush_impl(obj, query, width)
Implementation of the 'flush' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext | UnifiedShellContext
|
The context object containing the process manager driver and other relevant information. |
required |
query
|
ProcessQuery
|
The query to match processes to be flushed. |
required |
width
|
int | None
|
The width of the table to display the flushed processes. If None, the width will be automatically calculated. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the flush process. |
Source code in drunc/process_manager/interface/commands.py
kill(obj, query, width)
Kill processes matching the given query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
query
|
ProcessQuery
|
The query to match processes to be killed. |
required |
width
|
int | None
|
The width of the table to display the killed processes. If None, the width will be automatically calculated. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the kill process. |
Source code in drunc/process_manager/interface/commands.py
kill_decorators(f)
Decorator function to add click options to the 'kill' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
FC
|
The function to be decorated. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[FC], FC]
|
The decorated function with added options for the 'kill' command. |
Source code in drunc/process_manager/interface/commands.py
kill_impl(obj, query, width)
Implementation of the 'kill' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext | UnifiedShellContext
|
The context object containing the process manager driver and other relevant information. |
required |
query
|
ProcessQuery
|
The query to match processes to be killed. |
required |
width
|
int | None
|
The width of the table to display the killed processes. If None, the width will be automatically calculated. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the kill process. |
Source code in drunc/process_manager/interface/commands.py
log_on_server(obj, text, severity)
Log a message on the server with the specified severity level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
text
|
str
|
The log message to be sent to the server. |
required |
severity
|
str
|
The severity level of the log message. Options are DEBUG, INFO, WARNING, ERROR, CRITICAL. Default is INFO. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the logging process. |
Source code in drunc/process_manager/interface/commands.py
logs(obj, how_far, grep, query)
Display logs for processes matching the given query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
how_far
|
int
|
The number of lines of logs to display. |
required |
grep
|
str | None
|
A string to filter the logs. Only lines containing this string will be displayed. If None, all lines will be displayed. |
required |
query
|
ProcessQuery
|
The query to match processes whose logs are to be displayed. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the log retrieval process. |
Source code in drunc/process_manager/interface/commands.py
logs_decorators(f)
Decorator function to add click options to the 'logs' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
FC
|
The function to be decorated. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[FC], FC]
|
The decorated function with added options for the 'logs' command. |
Source code in drunc/process_manager/interface/commands.py
logs_impl(obj, how_far, grep, query)
Implementation of the 'logs' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext | UnifiedShellContext
|
The context object containing the process manager driver and other relevant information. |
required |
how_far
|
int
|
The number of lines of logs to display. |
required |
grep
|
str | None
|
A string to filter the logs. Only lines containing this string will be displayed. If None, all lines will be displayed. |
required |
query
|
ProcessQuery
|
The query to match processes whose logs are to be displayed. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the log retrieval process. |
Source code in drunc/process_manager/interface/commands.py
ps(obj, query, long_format, width)
Display processes matching the given query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
query
|
ProcessQuery
|
The query to match processes to be displayed. |
required |
long_format
|
bool
|
A boolean indicating whether to display the processes in long format. |
required |
width
|
int | None
|
The width of the table to display the processes. If None, the width will be automatically calculated. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the process retrieval or display. |
Source code in drunc/process_manager/interface/commands.py
ps_decorators(f)
Decorator function to add click options to the 'ps' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
FC
|
The function to be decorated. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[FC], FC]
|
The decorated function with added options for the 'ps' command. |
Source code in drunc/process_manager/interface/commands.py
ps_impl(obj, query, long_format, width)
Implementation of the 'ps' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext | UnifiedShellContext
|
The context object containing the process manager driver and other relevant information. |
required |
query
|
ProcessQuery
|
The query to match processes to be displayed. |
required |
long_format
|
bool
|
A boolean indicating whether to display the processes in long format. |
required |
width
|
int | None
|
The width of the table to display the processes. If None, the width will be automatically calculated. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the process retrieval or display. |
Source code in drunc/process_manager/interface/commands.py
restart(obj, query)
Restart processes matching the given query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
query
|
ProcessQuery
|
The query to match processes to be restarted. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the restart process. |
Source code in drunc/process_manager/interface/commands.py
restart_impl(obj, query)
Implementation of the 'restart' command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext | UnifiedShellContext
|
The context object containing the process manager driver and other relevant information. |
required |
query
|
ProcessQuery
|
The query to match processes to be restarted. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the restart process. |
Source code in drunc/process_manager/interface/commands.py
terminate(obj, width)
Terminate the process manager and all its managed processes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
ProcessManagerContext
|
The context object containing the process manager driver and other relevant information. |
required |
width
|
int | None
|
The width of the table to display the terminated processes. If None, the width will be automatically calculated. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
If any exception occurs during the termination process. |