mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
d1b1459ebb
* Refine wmill client.py `run_script_sync` and `run_script_by_path_sync` with more features This commit enriches the functionality of the `run_script_sync` and `run_script_by_path_sync` functions. New features introduced include script cancellation upon exit, logging capabilities, and script execution timeout. These enhancements improve script execution control and provide better debug information. The `get_result` function was also adjusted to enable the control of 'is not None' assertion on the job result. Consequently, user flexibility is enhanced, and the method can cater to cases where a `None` result is within the expected behavior. * remove unnecessary local import and rename cancel_atexit to cleanup
wmill
The client for the Windmill platform
Quickstart
import wmill
# with a WM_TOKEN env variable
client = wmill.Client()
# without a WM_TOKEN env variable
client = wmill.Client(token="<mytoken>")
def main():
version = client.get_version()
resource = client.get_resource("u/user/resource_path")
# run synchronously, will return the result
res = client.run_script_sync(hash="000000000000002a", args={})
print(res)
for _ in range(3):
# run asynchrnously, will return immediately. Can be scheduled
client.run_script_async(hash="000000000000002a", args={}, scheduled_in_secs=10)