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

Commit 23ad4e0

Browse files
committed
fix: move declaration inside of inner decorator
1 parent 2c949b7 commit 23ad4e0

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

examples/simple/worker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from dotenv import load_dotenv
22

3-
from hatchet_sdk import Context
4-
from hatchet_sdk.v2 import BaseWorkflowImpl, Hatchet
5-
63
load_dotenv()
74

5+
from hatchet_sdk import Context
6+
from hatchet_sdk.v2 import Hatchet
7+
88
hatchet = Hatchet(debug=True)
99

1010

hatchet_sdk/v2/hatchet.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -211,29 +211,29 @@ def function(
211211
concurrency: ConcurrencyExpression | None = None,
212212
input_validator: Type[TWorkflowInput] | None = None,
213213
) -> Callable[[Callable[[Context], R]], BaseWorkflowImpl]:
214-
declaration = WorkflowDeclaration[TWorkflowInput](
215-
WorkflowConfig(
216-
name=name,
217-
on_events=on_events,
218-
on_crons=on_crons,
219-
version=version,
220-
timeout=timeout,
221-
schedule_timeout=schedule_timeout,
222-
sticky=sticky,
223-
default_priority=default_priority,
224-
concurrency=concurrency,
225-
input_validator=input_validator
226-
or cast(Type[TWorkflowInput], EmptyModel),
227-
),
228-
self,
229-
)
230-
231214
def inner(func: Callable[[Context], R]) -> BaseWorkflowImpl:
215+
declaration = WorkflowDeclaration[TWorkflowInput](
216+
WorkflowConfig(
217+
name=name or func.__name__,
218+
on_events=on_events,
219+
on_crons=on_crons,
220+
version=version,
221+
timeout=timeout,
222+
schedule_timeout=schedule_timeout,
223+
sticky=sticky,
224+
default_priority=default_priority,
225+
concurrency=concurrency,
226+
input_validator=input_validator
227+
or cast(Type[TWorkflowInput], EmptyModel),
228+
),
229+
self,
230+
)
231+
232232
class Workflow(BaseWorkflowImpl):
233233
config = declaration.config
234234

235235
@self.step(
236-
name=name,
236+
name=declaration.config.name,
237237
timeout=timeout,
238238
retries=0,
239239
rate_limits=[],

0 commit comments

Comments
 (0)