Controller
Controller
Base class for handling event data processing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config |
ConfigDTO
|
The configuration data. |
required |
queue_active_jobs |
Queue
|
An asyncio queue for active jobs. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
_config |
ConfigDTO
|
The configuration data. |
_config_id |
str
|
The ID associated with the configuration. |
_service_name |
str
|
The service name from the configuration. |
_source_name |
str
|
The source name from the configuration. |
_context_env |
str
|
The context environment from the configuration. |
_repository_schema_type |
str
|
The repository schema type for service input. |
_queue_active_jobs |
Queue
|
An asyncio queue for active jobs. |
_active |
bool
|
The activation status based on the configuration. |
_schema_handler_client |
The schema handler client for retrieving JSON schemas. |
|
_input_body_dto |
The input data DTO. |
Methods:
| Name | Description |
|---|---|
__init__ |
ConfigDTO, queue_active_jobs: asyncio.Queue) -> None: Initializes a Controller instance with the provided configuration and active jobs queue. |
_should_cotroller_active |
Check if the controller should be active based on the configuration. |
async _get_event_parser |
Get the event parser JSON schema for data processing. |
async _parse_event |
str) -> type[warlock.model.Model]: Parse the incoming event message and transform it into the appropriate data format. |
_get_metadata |
Generate metadata information for the processed event data. |
async job_dispatcher |
Dispatch a job to process the event input data and collect the results. |
Source code in apps/process-input/source-watcher/source_watcher/controller/controller.py
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 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 177 178 179 180 181 | |
__init__(config, queue_active_jobs)
Initializes a Controller instance with the provided configuration and active jobs queue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config |
ConfigDTO
|
The configuration data. |
required |
queue_active_jobs |
Queue
|
An asyncio queue for active jobs. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Source code in apps/process-input/source-watcher/source_watcher/controller/controller.py
job_dispatcher(event_input)
async
Dispatch a job to process the event input data and collect the results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_input |
The input data for the job. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ServiceFeedbackDTO |
ServiceFeedbackDTO
|
Feedback and result information from the job processing. |
Source code in apps/process-input/source-watcher/source_watcher/controller/controller.py
EventController
Bases: Controller
EventController class for processing event data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config |
ConfigDTO
|
The configuration data. |
required |
rabbitmq_service |
RabbitMQConsumer
|
An instance of the RabbitMQConsumer class. |
required |
queue_active_jobs |
Queue
|
An asyncio queue for active jobs. |
required |
Methods:
| Name | Description |
|---|---|
__init__ |
ConfigDTO, rabbitmq_service: RabbitMQConsumer, queue_active_jobs: asyncio.Queue) -> None: Initializes an EventController instance with the provided configuration, RabbitMQ service, and active jobs queue. |
async run |
Run the EventController to process event data. This method initiates the processing of incoming event data using the specified controller logic. Args: message: The incoming event message. |
Source code in apps/process-input/source-watcher/source_watcher/controller/controller.py
__init__(config, rabbitmq_service, queue_active_jobs)
Initializes an EventController instance with the provided configuration, RabbitMQ service, and active jobs queue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config |
ConfigDTO
|
The configuration data. |
required |
rabbitmq_service |
RabbitMQConsumer
|
An instance of the RabbitMQConsumer class. |
required |
queue_active_jobs |
Queue
|
An asyncio queue for active jobs. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in apps/process-input/source-watcher/source_watcher/controller/controller.py
run(message)
async
Run the EventController to process event data.
This method initiates the processing of incoming event data using the specified controller logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message |
The incoming event message. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |