From b2521b7d2c83510373e8a389bf287ca6ff71535e Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 4 Mar 2024 20:45:04 +0100 Subject: [PATCH] fix: workflow as code api improvement --- python-client/wmill/wmill/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python-client/wmill/wmill/client.py b/python-client/wmill/wmill/client.py index 6a7e06c448..4ba113305d 100644 --- a/python-client/wmill/wmill/client.py +++ b/python-client/wmill/wmill/client.py @@ -882,7 +882,7 @@ def run_script( def task(*args, **kwargs): - + from inspect import signature def f(func, tag: str | None = None): if os.environ.get("WM_JOB_ID") is None or os.environ.get("MAIN_OVERRIDE") == func.__name__: def inner(*args, **kwargs): @@ -892,7 +892,9 @@ def task(*args, **kwargs): else: def inner(*args, **kwargs): - _client=Windmill() + global _client + if _client is None: + _client = Windmill() w_id = os.environ.get("WM_WORKSPACE") job_id = os.environ.get("WM_JOB_ID") f_name = func.__name__