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

Commit 562bd3c

Browse files
committed
fix: inheritance
1 parent 793becd commit 562bd3c

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

hatchet_sdk/v2/workflows.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def __init__(
143143
self.concurrency__limit_strategy = concurrency__limit_strategy
144144

145145

146-
class RegisteredStep(Step[R]):
146+
class RegisteredStep(Generic[R]):
147147
def __init__(
148148
self,
149149
workflow: "BaseWorkflow",
@@ -153,27 +153,33 @@ def __init__(
153153
self.step = step
154154

155155
def call(self, ctx: Context) -> R:
156-
if self.is_async_function:
157-
raise TypeError(f"{self.name} is not a sync function. Use `acall` instead.")
156+
if self.step.is_async_function:
157+
raise TypeError(
158+
f"{self.step.name} is not a sync function. Use `acall` instead."
159+
)
158160

159-
sync_fn = self.fn
161+
sync_fn = self.step.fn
160162
if is_sync_fn(sync_fn):
161163
return sync_fn(self.workflow, ctx)
162164

163-
raise TypeError(f"{self.name} is not a sync function. Use `acall` instead.")
165+
raise TypeError(
166+
f"{self.step.name} is not a sync function. Use `acall` instead."
167+
)
164168

165169
async def acall(self, ctx: Context) -> R:
166-
if not self.is_async_function:
170+
if not self.step.is_async_function:
167171
raise TypeError(
168-
f"{self.name} is not an async function. Use `call` instead."
172+
f"{self.step.name} is not an async function. Use `call` instead."
169173
)
170174

171-
async_fn = self.fn
175+
async_fn = self.step.fn
172176

173177
if is_async_fn(async_fn):
174178
return await async_fn(self.workflow, ctx)
175179

176-
raise TypeError(f"{self.name} is not an async function. Use `call` instead.")
180+
raise TypeError(
181+
f"{self.step.name} is not an async function. Use `call` instead."
182+
)
177183

178184

179185
class WorkflowDeclaration(Generic[TWorkflowInput]):

hatchet_sdk/worker/runner/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ async def async_wrapped_action_func(
241241
sr.set(context.step_run_id)
242242

243243
try:
244-
if step.is_async_function:
244+
if step.step.is_async_function:
245245
return await step.acall(context)
246246
else:
247247
pfunc = functools.partial(

0 commit comments

Comments
 (0)