Skip to content

Commit c3fe5e5

Browse files
authored
Hotfix: Task + Timeout (#1433)
* hotfix: simple task * fix: add back timeout * debug: try using loop scoped to session * fix: decrease timeout * fix: doc path
1 parent 404eb97 commit c3fe5e5

File tree

6 files changed

+39
-22
lines changed

6 files changed

+39
-22
lines changed

.github/workflows/sdk-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
run: |
135135
echo "Using HATCHET_CLIENT_NAMESPACE: $HATCHET_CLIENT_NAMESPACE"
136136
137-
poetry run pytest -s -vvv --maxfail=5 --capture=no -n 5
137+
poetry run pytest -s -vvv --maxfail=5 --capture=no -n 5 --timeout 60
138138
139139
- name: Upload engine logs
140140
if: always()

frontend/docs/components/code/codeData.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const getUIUrl = ({ user, repo, branch, path }: RepoProps) => {
4242
if (isDev) {
4343
return getLocalUrl(ext, { path });
4444
}
45-
return `https://github.com/${user || defaultUser}/${repo || defaultRepo}/blob/${branch || defaultBranch}/${path}`;
45+
return `https://github.com/${user || defaultUser}/${repo || defaultRepo}/blob/${branch || defaultBranch}/${localPaths[ext]}/${path}`;
4646
};
4747

4848
export type Src = {

frontend/docs/pages/home/your-first-task.mdx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,18 @@ The returned object is an instance of the `StandaloneTaskWorkflow` class, which
3434

3535
```python
3636
from hatchet_sdk import Context, EmptyModel, Hatchet
37+
from pydantic import BaseModel
3738

3839
hatchet = Hatchet(debug=True)
3940

40-
simple = hatchet.workflow(name="SimpleWorkflow")
41+
class SimpleInput(BaseModel):
42+
message: str
43+
44+
hatchet.task(name="SimpleWorkflow")
45+
def simple(input: SimpleInput, ctx: Context) -> dict[str, str]:
46+
return {
47+
"transformed_message": input.message.lower(),
48+
}
4149
```
4250

4351
</Tabs.Tab>
@@ -72,13 +80,7 @@ With your task defined, you can import it wherever you need to use it and invoke
7280
<Tabs.Tab title="Python">
7381

7482
```python
75-
from hatchet_sdk import Context, EmptyModel, Hatchet
76-
77-
hatchet = Hatchet(debug=True)
78-
79-
@hatchet.task(name="SimpleWorkflow")
80-
def step1(input: EmptyModel, ctx: Context) -> None:
81-
print("executed step1")
83+
simple.run(SimpleInput(message="HeLlO WoRlD"))
8284
```
8385

8486
</Tabs.Tab>

sdks/python/poetry.lock

Lines changed: 23 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/python/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ opentelemetry-exporter-otlp = { version = "^1.28.0", optional = true }
3535
opentelemetry-exporter-otlp-proto-http = { version = "^1.28.0", optional = true }
3636
prometheus-client = "^0.21.1"
3737
pydantic-settings = "^2.7.1"
38+
pytest-timeout = "^2.3.1"
3839

3940
[tool.poetry.group.dev.dependencies]
4041
pytest = "^8.3.5"

sdks/python/tests/test_rest_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from hatchet_sdk import Hatchet
77

88

9-
@pytest.mark.asyncio(loop_scope="function")
9+
@pytest.mark.asyncio(loop_scope="session")
1010
async def test_list_runs(hatchet: Hatchet) -> None:
1111
dag_result = await dag_workflow.aio_run()
1212

@@ -19,7 +19,7 @@ async def test_list_runs(hatchet: Hatchet) -> None:
1919
assert v in [r.output for r in runs.rows]
2020

2121

22-
@pytest.mark.asyncio(loop_scope="function")
22+
@pytest.mark.asyncio(loop_scope="session")
2323
async def test_get_run(hatchet: Hatchet) -> None:
2424
dag_ref = await dag_workflow.aio_run_no_wait()
2525

@@ -33,7 +33,7 @@ async def test_get_run(hatchet: Hatchet) -> None:
3333
assert {t.name for t in dag_workflow.tasks} == {t.task_name for t in run.shape}
3434

3535

36-
@pytest.mark.asyncio(loop_scope="function")
36+
@pytest.mark.asyncio(loop_scope="session")
3737
async def test_list_workflows(hatchet: Hatchet) -> None:
3838
workflows = await hatchet.workflows.aio_list(
3939
workflow_name=dag_workflow.config.name, limit=1, offset=0

0 commit comments

Comments
 (0)