-
Notifications
You must be signed in to change notification settings - Fork 1
Process manager interface
This page provides an entry point to the way the drunc server should be interfaced.
This document refers to the Process manager in particular. Its proto file can be found here
Remember that all the messages sent to and received from the process manager follow the drunc
schema described here. All the messages described here will end up in some form or another in the data
fields of the Request
and Response
after being Any
fied.
Note that the ProcessManager
does not have children, so the children
field will always be an empty array in the Response
.
This message represents a set of hosts one which a process is allowed to run. This has not been particularly well thought off, but the assumption here is that there will either be a list of acceptable hosts or a list of groups of hosts on which the process can be run.
message ProcessRestriction {
repeated string allowed_hosts = 1;
repeated string allowed_host_types = 2;
}
This message is used to request logs from processes. It uses a query
(ProcessQuery) to figure out which process to get the logs from. The how_far
integer is the number of lines the user wants back.
message LogRequest {
ProcessQuery query = 1;
int32 how_far = 2;
}
This is a line from the logs. uuid
is the process unique identifier (ProcessUUID), and line
is the text of the log.
message LogLine {
ProcessUUID uuid = 1;
string line = 2;
}
This is a process unique identifier, encoded in a string.
message ProcessUUID {
string uuid = 1;
}
This message encodes all the metadata used for a process. In theory, this is not strictly needed by the process to be executed, but I realise there is a user
field here, which does not fall in that category... Oh well.
-
uuid
is the process unique identifier (ProcessUUID) -
user
is the user who started the process -
session
is the DAQ session that is associated with this process. There may be some processes that are not associated with any session (or associated with all the sessions?) hence this is an optional field. -
name
is a "friendly name" that can be used to query the process (for example in a ProcessQuery)
message ProcessMetadata {
ProcessUUID uuid = 1;
string user = 2;
optional string session = 3;
string name = 4;
}
This message can be used to query the processes run by the process manager. ProcessQuery can correspond to one or more processes (or even zero). Generally, an OR
is formed between all the field by the process manager to get the corresponding processes.
-
uuids
is a vector of ProcessUUID to directly get process by UUIDs. -
names
is a vector of processes friendly names. -
user
is the user -
session
: the session associated with the process.
message ProcessQuery {
repeated ProcessUUID uuids = 1;
repeated string names = 2;
string user = 3;
string session = 4;
}
A ProcessDescription carries all the information necessary to start a process on any host. It uses two sub-message types, the StringList and ExecAndArgs. The fields mean:
-
metadata
: to carry the ProcessMetadata of the process -
env
: this is a key: value map (string to string) that stores the environment variables that need to be set for the process to run. -
executable_and_arguments
is a vector of executable and argument in the ExecAndArgs format. Multiple executables can be specified and executed sequentially. -
process_execution_directory
(new after 27th Sept 2023) is the place where the process should be executed. -
process_logs_path
(new after 27th Sept 2023) is the place where the log will be stored.
message ProcessDescription {
// omitting subtypes
ProcessMetadata metadata = 1;
map<string,string> env = 2;
repeated ExecAndArgs executable_and_arguments = 3;
string process_execution_directory = 4;
string process_logs_path = 5;
}
... is an unused vector of string. This should be deleted/ignored.
This message represents an executable and its arguments.
message ExecAndArgs{
string exec = 1;
repeated string args = 2;
};
This message carries the description of a running process, and, eventually, the exit code.
-
process_description
carries the ProcessDescription of the process, hence information like which executable, arguments, environment, etc. -
process_restriction
carries information about the host on which the process is running (well, really just the name of the host for now). -
status_code
is a very simple enum that show if a process is running or not (0: Running, 1: Dead). -
return_code
is the return code of the process. -
uuid
is the process unique identifier ProcessUUID
message ProcessInstance {
ProcessDescription process_description = 1;
ProcessRestriction process_restriction = 2;
enum StatusCode {
RUNNING = 0;
DEAD = 1;
};
StatusCode status_code = 3;
int32 return_code = 4;
ProcessUUID uuid = 5;
}
Describes requests to start a process.
-
process_description
is used to start the process, it uses the ProcessDescription format. -
process_restriction
is used to choose the host on which the process will run. This follows the ProcessRestriction.
message BootRequest {
ProcessDescription process_description = 1;
ProcessRestriction process_restriction = 2;
}
A list of ProcessInstance.
message ProcessInstanceList{
repeated ProcessInstance values = 1;
}
This is not used and should be deleted.
message CommandNotificationMessage {
string user = 1;
string command = 2;
}
This is not used and should be deleted.
message GenericNotificationMessage {
string message = 1;
}
This is not used. The idea was to detect process exceptions, serialise them and pass them back to the client. I am not even sure this is possible so this can ignored for now.
message ExceptionNotification {
message StackLine{
string line_text = 1;
string line_number = 2;
string file = 3;
};
string error_text = 1;
repeated StackLine stack_trace = 2;
}
Each RPC call is described here.
... is already described in here.
Is used to boot processes. No resolution whatsoever is done for the executable arguments, they need to be formatted correctly by the client.
- input: BootRequest
- output: ProcessInstanceList of all the process started
- interrupts/exceptions:
-
allowed_hosts
is empty
-
For the SSH process manager, the allowed_host_types
are not allowed in the ProcessRestriction. The process manager will try each host listed in the allowed_hosts
until it one leads to successful execution of the process (which can itself fail).
Restart one (and only one) process. If the process is running, it will be killed and restarted. If the process is already dead, it simply boots it.
- input: ProcessQuery
- output: ProcessInstanceList containing the one process that was started (should be
ProcessInstance
instead). - interrupts/exceptions:
- The input process query leads to more than one processes, or zero process.
Kill one or more processes.
- input: ProcessQuery
- output: ProcessInstanceList containing the processes that were killed.
- interrupts/exceptions:
- None known.
Remove the dead processes from the process manager. One cannot restart processes that have been flushed, and they will not appear in the ps.
- input: ProcessQuery
- output: ProcessInstanceList containing the processes that were flushed.
- interrupts/exceptions:
- None known.
List the processes
- input: ProcessQuery
- output: ProcessInstanceList containing the processes queried.
- interrupts/exceptions:
- None known.
Stream the logs from a specific process
- input: LogRequest
- output (streamed): LogLine
- interrupt/exceptions:
- The input process query leads to more than one processes, or zero process.
- Home
- Release notes
- Roadmap
- Check before merging
- Setup
- Operation
- Developers
- Testing