Skip to content

Commit d8f63c6

Browse files
Merge branch 'feature_mypy_support' into feature_migrate_adapters_to_facade_pattern
2 parents 7a13813 + 4999b2a commit d8f63c6

23 files changed

Lines changed: 2376 additions & 13 deletions

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "conductor-python"
7-
version = "1.2.1"
7+
version = "1.2.2"
88
description = "Python SDK for working with https://github.com/conductor-oss/conductor"
99
authors = ["Orkes <developers@orkes.io>"]
1010
license = "Apache-2.0"

src/conductor/asyncio_client/configuration/configuration.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def __init__(
154154
self.polling_interval = polling_interval or self._get_env_int(
155155
"CONDUCTOR_WORKER_POLL_INTERVAL", 100
156156
)
157-
self.domain = domain or os.getenv("CONDUCTOR_WORKER_DOMAIN", "default_domain")
157+
self.domain = domain or os.getenv("CONDUCTOR_WORKER_DOMAIN", None)
158158
self.polling_interval_seconds = polling_interval_seconds or self._get_env_int(
159159
"CONDUCTOR_WORKER_POLL_INTERVAL_SECONDS", 0
160160
)
@@ -227,6 +227,12 @@ def __init__(
227227
if self.proxy_headers:
228228
self._http_config.proxy_headers = self.proxy_headers # type: ignore[assignment]
229229

230+
# Set proxy configuration on the HTTP config
231+
if self.proxy:
232+
self._http_config.proxy = self.proxy
233+
if self.proxy_headers:
234+
self._http_config.proxy_headers = self.proxy_headers
235+
230236
# Debug switch and logging setup
231237
self.__debug = debug
232238
if self.__debug:

src/conductor/asyncio_client/event/event_client.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
from typing import List
2+
13
from conductor.asyncio_client.adapters import ApiClient
24
from conductor.asyncio_client.adapters.api.event_resource_api import (
35
EventResourceApiAdapter,
46
)
7+
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
58
from conductor.shared.event.configuration import QueueConfiguration
69

710

@@ -30,3 +33,91 @@ async def put_queue_configuration(self, queue_configuration: QueueConfiguration)
3033
queue_name=queue_configuration.queue_name,
3134
queue_type=queue_configuration.queue_type,
3235
)
36+
37+
async def get_event_handler_tags(self, name: str) -> List[TagAdapter]:
38+
"""Get tags for an event handler.
39+
40+
Retrieves all tags associated with a specific event handler.
41+
Tags are used for organizing and categorizing event handlers.
42+
43+
Parameters:
44+
-----------
45+
name : str
46+
The name of the event handler
47+
48+
Returns:
49+
--------
50+
List[TagAdapter]
51+
List of tags associated with the event handler
52+
53+
Example:
54+
--------
55+
```python
56+
# Get tags for an event handler
57+
tags = await event_client.get_event_handler_tags("workflow_trigger")
58+
for tag in tags:
59+
print(f"Tag: {tag.key} = {tag.value}")
60+
```
61+
"""
62+
return await self.client.get_tags_for_event_handler(name=name)
63+
64+
async def add_event_handler_tag(self, name: str, tags: List[TagAdapter]) -> None:
65+
"""Add tags to an event handler.
66+
67+
Associates one or more tags with an event handler for organization and categorization.
68+
69+
Parameters:
70+
-----------
71+
name : str
72+
The name of the event handler
73+
tags : List[TagAdapter]
74+
List of tags to add to the event handler
75+
76+
Example:
77+
--------
78+
```python
79+
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
80+
81+
# Add tags to an event handler
82+
tags = [
83+
TagAdapter(key="environment", value="production"),
84+
TagAdapter(key="team", value="platform"),
85+
TagAdapter(key="priority", value="high")
86+
]
87+
88+
await event_client.add_event_handler_tag("workflow_trigger", tags)
89+
```
90+
"""
91+
# Note: Async API uses (name=name, tag=tags) keyword args to match the server signature.
92+
# Sync API uses (tags, name) positional args due to swagger-codegen parameter ordering.
93+
return await self.client.put_tag_for_event_handler(name=name, tag=tags)
94+
95+
async def remove_event_handler_tag(self, name: str, tags: List[TagAdapter]) -> None:
96+
"""Remove tags from an event handler.
97+
98+
Removes one or more tags from an event handler.
99+
100+
Parameters:
101+
-----------
102+
name : str
103+
The name of the event handler
104+
tags : List[TagAdapter]
105+
List of tags to remove from the event handler
106+
107+
Example:
108+
--------
109+
```python
110+
from conductor.asyncio_client.adapters.models.tag_adapter import TagAdapter
111+
112+
# Remove specific tags from an event handler
113+
tags_to_remove = [
114+
TagAdapter(key="environment", value="production"),
115+
TagAdapter(key="priority", value="high")
116+
]
117+
118+
await event_client.remove_event_handler_tag("workflow_trigger", tags_to_remove)
119+
```
120+
"""
121+
# Note: Async API uses (name=name, tag=tags) keyword args to match the server signature.
122+
# Sync API uses (tags, name) positional args due to swagger-codegen parameter ordering.
123+
return await self.client.delete_tag_for_event_handler(name=name, tag=tags)

src/conductor/asyncio_client/orkes/orkes_base_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
from conductor.asyncio_client.adapters.api.task_resource_api import TaskResourceApiAdapter
2424
from conductor.asyncio_client.adapters.api.user_resource_api import UserResourceApiAdapter
2525
from conductor.asyncio_client.adapters.api.workflow_resource_api import WorkflowResourceApiAdapter
26+
from conductor.asyncio_client.adapters.api.event_resource_api import EventResourceApiAdapter
27+
from conductor.asyncio_client.adapters.api.event_execution_resource_api import (
28+
EventExecutionResourceApiAdapter,
29+
)
2630
from conductor.asyncio_client.configuration.configuration import Configuration
2731

2832

src/conductor/asyncio_client/orkes/orkes_clients.py

Lines changed: 21 additions & 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

@@ -265,6 +266,26 @@ def get_schema_client(self) -> OrkesSchemaClient:
265266
"""
266267
return OrkesSchemaClient(self.configuration, self.api_client)
267268

269+
def get_event_client(self) -> OrkesEventClient:
270+
"""
271+
Create and return an event management client.
272+
273+
The event client manages event handlers and event processing within the
274+
Conductor platform, allowing you to create, configure, and monitor
275+
event-driven workflows and integrations.
276+
277+
Returns:
278+
--------
279+
OrkesEventClient
280+
Client for event operations including:
281+
- Creating and managing event handlers
282+
- Configuring event processing rules
283+
- Monitoring event executions
284+
- Managing event handler tags and metadata
285+
- Configuring queue settings for event processing
286+
"""
287+
return OrkesEventClient(self.configuration, self.api_client)
288+
268289
def get_workflow_executor(self) -> AsyncWorkflowExecutor:
269290
"""
270291
Create and return an asynchronous workflow executor.

0 commit comments

Comments
 (0)