logical_worker_entity
Module for managing database entities related to logical workers.
This module defines the LogicalWorkerEntity class, which extends the abstract base class
DatabaseEntity, to encapsulate logical-worker-specific
operations and behaviors.
LogicalWorkerEntity
Bases: DatabaseEntity[LogicalWorkerModel], RunManagementMixin, QueueManagementMixin, NameMixin
A class representing a logical worker in the database.
This class provides methods to interact with and manage a logical worker's data, including retrieving, adding, and removing run IDs and physical worker IDs from their respective lists, as well as saving or deleting the logical worker itself from the database.
Attributes:
| Name | Type | Description |
|---|---|---|
entity_info |
LogicalWorkerModel
|
An instance of the |
backend |
ResultsBackend
|
An instance of the |
Methods:
| Name | Description |
|---|---|
__repr__ |
Provide a string representation of the |
__str__ |
Provide a human-readable string representation of the |
reload_data |
Reload the latest data for this logical worker from the database. |
get_id |
Retrieve the unique ID of the logical worker. Implementation found in
|
get_additional_data |
Retrieve any additional metadata associated with the logical worker. Implementation found in
|
get_name |
Retrieve the name of the logical worker. |
get_runs |
Retrieve the IDs of the runs using this logical worker. |
add_run |
Add a run ID to the list of runs. |
remove_run |
Remove a run ID from the list of runs. |
get_physical_workers |
Retrieve the IDs of the physical workers created from this logical worker. |
add_physical_worker |
Add a physical worker ID to the list of physical workers. |
remove_physical_worker |
Remove a physical worker ID from the list of physical workers. |
get_queues |
Retrieve the list of queues that this worker is assigned to. |
save |
Save the current state of the logical worker to the database. |
load |
(classmethod) Load a |
delete |
(classmethod) Delete a logical worker from the database by its ID. |
Source code in merlin/db_scripts/entities/logical_worker_entity.py
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 136 137 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 | |
__repr__()
Provide a string representation of the LogicalWorkerEntity instance.
Returns:
| Type | Description |
|---|---|
str
|
A human-readable string representation of the |
Source code in merlin/db_scripts/entities/logical_worker_entity.py
__str__()
Provide a string representation of the LogicalWorkerEntity instance.
Returns:
| Type | Description |
|---|---|
str
|
A human-readable string representation of the |
Source code in merlin/db_scripts/entities/logical_worker_entity.py
add_physical_worker(physical_worker_id)
Add a new physical worker id to the list of physical workers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
physical_worker_id
|
str
|
The id of the physical worker to add. |
required |
Source code in merlin/db_scripts/entities/logical_worker_entity.py
get_physical_workers()
Get the physical instances of this logical worker.
Returns:
| Type | Description |
|---|---|
List[str]
|
A list of physical worker IDs. |
Source code in merlin/db_scripts/entities/logical_worker_entity.py
remove_physical_worker(physical_worker_id)
Remove a physical worker id from the list of physical workers.
Does not delete a PhysicalWorkerEntity
from the database. This will only remove the physical worker's id from the list in this worker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
physical_worker_id
|
str
|
The ID of the physical worker to remove. |
required |