windmill-cli 1.828.0 → 1.829.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/main.js +79 -5
- package/package.json +1 -1
package/esm/main.js
CHANGED
|
@@ -16766,7 +16766,7 @@ var init_OpenAPI = __esm(() => {
|
|
|
16766
16766
|
PASSWORD: undefined,
|
|
16767
16767
|
TOKEN: getEnv3("WM_TOKEN"),
|
|
16768
16768
|
USERNAME: undefined,
|
|
16769
|
-
VERSION: "1.
|
|
16769
|
+
VERSION: "1.829.0",
|
|
16770
16770
|
WITH_CREDENTIALS: true,
|
|
16771
16771
|
interceptors: {
|
|
16772
16772
|
request: new Interceptors,
|
|
@@ -20051,7 +20051,7 @@ var init_auth = __esm(async () => {
|
|
|
20051
20051
|
});
|
|
20052
20052
|
|
|
20053
20053
|
// src/core/constants.ts
|
|
20054
|
-
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.
|
|
20054
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.829.0";
|
|
20055
20055
|
|
|
20056
20056
|
// src/utils/resource_folders.ts
|
|
20057
20057
|
import { existsSync } from "node:fs";
|
|
@@ -57061,7 +57061,7 @@ var init_openflow = __esm(() => {
|
|
|
57061
57061
|
openflow_default = {
|
|
57062
57062
|
openapi: "3.0.3",
|
|
57063
57063
|
info: {
|
|
57064
|
-
version: "1.
|
|
57064
|
+
version: "1.829.0",
|
|
57065
57065
|
title: "OpenFlow Spec",
|
|
57066
57066
|
contact: {
|
|
57067
57067
|
name: "Ruben Fiszel",
|
|
@@ -80572,6 +80572,14 @@ async setProgress(percent: number, jobId?: any): Promise<void>
|
|
|
80572
80572
|
*/
|
|
80573
80573
|
async getProgress(jobId?: any): Promise<number | null>
|
|
80574
80574
|
|
|
80575
|
+
/**
|
|
80576
|
+
* Whether the worker running this job has received its shutdown signal.
|
|
80577
|
+
* A draining worker waits for its current job to finish before exiting, so a
|
|
80578
|
+
* long-running script can poll this and return early to let the worker be replaced.
|
|
80579
|
+
* @param jobId? Job to check, defaults to the current job
|
|
80580
|
+
*/
|
|
80581
|
+
async workerIsDraining(jobId?: string): Promise<boolean>
|
|
80582
|
+
|
|
80575
80583
|
/**
|
|
80576
80584
|
* Set a flow user state
|
|
80577
80585
|
* @param key key of the state
|
|
@@ -81407,6 +81415,14 @@ async setProgress(percent: number, jobId?: any): Promise<void>
|
|
|
81407
81415
|
*/
|
|
81408
81416
|
async getProgress(jobId?: any): Promise<number | null>
|
|
81409
81417
|
|
|
81418
|
+
/**
|
|
81419
|
+
* Whether the worker running this job has received its shutdown signal.
|
|
81420
|
+
* A draining worker waits for its current job to finish before exiting, so a
|
|
81421
|
+
* long-running script can poll this and return early to let the worker be replaced.
|
|
81422
|
+
* @param jobId? Job to check, defaults to the current job
|
|
81423
|
+
*/
|
|
81424
|
+
async workerIsDraining(jobId?: string): Promise<boolean>
|
|
81425
|
+
|
|
81410
81426
|
/**
|
|
81411
81427
|
* Set a flow user state
|
|
81412
81428
|
* @param key key of the state
|
|
@@ -82348,6 +82364,14 @@ async setProgress(percent: number, jobId?: any): Promise<void>
|
|
|
82348
82364
|
*/
|
|
82349
82365
|
async getProgress(jobId?: any): Promise<number | null>
|
|
82350
82366
|
|
|
82367
|
+
/**
|
|
82368
|
+
* Whether the worker running this job has received its shutdown signal.
|
|
82369
|
+
* A draining worker waits for its current job to finish before exiting, so a
|
|
82370
|
+
* long-running script can poll this and return early to let the worker be replaced.
|
|
82371
|
+
* @param jobId? Job to check, defaults to the current job
|
|
82372
|
+
*/
|
|
82373
|
+
async workerIsDraining(jobId?: string): Promise<boolean>
|
|
82374
|
+
|
|
82351
82375
|
/**
|
|
82352
82376
|
* Set a flow user state
|
|
82353
82377
|
* @param key key of the state
|
|
@@ -84353,6 +84377,18 @@ def set_progress(value: int, job_id: Optional[str] = None)
|
|
|
84353
84377
|
# Progress value (0-100) or None if not set
|
|
84354
84378
|
def get_progress(job_id: Optional[str] = None) -> Any
|
|
84355
84379
|
|
|
84380
|
+
# Whether the worker running the job has received its shutdown signal.
|
|
84381
|
+
#
|
|
84382
|
+
# A draining worker waits for its current job to finish before exiting. A long-running
|
|
84383
|
+
# script can poll this and return early so the worker can be replaced.
|
|
84384
|
+
#
|
|
84385
|
+
# Args:
|
|
84386
|
+
# job_id: Job ID (defaults to current WM_JOB_ID)
|
|
84387
|
+
#
|
|
84388
|
+
# Returns:
|
|
84389
|
+
# True if the worker running the job is draining
|
|
84390
|
+
def worker_is_draining(job_id: Optional[str] = None) -> bool
|
|
84391
|
+
|
|
84356
84392
|
# Set the user state of a flow at a given key
|
|
84357
84393
|
def set_flow_user_state(key: str, value: Any) -> None
|
|
84358
84394
|
|
|
@@ -87612,10 +87648,48 @@ A **data pipeline** is NOT a flow. A flow is one runnable that orchestrates step
|
|
|
87612
87648
|
A pipeline node that produces a table should almost always be a **\`duckdb\`** node that materializes its output into a **DuckLake** table with \`-- materialize ducklake://<name>/<table>\` (in a DuckDB node the annotation uses SQL \`--\` comment syntax; write the body as a bare \`SELECT\` and let the runtime do the write). DuckLake is the default lakehouse store for pipelines and is the shape the pipeline editor is built around, so prefer it unless the work specifically calls for something else:
|
|
87613
87649
|
|
|
87614
87650
|
- \`postgresql\` / data tables — only for row-level, OLTP-style mutations against an existing Postgres data table (frequent single-row upserts/updates, transactional reads that an app queries live).
|
|
87615
|
-
- \`bun\` / \`python3\` — only for
|
|
87651
|
+
- \`bun\` / \`python3\` — only for work that doesn't map to SQL: calling an external API, wrangling files, arbitrary glue. When such a node produces tabular data for downstream steps, write it **straight into DuckLake** (or a data table) from the same script — see "Ingesting from Python / TypeScript" below — rather than inventing a parallel store.
|
|
87616
87652
|
|
|
87617
87653
|
Do not spread a pipeline across postgres, S3, and DuckLake when one DuckLake lake would do; a consistent DuckLake lakehouse is the goal.
|
|
87618
87654
|
|
|
87655
|
+
## Ingesting from Python / TypeScript
|
|
87656
|
+
|
|
87657
|
+
A node that fetches data in code (an API, a SaaS export, a scraper) writes the rows **directly** into their DuckLake table with \`wmill.ducklake()\`, or into a data table with \`wmill.datatable()\`. DuckLake already stores every table as parquet files in the workspace object storage, so **never stage the raw payload first** — no intermediate JSON / CSV / parquet file in S3 and no second "load the raw file" node. One ingestion node, one table.
|
|
87658
|
+
|
|
87659
|
+
Pass the rows as a query argument (a list of dicts / array of objects is sent as JSON) and let SQL unnest them; declare the column types so the table gets a real schema:
|
|
87660
|
+
|
|
87661
|
+
\`\`\`python
|
|
87662
|
+
# pipeline
|
|
87663
|
+
# on schedule
|
|
87664
|
+
import wmill
|
|
87665
|
+
|
|
87666
|
+
def main():
|
|
87667
|
+
rows = fetch_charges() # list[dict]
|
|
87668
|
+
lake = wmill.ducklake()
|
|
87669
|
+
lake.query("""
|
|
87670
|
+
CREATE OR REPLACE TABLE stripe_charges AS
|
|
87671
|
+
SELECT unnest(from_json($rows, '[{"id":"VARCHAR","amount":"BIGINT","created":"BIGINT"}]'), recursive := true)
|
|
87672
|
+
""", rows=rows).fetch()
|
|
87673
|
+
\`\`\`
|
|
87674
|
+
|
|
87675
|
+
\`\`\`ts
|
|
87676
|
+
// pipeline
|
|
87677
|
+
// on schedule
|
|
87678
|
+
import * as wmill from "windmill-client"
|
|
87679
|
+
|
|
87680
|
+
export async function main() {
|
|
87681
|
+
const rows = await fetchCharges()
|
|
87682
|
+
const lake = wmill.ducklake()
|
|
87683
|
+
await lake\`CREATE OR REPLACE TABLE stripe_charges AS
|
|
87684
|
+
SELECT unnest(from_json(\${rows}, '[{"id":"VARCHAR","amount":"BIGINT","created":"BIGINT"}]'), recursive := true)\`.fetch()
|
|
87685
|
+
}
|
|
87686
|
+
\`\`\`
|
|
87687
|
+
|
|
87688
|
+
- Use \`INSERT INTO <table> SELECT ...\` instead of \`CREATE OR REPLACE\` to append (an incremental pull), with a one-time \`CREATE TABLE IF NOT EXISTS\` first.
|
|
87689
|
+
- Assign the client to a variable (\`lake = wmill.ducklake()\`) and keep the SQL a **string literal** (Python) or a template without \`sql.raw\` (TS): that is what lets the graph record the node's write to \`ducklake://main/<table>\`. A chained \`wmill.ducklake().query(...)\` or SQL built in a variable records no output, so the downstream edge never forms.
|
|
87690
|
+
- \`wmill.ducklake("<name>")\` targets a non-default catalog; \`wmill.datatable("<name>")\` writes a Postgres data table the same way (Python \`db.query(sql, *args)\` with \`$1\` placeholders, TS the same template form) — use it only when the data belongs in Postgres (see above).
|
|
87691
|
+
- The downstream node triggers on the table itself: \`-- on ducklake://main/stripe_charges\`.
|
|
87692
|
+
|
|
87619
87693
|
## Storage prerequisites
|
|
87620
87694
|
|
|
87621
87695
|
A DuckLake pipeline only runs once the workspace has **object storage** (S3 / Azure Blob / GCS) **and a DuckLake catalog** configured — DuckLake tables and \`s3://\` assets can't be materialized or read without it. Check which DuckLake catalogs the workspace has before you build.
|
|
@@ -87659,7 +87733,7 @@ The key must be a **string literal** — the graph parser is static and cannot f
|
|
|
87659
87733
|
|
|
87660
87734
|
## Materialize (the managed output)
|
|
87661
87735
|
|
|
87662
|
-
> **A MANAGED \`// materialize\` is DuckDB-only**, and its target must be a DuckLake table (\`ducklake://<name>/<table>\`). Deploy **rejects** a \`ducklake://\` \`// materialize\` on any other language (\`python3\`, \`bun\`, \`postgresql\`). For a non-DuckDB node writing the lake, do **not** use \`// materialize\` — write the
|
|
87736
|
+
> **A MANAGED \`// materialize\` is DuckDB-only**, and its target must be a DuckLake table (\`ducklake://<name>/<table>\`). Deploy **rejects** a \`ducklake://\` \`// materialize\` on any other language (\`python3\`, \`bun\`, \`postgresql\`). For a non-DuckDB node writing the lake, do **not** use \`// materialize\` — write the table itself with \`wmill.ducklake()\` (see "Ingesting from Python / TypeScript") and let the output be inferred. Use \`duckdb\` when a node should materialize a DuckLake table.
|
|
87663
87737
|
>
|
|
87664
87738
|
> The one target ANY language may declare (except a dbt script, whose writes come from its manifest) is a **warehouse relation**: \`// materialize manual dbt://<warehouse>/<schema>/<name>\`, where \`<warehouse>\` is a warehouse the workspace configures under Settings → dbt. \`manual\` is the only mode it has — nothing generates warehouse DDL, so the node issues its own write (a postgresql \`CREATE TABLE\` / \`INSERT\`, an SDK load, …) and the annotation records the outcome. Use it on an ingestion node whose output a dbt project reads as a \`source\`: the declared relation and the dbt model land on ONE graph node, and a downstream \`// on dbt://<warehouse>/<schema>/<name>\` fires when the ingestion node completes.
|
|
87665
87739
|
|