Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit c73f9ba

Browse files
committed
fix: the rest of the .aio.
1 parent cb251eb commit c73f9ba

File tree

4 files changed

+18
-60
lines changed

4 files changed

+18
-60
lines changed

examples/cron/programatic-async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
async def create_cron() -> None:
77
# ❓ Create
8-
cron_trigger = await hatchet.cron.aio.create(
8+
cron_trigger = await hatchet.cron.aio_create(
99
workflow_name="simple-cron-workflow",
1010
cron_name="customer-a-daily-report",
1111
expression="0 12 * * *",
@@ -21,13 +21,13 @@ async def create_cron() -> None:
2121
# !!
2222

2323
# ❓ List
24-
await hatchet.cron.aio.list()
24+
await hatchet.cron.aio_list()
2525
# !!
2626

2727
# ❓ Get
28-
cron_trigger = await hatchet.cron.aio.get(cron_trigger=cron_trigger.metadata.id)
28+
cron_trigger = await hatchet.cron.aio_get(cron_trigger=cron_trigger.metadata.id)
2929
# !!
3030

3131
# ❓ Delete
32-
await hatchet.cron.aio.delete(cron_trigger=cron_trigger.metadata.id)
32+
await hatchet.cron.aio_delete(cron_trigger=cron_trigger.metadata.id)
3333
# !!

examples/scheduled/programatic-async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
async def create_scheduled() -> None:
99
# ❓ Create
10-
scheduled_run = await hatchet.scheduled.aio.create(
10+
scheduled_run = await hatchet.scheduled.aio_create(
1111
workflow_name="simple-workflow",
1212
trigger_at=datetime.now() + timedelta(seconds=10),
1313
input={
@@ -22,13 +22,13 @@ async def create_scheduled() -> None:
2222
# !!
2323

2424
# ❓ Delete
25-
await hatchet.scheduled.aio.delete(scheduled=scheduled_run.metadata.id)
25+
await hatchet.scheduled.aio_delete(scheduled=scheduled_run.metadata.id)
2626
# !!
2727

2828
# ❓ List
29-
await hatchet.scheduled.aio.list()
29+
await hatchet.scheduled.aio_list()
3030
# !!
3131

3232
# ❓ Get
33-
scheduled_run = await hatchet.scheduled.aio.get(scheduled=scheduled_run.metadata.id)
33+
scheduled_run = await hatchet.scheduled.aio_get(scheduled=scheduled_run.metadata.id)
3434
# !!

hatchet_sdk/features/cron.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Union
1+
from typing import List, Union
22

33
from pydantic import BaseModel, Field, field_validator
44

@@ -81,7 +81,6 @@ def __init__(self, _client: Client):
8181
_client (Client): The client instance to be used for REST interactions.
8282
"""
8383
self._client = _client
84-
self.aio = CronClientAsync(_client)
8584

8685
def create(
8786
self,
@@ -177,27 +176,7 @@ def get(self, cron_trigger: Union[str, CronWorkflows]) -> CronWorkflows:
177176
else cron_trigger
178177
)
179178

180-
181-
class CronClientAsync:
182-
"""
183-
Asynchronous client for managing workflow cron triggers.
184-
185-
Attributes:
186-
_client (Client): The underlying client used to interact with the REST API asynchronously.
187-
"""
188-
189-
_client: Client
190-
191-
def __init__(self, _client: Client):
192-
"""
193-
Initializes the CronClientAsync with a given Client instance.
194-
195-
Args:
196-
_client (Client): The client instance to be used for asynchronous REST interactions.
197-
"""
198-
self._client = _client
199-
200-
async def create(
179+
async def aio_create(
201180
self,
202181
workflow_name: str,
203182
cron_name: str,
@@ -230,7 +209,7 @@ async def create(
230209
additional_metadata=validated_input.additional_metadata,
231210
)
232211

233-
async def delete(self, cron_trigger: Union[str, CronWorkflows]) -> None:
212+
async def aio_delete(self, cron_trigger: Union[str, CronWorkflows]) -> None:
234213
"""
235214
Asynchronously deletes a workflow cron trigger.
236215
@@ -243,12 +222,12 @@ async def delete(self, cron_trigger: Union[str, CronWorkflows]) -> None:
243222
else cron_trigger
244223
)
245224

246-
async def list(
225+
async def aio_list(
247226
self,
248227
offset: int | None = None,
249228
limit: int | None = None,
250229
workflow_id: str | None = None,
251-
additional_metadata: list[str] | None = None,
230+
additional_metadata: List[str] | None = None,
252231
order_by_field: CronWorkflowsOrderByField | None = None,
253232
order_by_direction: WorkflowRunOrderByDirection | None = None,
254233
) -> CronWorkflowsList:
@@ -275,7 +254,7 @@ async def list(
275254
order_by_direction=order_by_direction,
276255
)
277256

278-
async def get(self, cron_trigger: Union[str, CronWorkflows]) -> CronWorkflows:
257+
async def aio_get(self, cron_trigger: Union[str, CronWorkflows]) -> CronWorkflows:
279258
"""
280259
Asynchronously retrieves a specific workflow cron trigger by ID.
281260

hatchet_sdk/features/scheduled.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def __init__(self, _client: Client) -> None:
5454
_client (Client): The client instance to be used for REST interactions.
5555
"""
5656
self._client = _client
57-
self.aio: "ScheduledClientAsync" = ScheduledClientAsync(_client)
5857

5958
def create(
6059
self,
@@ -148,27 +147,7 @@ def get(self, scheduled: Union[str, ScheduledWorkflows]) -> ScheduledWorkflows:
148147
else scheduled
149148
)
150149

151-
152-
class ScheduledClientAsync:
153-
"""
154-
Asynchronous client for managing scheduled workflows.
155-
156-
Attributes:
157-
_client (Client): The underlying client used to interact with the REST API asynchronously.
158-
"""
159-
160-
_client: Client
161-
162-
def __init__(self, _client: Client) -> None:
163-
"""
164-
Initializes the ScheduledClientAsync with a given Client instance.
165-
166-
Args:
167-
_client (Client): The client instance to be used for asynchronous REST interactions.
168-
"""
169-
self._client = _client
170-
171-
async def create(
150+
async def aio_create(
172151
self,
173152
workflow_name: str,
174153
trigger_at: datetime.datetime,
@@ -191,7 +170,7 @@ async def create(
191170
workflow_name, trigger_at, input, additional_metadata
192171
)
193172

194-
async def delete(self, scheduled: Union[str, ScheduledWorkflows]) -> None:
173+
async def aio_delete(self, scheduled: Union[str, ScheduledWorkflows]) -> None:
195174
"""
196175
Deletes a scheduled workflow asynchronously.
197176
@@ -204,7 +183,7 @@ async def delete(self, scheduled: Union[str, ScheduledWorkflows]) -> None:
204183
else scheduled
205184
)
206185

207-
async def list(
186+
async def aio_list(
208187
self,
209188
offset: int | None = None,
210189
limit: int | None = None,
@@ -236,7 +215,7 @@ async def list(
236215
order_by_direction=order_by_direction,
237216
)
238217

239-
async def get(
218+
async def aio_get(
240219
self, scheduled: Union[str, ScheduledWorkflows]
241220
) -> ScheduledWorkflows:
242221
"""

0 commit comments

Comments
 (0)