mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
d3e0b1c636
* Allow setting progress explicitly from script body.
This feature exposes:
* `getProgress`
* `setProgress`
* `incProgress`
API in TypeScript client (python is coming soon).
NOTE: Progress cannot be out of range 0..100 and cannot decrease.
With exposed APIs there is also UI changes, so progress can be shown for individual jobs as well.
For optimization reasons, jobs start to ask for progress only after N-seconds of execution.
* feat: Add `shell.nix`
If you dont have anything but nix, dont worry, run nix-shell in root, or activate with direnv and get all needed dependencies
NOTE: You will still need docker
* feat: Add `dev.nu` to typescript client
Little helper function, allowing developer to work on ts client easier.
To use:
`./dev.nu watch`
Now add import of windmill in body of your script and `//nobundle` on top of the file
Edit ts client in your favourite editor and hit save. Script will do the rest.
* Cleanup files
* Fix: Failed to deserialize query string: missing field `get_progress`
* perf: Implement non-naive polling mechanism for getting job progress
* Add independant delay for getProgress
Problem in `TestJobLoader`:
There should be 2 delays:
One until we find our first progress (every 5s)
Once we found our first progress, we can do it every second
* nit: Use `query_scalar!` instead of `query_as`
* Fix: Sql error, no rows returned by a query that expected to return at least one row
* refactor: Remove global CSS for JobProgressBar
* Change UI for progress of flow subjobs
* Replace `Step 1` with `Running` in ProgressBar for individual jobs
* Remove `incProgress`
incProgress is not very usefull and error-prone
* perf: Set metric only for jobs that are actually using it
(https://github.com/windmill-labs/windmill/pull/4373#discussion_r1759843773)
* Offload registering progress from clients to server
* Add `jobId?` argument to typescript-client's `setProgress` and `getProgress`
Allows to set progress of other jobs and flows,
if jobId specified, than flow id will be inferred automatically.
Could be used by SDK.
* Add `Error::MetricNotFound` for better error handling
* Fix: Make `JobProgressBar` display in red when failed
* Add persistant progress bar
Now you can reload the page after job is done and progress will be still there
* Allow succeeded individual job's progress bar stick to 100%
* Add python support
* nit: Remove usage of undefined variable in python-client
* Add `async` in ts client (for error handling)
* nit(frontend): Remove unused import
* Dont load JobProgressBar when it is not needed
* nit: npm check fix
* cargo sqlx prepare
* fix sqlx
---------
Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
wmill
The core client for the Windmill platform.
Usage
Basic Usage
The wmill package has several methods at the top-level for the most frequent operations you will need.
The following are some common examples:
import time
import wmill
def main():
# Get the value of a variable
wmill.get_variable("u/user/variable_path")
# Run a script synchronously and get the result
wmill.run_script("f/pathto/script", args={"arg1": "value1"})
# Get the value of a resource
wmill.get_resource("u/user/resource_path")
# Set the script's state
wmill.set_state({"ts": time.time()})
# Get the script's state
wmill.get_state()
Advanced Usage
The wmill package also exposes the Windmill class, which is the core client for the Windmill platform.
import time
from wmill import Windmill
def main():
client = Windmill(
# token=... <- this is optional. otherwise the client will look for the WM_TOKEN env var
)
# Get the current version of the client
client.version
# Get the current user
client.user
# Convenience get and post methods exist for https://app.windmill.dev/openapi.html#/
# these are thin wrappers around the httpx library's get and post methods
# list worker groups
client.get("/configs/list_worker_groups")
# create a group
client.post(
f"/w/{client.workspace}/groups/create",
json={
"name": "my-group",
"summary": "my group summary",
}
)
# Get and set the state of the script
now = time.time()
client.state = {"ts": now}
assert client.state == {"ts": now}
# Run a job asynchronously
job_id = client.run_script_async(path="path/to/script")
# Get its status
client.get_job_status(job_id)
# Get its result
client.get_result(job_id)