Skip to content

Commit 4b6ae28

Browse files
Fixed merge issues
1 parent 46c46e6 commit 4b6ae28

7 files changed

Lines changed: 117 additions & 144 deletions

File tree

src/conductor/asyncio_client/orkes/orkes_base_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
from conductor.asyncio_client.adapters.api.task_resource_api import TaskResourceApiAdapter
2020
from conductor.asyncio_client.adapters.api.user_resource_api import UserResourceApiAdapter
2121
from conductor.asyncio_client.adapters.api.workflow_resource_api import WorkflowResourceApiAdapter
22+
from conductor.asyncio_client.adapters.api.event_resource_api import EventResourceApiAdapter
23+
from conductor.asyncio_client.adapters.api.event_execution_resource_api import (
24+
EventExecutionResourceApiAdapter,
25+
)
2226
from conductor.asyncio_client.configuration.configuration import Configuration
2327
from conductor.asyncio_client.adapters import ApiClient
2428

src/conductor/asyncio_client/orkes/orkes_clients.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from conductor.asyncio_client.orkes.orkes_secret_client import OrkesSecretClient
1414
from conductor.asyncio_client.orkes.orkes_task_client import OrkesTaskClient
1515
from conductor.asyncio_client.orkes.orkes_workflow_client import OrkesWorkflowClient
16+
from conductor.asyncio_client.orkes.orkes_event_client import OrkesEventClient
1617
from conductor.asyncio_client.workflow.executor.workflow_executor import AsyncWorkflowExecutor
1718

1819

src/conductor/asyncio_client/orkes/orkes_event_client.py

Lines changed: 54 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,36 @@
22

33
from typing import List
44

5-
from conductor.asyncio_client.adapters.models.event_handler_adapter import \
6-
EventHandlerAdapter
5+
from conductor.asyncio_client.adapters.models.event_handler_adapter import EventHandlerAdapter
76
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
87
from conductor.asyncio_client.orkes.orkes_base_client import OrkesBaseClient
98

109

1110
class OrkesEventClient(OrkesBaseClient):
1211
"""Event management client for Orkes Conductor platform.
13-
12+
1413
Provides comprehensive event handling capabilities including event handler
1514
management, tag operations, queue configuration, and event execution monitoring.
1615
"""
1716

1817
# Event Handler Operations
19-
async def create_event_handler(
20-
self, event_handler: List[EventHandlerAdapter]
21-
) -> None:
18+
async def create_event_handler(self, event_handler: List[EventHandlerAdapter]) -> None:
2219
"""Create a new event handler.
23-
20+
2421
Creates one or more event handlers that will be triggered by specific events.
2522
Event handlers define what actions to take when certain events occur in the system.
26-
23+
2724
Parameters:
2825
-----------
2926
event_handler : List[EventHandlerAdapter]
3027
List of event handler configurations to create
31-
28+
3229
Example:
3330
--------
3431
```python
3532
from conductor.asyncio_client.adapters.models.event_handler_adapter import EventHandlerAdapter
3633
from conductor.asyncio_client.adapters.models.action_adapter import ActionAdapter
37-
34+
3835
# Create an event handler
3936
event_handler = EventHandlerAdapter(
4037
name="workflow_trigger",
@@ -49,27 +46,27 @@ async def create_event_handler(
4946
)
5047
]
5148
)
52-
49+
5350
await event_client.create_event_handler([event_handler])
5451
```
5552
"""
5653
return await self.event_api.add_event_handler(event_handler)
5754

5855
async def get_event_handler(self, name: str) -> EventHandlerAdapter:
5956
"""Get event handler by name.
60-
57+
6158
Retrieves a specific event handler configuration by its name.
62-
59+
6360
Parameters:
6461
-----------
6562
name : str
6663
The name of the event handler to retrieve
67-
64+
6865
Returns:
6966
--------
7067
EventHandlerAdapter
7168
The event handler configuration
72-
69+
7370
Example:
7471
--------
7572
```python
@@ -83,14 +80,14 @@ async def get_event_handler(self, name: str) -> EventHandlerAdapter:
8380

8481
async def list_event_handlers(self) -> List[EventHandlerAdapter]:
8582
"""List all event handlers.
86-
83+
8784
Retrieves all event handlers configured in the system.
88-
85+
8986
Returns:
9087
--------
9188
List[EventHandlerAdapter]
9289
List of all event handler configurations
93-
90+
9491
Example:
9592
--------
9693
```python
@@ -104,68 +101,66 @@ async def list_event_handlers(self) -> List[EventHandlerAdapter]:
104101

105102
async def list_event_handlers_for_event(self, event: str) -> List[EventHandlerAdapter]:
106103
"""List event handlers for a specific event.
107-
104+
108105
Retrieves all event handlers that are configured to respond to a specific event type.
109-
106+
110107
Parameters:
111108
-----------
112109
event : str
113110
The event type to filter handlers by (e.g., "workflow.completed", "task.failed")
114-
111+
115112
Returns:
116113
--------
117114
List[EventHandlerAdapter]
118115
List of event handlers that respond to the specified event
119-
116+
120117
Example:
121118
--------
122119
```python
123120
# Get handlers for workflow completion events
124121
handlers = await event_client.list_event_handlers_for_event("workflow.completed")
125122
print(f"Found {len(handlers)} handlers for workflow.completed events")
126-
123+
127124
# Get handlers for task failure events
128125
failure_handlers = await event_client.list_event_handlers_for_event("task.failed")
129126
```
130127
"""
131128
return await self.event_api.get_event_handlers_for_event(event=event)
132129

133-
async def update_event_handler(
134-
self, event_handler: EventHandlerAdapter
135-
) -> None:
130+
async def update_event_handler(self, event_handler: EventHandlerAdapter) -> None:
136131
"""Update an existing event handler.
137-
132+
138133
Updates the configuration of an existing event handler.
139134
The handler is identified by its name field.
140-
135+
141136
Parameters:
142137
-----------
143138
event_handler : EventHandlerAdapter
144139
Event handler configuration to update
145-
140+
146141
Example:
147142
--------
148143
```python
149144
# Update an existing event handler
150145
handler = await event_client.get_event_handler("workflow_trigger")
151146
handler.active = False # Disable the handler
152147
handler.condition = "payload.status == 'COMPLETED' AND payload.priority == 'HIGH'"
153-
148+
154149
await event_client.update_event_handler(handler)
155150
```
156151
"""
157152
return await self.event_api.update_event_handler(event_handler)
158153

159154
async def delete_event_handler(self, name: str) -> None:
160155
"""Delete an event handler by name.
161-
156+
162157
Permanently removes an event handler from the system.
163-
158+
164159
Parameters:
165160
-----------
166161
name : str
167162
The name of the event handler to delete
168-
163+
169164
Example:
170165
--------
171166
```python
@@ -179,20 +174,20 @@ async def delete_event_handler(self, name: str) -> None:
179174
# Event Handler Tag Operations
180175
async def get_event_handler_tags(self, name: str) -> List[TagAdapter]:
181176
"""Get tags for an event handler.
182-
177+
183178
Retrieves all tags associated with a specific event handler.
184179
Tags are used for organizing and categorizing event handlers.
185-
180+
186181
Parameters:
187182
-----------
188183
name : str
189184
The name of the event handler
190-
185+
191186
Returns:
192187
--------
193188
List[TagAdapter]
194189
List of tags associated with the event handler
195-
190+
196191
Example:
197192
--------
198193
```python
@@ -204,64 +199,60 @@ async def get_event_handler_tags(self, name: str) -> List[TagAdapter]:
204199
"""
205200
return await self.event_api.get_tags_for_event_handler(name=name)
206201

207-
async def add_event_handler_tag(
208-
self, name: str, tags: List[TagAdapter]
209-
) -> None:
202+
async def add_event_handler_tag(self, name: str, tags: List[TagAdapter]) -> None:
210203
"""Add tags to an event handler.
211-
204+
212205
Associates one or more tags with an event handler for organization and categorization.
213-
206+
214207
Parameters:
215208
-----------
216209
name : str
217210
The name of the event handler
218211
tags : List[TagAdapter]
219212
List of tags to add to the event handler
220-
213+
221214
Example:
222215
--------
223216
```python
224217
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
225-
218+
226219
# Add tags to an event handler
227220
tags = [
228221
TagAdapter(key="environment", value="production"),
229222
TagAdapter(key="team", value="platform"),
230223
TagAdapter(key="priority", value="high")
231224
]
232-
225+
233226
await event_client.add_event_handler_tag("workflow_trigger", tags)
234227
```
235228
"""
236229
# Note: Async API uses (name=name, tag=tags) keyword args to match the server signature.
237230
# Sync API uses (tags, name) positional args due to swagger-codegen parameter ordering.
238231
return await self.event_api.put_tag_for_event_handler(name=name, tag=tags)
239232

240-
async def remove_event_handler_tag(
241-
self, name: str, tags: List[TagAdapter]
242-
) -> None:
233+
async def remove_event_handler_tag(self, name: str, tags: List[TagAdapter]) -> None:
243234
"""Remove tags from an event handler.
244-
235+
245236
Removes one or more tags from an event handler.
246-
237+
247238
Parameters:
248239
-----------
249240
name : str
250241
The name of the event handler
251242
tags : List[TagAdapter]
252243
List of tags to remove from the event handler
253-
244+
254245
Example:
255246
--------
256247
```python
257248
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
258-
249+
259250
# Remove specific tags from an event handler
260251
tags_to_remove = [
261252
TagAdapter(key="environment", value="production"),
262253
TagAdapter(key="priority", value="high")
263254
]
264-
255+
265256
await event_client.remove_event_handler_tag("workflow_trigger", tags_to_remove)
266257
```
267258
"""
@@ -270,25 +261,23 @@ async def remove_event_handler_tag(
270261
return await self.event_api.delete_tag_for_event_handler(name=name, tag=tags)
271262

272263
# Queue Configuration Operations
273-
async def get_queue_configuration(
274-
self, queue_type: str, queue_name: str
275-
) -> dict:
264+
async def get_queue_configuration(self, queue_type: str, queue_name: str) -> dict:
276265
"""Get queue configuration.
277-
266+
278267
Retrieves the configuration for a specific event queue.
279-
268+
280269
Parameters:
281270
-----------
282271
queue_type : str
283272
The type of queue (e.g., "kafka", "sqs", "rabbitmq")
284273
queue_name : str
285274
The name of the queue
286-
275+
287276
Returns:
288277
--------
289278
dict
290279
Queue configuration settings
291-
280+
292281
Example:
293282
--------
294283
```python
@@ -298,24 +287,20 @@ async def get_queue_configuration(
298287
print(f"Topic: {config.get('topic')}")
299288
```
300289
"""
301-
return await self.event_api.get_queue_config(
302-
queue_type=queue_type, queue_name=queue_name
303-
)
290+
return await self.event_api.get_queue_config(queue_type=queue_type, queue_name=queue_name)
304291

305-
async def delete_queue_configuration(
306-
self, queue_type: str, queue_name: str
307-
) -> None:
292+
async def delete_queue_configuration(self, queue_type: str, queue_name: str) -> None:
308293
"""Delete queue configuration.
309-
294+
310295
Removes the configuration for an event queue.
311-
296+
312297
Parameters:
313298
-----------
314299
queue_type : str
315300
The type of queue (e.g., "kafka", "sqs", "rabbitmq")
316301
queue_name : str
317302
The name of the queue
318-
303+
319304
Example:
320305
--------
321306
```python

src/conductor/client/configuration/configuration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ def __init__(
118118
elif base_url is not None:
119119
if re.search(r"/api(/|$)", base_url):
120120
warnings.warn(
121-
"'base_url' been passed with '/api' path. Consider using 'server_api_url' instead"
121+
"'base_url' been passed with '/api' path. Consider using 'server_api_url' instead",
122+
stacklevel=2,
122123
)
123124
else:
124125
base_url += "/api"

src/conductor/client/event/event_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ class EventClient:
1212
def __init__(self, api_client: ApiClient):
1313
self.client = EventResourceApi(api_client)
1414

15-
def delete_queue_configuration(
16-
self, queue_configuration: QueueConfiguration
17-
) -> None:
15+
def delete_queue_configuration(self, queue_configuration: QueueConfiguration) -> None:
1816
return self.client.delete_queue_config(
1917
queue_name=queue_configuration.queue_name,
2018
queue_type=queue_configuration.queue_type,

0 commit comments

Comments
 (0)