Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: namespace propagation from spawn_workflow #43

Merged
merged 3 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading