process_measurement
mlte/measurement/process_measurement.py
Base class for measurement of external processes asynchronously.
ProcessMeasurement
Bases: Measurement
Base class to be extended to measure external processes.
Source code in mlte/measurement/process_measurement.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 |
|
__init__(instance, identifier)
Initialize a new ProcessMeasurement measurement.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier
|
str
|
A unique identifier for the measurement |
required |
Source code in mlte/measurement/process_measurement.py
47 48 49 50 51 52 53 54 55 56 |
|
evaluate_async(pid, *args, **kwargs)
Monitor an external process at pid
in a separate thread until it stops.
Equivalent to evaluate(), but does not return the value immediately as it works in the background.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pid
|
int
|
The process identifier |
required |
Source code in mlte/measurement/process_measurement.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
start_process(process, arguments)
staticmethod
Initialize an external process running training or similar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
process
|
str
|
The full path to a process to run. |
required |
arguments
|
List[str]
|
A list of string arguments for the process. |
required |
Returns:
Type | Description |
---|---|
int
|
the id of the process that was created. |
Source code in mlte/measurement/process_measurement.py
36 37 38 39 40 41 42 43 44 45 |
|
start_script(script, arguments)
staticmethod
Initialize an external Python process running training or similar script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
script
|
str
|
The full path to a Python script with the training or equivalent process to run. |
required |
arguments
|
List[str]
|
A list of string arguments for the process. |
required |
Returns:
Type | Description |
---|---|
int
|
the id of the process that was created. |
Source code in mlte/measurement/process_measurement.py
25 26 27 28 29 30 31 32 33 34 |
|
wait_for_output(poll_interval=1)
Needed to get the output of a measurement executed in parallel using evaluate_async. Waits for the thread to finish.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
poll_interval
|
int
|
The poll interval in seconds |
1
|
Returns:
Type | Description |
---|---|
Value
|
The resulting value of measurement execution, with semantics |
Source code in mlte/measurement/process_measurement.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|