Skip to content

Commit

Permalink
fix: namespace propagation from spawn_workflow (#43)
Browse files Browse the repository at this point in the history
* fix: update requirements to indicate python version >=3.10

* fix: don't double-set namespace from spawn_workflow
  • Loading branch information
abelanger5 authored Jun 9, 2024
1 parent 6318613 commit ab365f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 5 additions & 2 deletions hatchet_sdk/clients/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ async def run_workflow(
if not self.pooled_workflow_listener:
self.pooled_workflow_listener = PooledWorkflowRunListener(self.config)

workflow_name = f"{self.namespace}{workflow_name}"
# if workflow_name does not start with namespace, prepend it
if self.namespace != "" and not workflow_name.startswith(self.namespace):
workflow_name = f"{self.namespace}{workflow_name}"

request = self._prepare_workflow_request(workflow_name, input, options)
resp: TriggerWorkflowResponse = await self.aio_client.TriggerWorkflow(
Expand Down Expand Up @@ -276,7 +278,8 @@ def run_workflow(
if not self.pooled_workflow_listener:
self.pooled_workflow_listener = PooledWorkflowRunListener(self.config)

workflow_name = f"{self.namespace}{workflow_name}"
if self.namespace != "" and not workflow_name.startswith(self.namespace):
workflow_name = f"{self.namespace}{workflow_name}"

request = self._prepare_workflow_request(workflow_name, input, options)
resp: TriggerWorkflowResponse = self.client.TriggerWorkflow(
Expand Down
3 changes: 1 addition & 2 deletions hatchet_sdk/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ async def spawn_workflow(
self, workflow_name: str, input: dict = {}, key: str = None
) -> WorkflowRunRef:
options = self._prepare_workflow_options(key)

return await self.admin_client.aio.run_workflow(workflow_name, input, options)


Expand Down Expand Up @@ -170,8 +171,6 @@ def playground(self, name: str, default: str = None):
return default

def spawn_workflow(self, workflow_name: str, input: dict = {}, key: str = None):
workflow_name = f"{self.namespace}{workflow_name}"

options = self._prepare_workflow_options(key)

return self.admin_client.run_workflow(workflow_name, input, options)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hatchet-sdk"
version = "0.26.2"
version = "0.26.3"
description = ""
authors = ["Alexander Belanger <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit ab365f5

Please sign in to comment.