mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 08:01:26 +00:00
feat(sdk): allow overriding worker tag when running jobs (WIN-2105) (#9807)
* feat(sdk): allow overriding worker tag when running jobs Add an optional `tag` parameter to every job-running helper across the TypeScript, Python, PowerShell and Rust client SDKs. When set, it is forwarded as the `tag` query param on the `jobs/run/*` endpoints, which the backend already honors as a worker-tag override. The parameter is appended last and defaults to null/None everywhere, so existing positional and keyword callers are unaffected. Rust has no optional params, so its existing `run_script_async`/`run_script_sync` signatures are left untouched and new `*_with_tag` variants are added. Fixes WIN-2105 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(system_prompts): regenerate SDK docs for tag param Regenerate auto-generated system prompts so the TypeScript/Python SDK references (and the script skills that embed them) reflect the new optional `tag` parameter on the job-running helpers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(powershell-sdk): preserve original RunScriptAsync/RunFlowAsync arities PowerShell class methods dispatch by exact argument count and have no default parameter values, so adding `$Tag` in place dropped the old 4-arg `RunScriptAsync` / 3-arg `RunFlowAsync` overloads — existing direct class calls would fail with "Cannot find an overload". Re-add the original arities as thin overloads that forward `$null` for `$Tag`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(system_prompts): generate prompts.d.ts to stop literal-content drift prompts.d.ts was a tracked declaration file with string-literal types baked in, but generate.py never regenerated it — only prompts.ts and the hand-written index.d.ts. So every prompt change (e.g. the new SDK `tag` param) left prompts.d.ts stale, and check-freshness didn't catch it because generate.py never wrote the file. Emit prompts.d.ts from generate.py as plain `export declare const X: string;` declarations. The contents now live only in prompts.ts, so the declaration file can't drift, and check-freshness covers it going forward. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -580,25 +580,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -617,9 +619,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -646,25 +649,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -672,9 +677,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
@@ -1334,25 +1340,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -1371,9 +1379,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -1400,25 +1409,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -1426,9 +1437,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
@@ -2180,25 +2192,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -2217,9 +2231,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -2246,25 +2261,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -2272,9 +2289,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
@@ -3869,27 +3887,27 @@ def create_token(duration = dt.timedelta(days=1)) -> str
|
||||
# Create a script job and return its job id.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path_async or run_script_by_hash_async instead.
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by path and return its job id.
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by hash and return its job id.
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a flow job and return its job id.
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True) -> str
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True, tag: str = None) -> str
|
||||
|
||||
# Run script synchronously and return its result.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path or run_script_by_hash instead.
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by path synchronously and return its result.
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by hash synchronously and return its result.
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run a script on the current worker without creating a job.
|
||||
#
|
||||
@@ -4307,10 +4325,11 @@ def get_version() -> str
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Run a script synchronously by path and return its result.
|
||||
#
|
||||
@@ -4321,10 +4340,11 @@ def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = Fals
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
||||
# initiate an S3 connection from DuckDB
|
||||
|
||||
@@ -258,14 +258,15 @@ function Invoke-WindmillScript {
|
||||
[string] $Hash = $null,
|
||||
[Hashtable] $Arguments = @{},
|
||||
[boolean] $AssertResultIsNotNull = $true,
|
||||
[int] $Timeout = $null
|
||||
[int] $Timeout = $null,
|
||||
[string] $Tag = $null
|
||||
)
|
||||
|
||||
if (-not $script:WindmillConnection) {
|
||||
throw "Windmill connection not established. Run Connect-Windmill first."
|
||||
}
|
||||
|
||||
$jobId = Start-WindmillScript -Path $Path -Hash $Hash -Arguments $Arguments
|
||||
$jobId = Start-WindmillScript -Path $Path -Hash $Hash -Arguments $Arguments -Tag $Tag
|
||||
$until = if ($Timeout) { (Get-Date).AddSeconds($Timeout) } else { [DateTime]::MaxValue }
|
||||
return $script:WindmillConnection.WaitJob($jobId, $until, $AssertResultIsNotNull)
|
||||
}
|
||||
@@ -279,14 +280,15 @@ function Start-WindmillScript {
|
||||
[string] $Path = $null,
|
||||
[string] $Hash = $null,
|
||||
[Hashtable] $Arguments = @{},
|
||||
[int] $ScheduledInSecs = $null
|
||||
[int] $ScheduledInSecs = $null,
|
||||
[string] $Tag = $null
|
||||
)
|
||||
|
||||
if (-not $script:WindmillConnection) {
|
||||
throw "Windmill connection not established. Run Connect-Windmill first."
|
||||
}
|
||||
|
||||
return $script:WindmillConnection.RunScriptAsync($Path, $Hash, $Arguments, $ScheduledInSecs)
|
||||
return $script:WindmillConnection.RunScriptAsync($Path, $Hash, $Arguments, $ScheduledInSecs, $Tag)
|
||||
}
|
||||
|
||||
<#
|
||||
@@ -297,14 +299,15 @@ function Start-WindmillFlow {
|
||||
param(
|
||||
[string] $Path = $null,
|
||||
[Hashtable] $Arguments = @{},
|
||||
[int] $ScheduledInSecs = $null
|
||||
[int] $ScheduledInSecs = $null,
|
||||
[string] $Tag = $null
|
||||
)
|
||||
|
||||
if (-not $script:WindmillConnection) {
|
||||
throw "Windmill connection not established. Run Connect-Windmill first."
|
||||
}
|
||||
|
||||
return $script:WindmillConnection.RunFlowAsync($Path, $Arguments, $ScheduledInSecs)
|
||||
return $script:WindmillConnection.RunFlowAsync($Path, $Arguments, $ScheduledInSecs, $Tag)
|
||||
}
|
||||
|
||||
<#
|
||||
@@ -596,7 +599,13 @@ class Windmill {
|
||||
return $result
|
||||
}
|
||||
|
||||
# Preserve the original 4-arg arity (PowerShell class dispatch is by exact
|
||||
# argument count, so existing direct callers would otherwise break).
|
||||
[PSCustomObject] RunScriptAsync([string] $Path, [string] $Hash, [Hashtable] $Arguments, [int] $ScheduledInSecs) {
|
||||
return $this.RunScriptAsync($Path, $Hash, $Arguments, $ScheduledInSecs, $null)
|
||||
}
|
||||
|
||||
[PSCustomObject] RunScriptAsync([string] $Path, [string] $Hash, [Hashtable] $Arguments, [int] $ScheduledInSecs, [string] $Tag) {
|
||||
$params = @{}
|
||||
|
||||
if ($Path -and $Hash) {
|
||||
@@ -607,6 +616,10 @@ class Windmill {
|
||||
$params["scheduled_in_secs"] = $ScheduledInSecs
|
||||
}
|
||||
|
||||
if ($Tag) {
|
||||
$params["tag"] = $Tag
|
||||
}
|
||||
|
||||
if ($env:WM_JOB_ID) {
|
||||
$params["parent_job"] = $env:WM_JOB_ID
|
||||
}
|
||||
@@ -631,13 +644,23 @@ class Windmill {
|
||||
return $this.Post($endpoint, $Arguments, $true).Content
|
||||
}
|
||||
|
||||
# Preserve the original 3-arg arity (PowerShell class dispatch is by exact
|
||||
# argument count, so existing direct callers would otherwise break).
|
||||
[string] RunFlowAsync([string] $Path, [Hashtable] $Arguments, [int] $ScheduledInSecs) {
|
||||
return $this.RunFlowAsync($Path, $Arguments, $ScheduledInSecs, $null)
|
||||
}
|
||||
|
||||
[string] RunFlowAsync([string] $Path, [Hashtable] $Arguments, [int] $ScheduledInSecs, [string] $Tag) {
|
||||
$params = @{}
|
||||
|
||||
if ($ScheduledInSecs -ne $null) {
|
||||
$params["scheduled_in_secs"] = $ScheduledInSecs
|
||||
}
|
||||
|
||||
if ($Tag) {
|
||||
$params["tag"] = $Tag
|
||||
}
|
||||
|
||||
# TODO: Figure out why this fails when we set parent_job (at least for HN Discord Feed)
|
||||
if ($env:WM_JOB_ID) {
|
||||
$params["parent_job"] = $env:WM_JOB_ID
|
||||
|
||||
@@ -168,16 +168,17 @@ class Windmill:
|
||||
hash_: str = None,
|
||||
args: dict = None,
|
||||
scheduled_in_secs: int = None,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Create a script job and return its job id.
|
||||
|
||||
|
||||
.. deprecated:: Use run_script_by_path_async or run_script_by_hash_async instead.
|
||||
"""
|
||||
logging.warning(
|
||||
"run_script_async is deprecated. Use run_script_by_path_async or run_script_by_hash_async instead.",
|
||||
)
|
||||
assert not (path and hash_), "path and hash_ are mutually exclusive"
|
||||
return self._run_script_async_internal(path=path, hash_=hash_, args=args, scheduled_in_secs=scheduled_in_secs)
|
||||
return self._run_script_async_internal(path=path, hash_=hash_, args=args, scheduled_in_secs=scheduled_in_secs, tag=tag)
|
||||
|
||||
def _run_script_async_internal(
|
||||
self,
|
||||
@@ -185,10 +186,13 @@ class Windmill:
|
||||
hash_: str = None,
|
||||
args: dict = None,
|
||||
scheduled_in_secs: int = None,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Internal helper for running scripts asynchronously."""
|
||||
args = args or {}
|
||||
params = {"scheduled_in_secs": scheduled_in_secs} if scheduled_in_secs else {}
|
||||
if tag:
|
||||
params["tag"] = tag
|
||||
if os.environ.get("WM_JOB_ID"):
|
||||
params["parent_job"] = os.environ.get("WM_JOB_ID")
|
||||
if os.environ.get("WM_ROOT_FLOW_JOB_ID"):
|
||||
@@ -208,18 +212,20 @@ class Windmill:
|
||||
path: str,
|
||||
args: dict = None,
|
||||
scheduled_in_secs: int = None,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Create a script job by path and return its job id."""
|
||||
return self._run_script_async_internal(path=path, args=args, scheduled_in_secs=scheduled_in_secs)
|
||||
return self._run_script_async_internal(path=path, args=args, scheduled_in_secs=scheduled_in_secs, tag=tag)
|
||||
|
||||
def run_script_by_hash_async(
|
||||
self,
|
||||
hash_: str,
|
||||
args: dict = None,
|
||||
scheduled_in_secs: int = None,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Create a script job by hash and return its job id."""
|
||||
return self._run_script_async_internal(hash_=hash_, args=args, scheduled_in_secs=scheduled_in_secs)
|
||||
return self._run_script_async_internal(hash_=hash_, args=args, scheduled_in_secs=scheduled_in_secs, tag=tag)
|
||||
|
||||
def run_flow_async(
|
||||
self,
|
||||
@@ -230,10 +236,13 @@ class Windmill:
|
||||
# as otherwise the child flow and its own child will store their state in the parent job which will
|
||||
# lead to incorrectness and failures
|
||||
do_not_track_in_parent: bool = True,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Create a flow job and return its job id."""
|
||||
args = args or {}
|
||||
params = {"scheduled_in_secs": scheduled_in_secs} if scheduled_in_secs else {}
|
||||
if tag:
|
||||
params["tag"] = tag
|
||||
if not do_not_track_in_parent:
|
||||
if os.environ.get("WM_JOB_ID"):
|
||||
params["parent_job"] = os.environ.get("WM_JOB_ID")
|
||||
@@ -254,9 +263,10 @@ class Windmill:
|
||||
verbose: bool = False,
|
||||
cleanup: bool = True,
|
||||
assert_result_is_not_none: bool = False,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Run script synchronously and return its result.
|
||||
|
||||
|
||||
.. deprecated:: Use run_script_by_path or run_script_by_hash instead.
|
||||
"""
|
||||
logging.warning(
|
||||
@@ -265,7 +275,7 @@ class Windmill:
|
||||
assert not (path and hash_), "path and hash_ are mutually exclusive"
|
||||
return self._run_script_internal(
|
||||
path=path, hash_=hash_, args=args, timeout=timeout, verbose=verbose,
|
||||
cleanup=cleanup, assert_result_is_not_none=assert_result_is_not_none
|
||||
cleanup=cleanup, assert_result_is_not_none=assert_result_is_not_none, tag=tag
|
||||
)
|
||||
|
||||
def _run_script_internal(
|
||||
@@ -277,6 +287,7 @@ class Windmill:
|
||||
verbose: bool = False,
|
||||
cleanup: bool = True,
|
||||
assert_result_is_not_none: bool = False,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Internal helper for running scripts synchronously."""
|
||||
args = args or {}
|
||||
@@ -290,7 +301,7 @@ class Windmill:
|
||||
if isinstance(timeout, dt.timedelta):
|
||||
timeout = timeout.total_seconds()
|
||||
|
||||
job_id = self._run_script_async_internal(path=path, hash_=hash_, args=args)
|
||||
job_id = self._run_script_async_internal(path=path, hash_=hash_, args=args, tag=tag)
|
||||
return self.wait_job(
|
||||
job_id, timeout, verbose, cleanup, assert_result_is_not_none
|
||||
)
|
||||
@@ -303,11 +314,12 @@ class Windmill:
|
||||
verbose: bool = False,
|
||||
cleanup: bool = True,
|
||||
assert_result_is_not_none: bool = False,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Run script by path synchronously and return its result."""
|
||||
return self._run_script_internal(
|
||||
path=path, args=args, timeout=timeout, verbose=verbose,
|
||||
cleanup=cleanup, assert_result_is_not_none=assert_result_is_not_none
|
||||
cleanup=cleanup, assert_result_is_not_none=assert_result_is_not_none, tag=tag
|
||||
)
|
||||
|
||||
def run_script_by_hash(
|
||||
@@ -318,11 +330,12 @@ class Windmill:
|
||||
verbose: bool = False,
|
||||
cleanup: bool = True,
|
||||
assert_result_is_not_none: bool = False,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Run script by hash synchronously and return its result."""
|
||||
return self._run_script_internal(
|
||||
hash_=hash_, args=args, timeout=timeout, verbose=verbose,
|
||||
cleanup=cleanup, assert_result_is_not_none=assert_result_is_not_none
|
||||
cleanup=cleanup, assert_result_is_not_none=assert_result_is_not_none, tag=tag
|
||||
)
|
||||
|
||||
def run_inline_script_preview(
|
||||
@@ -1453,6 +1466,7 @@ def run_script_async(
|
||||
hash_or_path: str,
|
||||
args: Dict[str, Any] = None,
|
||||
scheduled_in_secs: int = None,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Create a script job and return its job ID.
|
||||
|
||||
@@ -1460,6 +1474,7 @@ def run_script_async(
|
||||
hash_or_path: Script hash or path (determined by presence of '/')
|
||||
args: Script arguments
|
||||
scheduled_in_secs: Delay before execution in seconds
|
||||
tag: Override the worker tag the job runs on
|
||||
|
||||
Returns:
|
||||
Job ID string
|
||||
@@ -1472,6 +1487,7 @@ def run_script_async(
|
||||
path=path,
|
||||
args=args,
|
||||
scheduled_in_secs=scheduled_in_secs,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
|
||||
@@ -1484,6 +1500,7 @@ def run_flow_async(
|
||||
# as otherwise the child flow and its own child will store their state in the parent job which will
|
||||
# lead to incorrectness and failures
|
||||
do_not_track_in_parent: bool = True,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Create a flow job and return its job ID.
|
||||
|
||||
@@ -1492,6 +1509,7 @@ def run_flow_async(
|
||||
args: Flow arguments
|
||||
scheduled_in_secs: Delay before execution in seconds
|
||||
do_not_track_in_parent: Whether to track in parent job (default: True)
|
||||
tag: Override the worker tag the job runs on
|
||||
|
||||
Returns:
|
||||
Job ID string
|
||||
@@ -1501,6 +1519,7 @@ def run_flow_async(
|
||||
args=args,
|
||||
scheduled_in_secs=scheduled_in_secs,
|
||||
do_not_track_in_parent=do_not_track_in_parent,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
|
||||
@@ -1512,6 +1531,7 @@ def run_script_sync(
|
||||
assert_result_is_not_none: bool = True,
|
||||
cleanup: bool = True,
|
||||
timeout: dt.timedelta = None,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Run a script synchronously by hash and return its result.
|
||||
|
||||
@@ -1522,6 +1542,7 @@ def run_script_sync(
|
||||
assert_result_is_not_none: Raise exception if result is None
|
||||
cleanup: Register cleanup handler to cancel job on exit
|
||||
timeout: Maximum time to wait
|
||||
tag: Override the worker tag the job runs on
|
||||
|
||||
Returns:
|
||||
Script result
|
||||
@@ -1533,6 +1554,7 @@ def run_script_sync(
|
||||
assert_result_is_not_none=assert_result_is_not_none,
|
||||
cleanup=cleanup,
|
||||
timeout=timeout,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
|
||||
@@ -1541,6 +1563,7 @@ def run_script_by_path_async(
|
||||
path: str,
|
||||
args: Dict[str, Any] = None,
|
||||
scheduled_in_secs: Union[None, int] = None,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Create a script job by path and return its job ID.
|
||||
|
||||
@@ -1548,6 +1571,7 @@ def run_script_by_path_async(
|
||||
path: Script path
|
||||
args: Script arguments
|
||||
scheduled_in_secs: Delay before execution in seconds
|
||||
tag: Override the worker tag the job runs on
|
||||
|
||||
Returns:
|
||||
Job ID string
|
||||
@@ -1556,6 +1580,7 @@ def run_script_by_path_async(
|
||||
path=path,
|
||||
args=args,
|
||||
scheduled_in_secs=scheduled_in_secs,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
|
||||
@@ -1564,6 +1589,7 @@ def run_script_by_hash_async(
|
||||
hash_: str,
|
||||
args: Dict[str, Any] = None,
|
||||
scheduled_in_secs: Union[None, int] = None,
|
||||
tag: str = None,
|
||||
) -> str:
|
||||
"""Create a script job by hash and return its job ID.
|
||||
|
||||
@@ -1571,6 +1597,7 @@ def run_script_by_hash_async(
|
||||
hash_: Script hash
|
||||
args: Script arguments
|
||||
scheduled_in_secs: Delay before execution in seconds
|
||||
tag: Override the worker tag the job runs on
|
||||
|
||||
Returns:
|
||||
Job ID string
|
||||
@@ -1579,6 +1606,7 @@ def run_script_by_hash_async(
|
||||
hash_=hash_,
|
||||
args=args,
|
||||
scheduled_in_secs=scheduled_in_secs,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
|
||||
@@ -1590,6 +1618,7 @@ def run_script_by_path_sync(
|
||||
assert_result_is_not_none: bool = True,
|
||||
cleanup: bool = True,
|
||||
timeout: dt.timedelta = None,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Run a script synchronously by path and return its result.
|
||||
|
||||
@@ -1600,6 +1629,7 @@ def run_script_by_path_sync(
|
||||
assert_result_is_not_none: Raise exception if result is None
|
||||
cleanup: Register cleanup handler to cancel job on exit
|
||||
timeout: Maximum time to wait
|
||||
tag: Override the worker tag the job runs on
|
||||
|
||||
Returns:
|
||||
Script result
|
||||
@@ -1611,6 +1641,7 @@ def run_script_by_path_sync(
|
||||
assert_result_is_not_none=assert_result_is_not_none,
|
||||
cleanup=cleanup,
|
||||
timeout=timeout,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
|
||||
@@ -2062,9 +2093,10 @@ def run_script(
|
||||
verbose: bool = False,
|
||||
cleanup: bool = True,
|
||||
assert_result_is_not_none: bool = True,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Run script synchronously and return its result.
|
||||
|
||||
|
||||
.. deprecated:: Use run_script_by_path or run_script_by_hash instead.
|
||||
"""
|
||||
return _client.run_script(
|
||||
@@ -2075,6 +2107,7 @@ def run_script(
|
||||
assert_result_is_not_none=assert_result_is_not_none,
|
||||
cleanup=cleanup,
|
||||
timeout=timeout,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
|
||||
@@ -2086,6 +2119,7 @@ def run_script_by_path(
|
||||
verbose: bool = False,
|
||||
cleanup: bool = True,
|
||||
assert_result_is_not_none: bool = True,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Run script by path synchronously and return its result."""
|
||||
return _client.run_script_by_path(
|
||||
@@ -2095,6 +2129,7 @@ def run_script_by_path(
|
||||
assert_result_is_not_none=assert_result_is_not_none,
|
||||
cleanup=cleanup,
|
||||
timeout=timeout,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
|
||||
@@ -2106,6 +2141,7 @@ def run_script_by_hash(
|
||||
verbose: bool = False,
|
||||
cleanup: bool = True,
|
||||
assert_result_is_not_none: bool = True,
|
||||
tag: str = None,
|
||||
) -> Any:
|
||||
"""Run script by hash synchronously and return its result."""
|
||||
return _client.run_script_by_hash(
|
||||
@@ -2115,6 +2151,7 @@ def run_script_by_hash(
|
||||
assert_result_is_not_none=assert_result_is_not_none,
|
||||
cleanup=cleanup,
|
||||
timeout=timeout,
|
||||
tag=tag,
|
||||
)
|
||||
|
||||
@init_global_client
|
||||
|
||||
@@ -629,7 +629,43 @@ impl Windmill {
|
||||
|
||||
ret!(async move {
|
||||
let job_id = self
|
||||
.run_script_async_inner(ident, ident_is_hash, args, scheduled_in_secs)
|
||||
.run_script_async_inner(ident, ident_is_hash, args, scheduled_in_secs, None)
|
||||
.await?;
|
||||
self.wait_job_inner(
|
||||
&job_id.to_string(),
|
||||
timeout_secs,
|
||||
verbose,
|
||||
assert_result_is_not_none,
|
||||
)
|
||||
.await
|
||||
});
|
||||
}
|
||||
|
||||
/// Same as [`Windmill::run_script_sync`] but allows overriding the worker `tag`
|
||||
/// the job runs on.
|
||||
///
|
||||
/// # Parameters
|
||||
/// In addition to the parameters of [`Windmill::run_script_sync`]:
|
||||
/// - `tag`: Optional worker tag override (the job is dispatched to workers
|
||||
/// listening on this tag instead of the script's default tag)
|
||||
pub fn run_script_sync_with_tag<'a>(
|
||||
&'a self,
|
||||
ident: &'a str,
|
||||
ident_is_hash: bool,
|
||||
args: Value,
|
||||
scheduled_in_secs: Option<u32>,
|
||||
timeout_secs: Option<u64>,
|
||||
verbose: bool,
|
||||
assert_result_is_not_none: bool,
|
||||
tag: Option<&'a str>,
|
||||
) -> MaybeFuture<'a, Result<Value, SdkError>> {
|
||||
if verbose {
|
||||
println!("running `{ident}` synchronously with {:?}", &args);
|
||||
}
|
||||
|
||||
ret!(async move {
|
||||
let job_id = self
|
||||
.run_script_async_inner(ident, ident_is_hash, args, scheduled_in_secs, tag)
|
||||
.await?;
|
||||
self.wait_job_inner(
|
||||
&job_id.to_string(),
|
||||
@@ -690,7 +726,25 @@ impl Windmill {
|
||||
args: Value,
|
||||
scheduled_in_secs: Option<u32>,
|
||||
) -> MaybeFuture<'a, Result<uuid::Uuid, SdkError>> {
|
||||
ret!(self.run_script_async_inner(ident, ident_is_hash, args, scheduled_in_secs));
|
||||
ret!(self.run_script_async_inner(ident, ident_is_hash, args, scheduled_in_secs, None));
|
||||
}
|
||||
|
||||
/// Same as [`Windmill::run_script_async`] but allows overriding the worker `tag`
|
||||
/// the job runs on.
|
||||
///
|
||||
/// # Arguments
|
||||
/// In addition to the arguments of [`Windmill::run_script_async`]:
|
||||
/// * `tag` - Optional worker tag override (the job is dispatched to workers
|
||||
/// listening on this tag instead of the script's default tag)
|
||||
pub fn run_script_async_with_tag<'a>(
|
||||
&'a self,
|
||||
ident: &'a str,
|
||||
ident_is_hash: bool,
|
||||
args: Value,
|
||||
scheduled_in_secs: Option<u32>,
|
||||
tag: Option<&'a str>,
|
||||
) -> MaybeFuture<'a, Result<uuid::Uuid, SdkError>> {
|
||||
ret!(self.run_script_async_inner(ident, ident_is_hash, args, scheduled_in_secs, tag));
|
||||
}
|
||||
|
||||
async fn run_script_async_inner<'a>(
|
||||
@@ -699,6 +753,7 @@ impl Windmill {
|
||||
ident_is_hash: bool,
|
||||
mut args: Value,
|
||||
scheduled_in_secs: Option<u32>,
|
||||
tag: Option<&'a str>,
|
||||
) -> Result<uuid::Uuid, SdkError> {
|
||||
if let Ok(parent_job) = var("WM_JOB_ID") {
|
||||
args["parent_job"] = json!(parent_job);
|
||||
@@ -712,6 +767,9 @@ impl Windmill {
|
||||
args["scheduled_in_secs"] = json!(scheduled_in_secs);
|
||||
}
|
||||
|
||||
// The `None`s below map positionally to the query params of the generated
|
||||
// job API. The 5th one is the worker `tag` override (after scheduled_for,
|
||||
// scheduled_in_secs, skip_preprocessor and parent_job).
|
||||
let uuid = if ident_is_hash {
|
||||
job_api::run_script_by_hash(
|
||||
&self.client_config,
|
||||
@@ -722,7 +780,7 @@ impl Windmill {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
tag,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@@ -746,7 +804,7 @@ impl Windmill {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
tag,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
||||
+36
-34
File diff suppressed because one or more lines are too long
@@ -965,25 +965,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -1002,9 +1004,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -1031,25 +1034,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -1057,9 +1062,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
@@ -1560,27 +1566,27 @@ def create_token(duration = dt.timedelta(days=1)) -> str
|
||||
# Create a script job and return its job id.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path_async or run_script_by_hash_async instead.
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by path and return its job id.
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by hash and return its job id.
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a flow job and return its job id.
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True) -> str
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True, tag: str = None) -> str
|
||||
|
||||
# Run script synchronously and return its result.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path or run_script_by_hash instead.
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by path synchronously and return its result.
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by hash synchronously and return its result.
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run a script on the current worker without creating a job.
|
||||
#
|
||||
@@ -1998,10 +2004,11 @@ def get_version() -> str
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Run a script synchronously by path and return its result.
|
||||
#
|
||||
@@ -2012,10 +2019,11 @@ def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = Fals
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
||||
# initiate an S3 connection from DuckDB
|
||||
|
||||
@@ -1468,25 +1468,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -1505,9 +1507,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -1534,25 +1537,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -1560,9 +1565,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
@@ -2063,27 +2069,27 @@ def create_token(duration = dt.timedelta(days=1)) -> str
|
||||
# Create a script job and return its job id.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path_async or run_script_by_hash_async instead.
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by path and return its job id.
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by hash and return its job id.
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a flow job and return its job id.
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True) -> str
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True, tag: str = None) -> str
|
||||
|
||||
# Run script synchronously and return its result.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path or run_script_by_hash instead.
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by path synchronously and return its result.
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by hash synchronously and return its result.
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run a script on the current worker without creating a job.
|
||||
#
|
||||
@@ -2501,10 +2507,11 @@ def get_version() -> str
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Run a script synchronously by path and return its result.
|
||||
#
|
||||
@@ -2515,10 +2522,11 @@ def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = Fals
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
||||
# initiate an S3 connection from DuckDB
|
||||
|
||||
@@ -46,27 +46,27 @@ def create_token(duration = dt.timedelta(days=1)) -> str
|
||||
# Create a script job and return its job id.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path_async or run_script_by_hash_async instead.
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by path and return its job id.
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by hash and return its job id.
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a flow job and return its job id.
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True) -> str
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True, tag: str = None) -> str
|
||||
|
||||
# Run script synchronously and return its result.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path or run_script_by_hash instead.
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by path synchronously and return its result.
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by hash synchronously and return its result.
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run a script on the current worker without creating a job.
|
||||
#
|
||||
@@ -484,10 +484,11 @@ def get_version() -> str
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Run a script synchronously by path and return its result.
|
||||
#
|
||||
@@ -498,10 +499,11 @@ def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = Fals
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
||||
# initiate an S3 connection from DuckDB
|
||||
|
||||
@@ -35,25 +35,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -72,9 +74,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -101,25 +104,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -127,9 +132,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
|
||||
@@ -206,25 +206,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -243,9 +245,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -272,25 +275,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -298,9 +303,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
|
||||
@@ -206,25 +206,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -243,9 +245,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -272,25 +275,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -298,9 +303,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
|
||||
@@ -206,25 +206,27 @@ async getRootJobId(jobId?: string): Promise<string>
|
||||
/**
|
||||
* @deprecated Use runScriptByPath or runScriptByHash instead
|
||||
*/
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScript(path: string | null = null, hash_: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its path and wait for the result
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByPath(path: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Run a script synchronously by its hash and wait for the result
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runScriptByHash(hash_: string, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Append a text to the result stream
|
||||
@@ -243,9 +245,10 @@ async streamResult(stream: AsyncIterable<string>): Promise<void>
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false): Promise<any>
|
||||
async runFlow(path: string | null = null, args: Record<string, any> | null = null, verbose: boolean = false, tag: string | null = null): Promise<any>
|
||||
|
||||
/**
|
||||
* Wait for a job to complete and return its result
|
||||
@@ -272,25 +275,27 @@ async getResultMaybe(jobId: string): Promise<any>
|
||||
/**
|
||||
* @deprecated Use runScriptByPathAsync or runScriptByHashAsync instead
|
||||
*/
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptAsync(path: string | null, hash_: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its path
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByPathAsync(path: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a script asynchronously by its hash
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null): Promise<string>
|
||||
async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = null, scheduledInSeconds: number | null = null, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Run a flow asynchronously by its path
|
||||
@@ -298,9 +303,10 @@ async runScriptByHashAsync(hash_: string, args: Record<string, any> | null = nul
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true): Promise<string>
|
||||
async runFlowAsync(path: string | null, args: Record<string, any> | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise<string>
|
||||
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
|
||||
@@ -231,27 +231,27 @@ def create_token(duration = dt.timedelta(days=1)) -> str
|
||||
# Create a script job and return its job id.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path_async or run_script_by_hash_async instead.
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_async(path: str = None, hash_: str = None, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by path and return its job id.
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_path_async(path: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a script job by hash and return its job id.
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None) -> str
|
||||
def run_script_by_hash_async(hash_: str, args: dict = None, scheduled_in_secs: int = None, tag: str = None) -> str
|
||||
|
||||
# Create a flow job and return its job id.
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True) -> str
|
||||
def run_flow_async(path: str, args: dict = None, scheduled_in_secs: int = None, do_not_track_in_parent: bool = True, tag: str = None) -> str
|
||||
|
||||
# Run script synchronously and return its result.
|
||||
#
|
||||
# .. deprecated:: Use run_script_by_path or run_script_by_hash instead.
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script(path: str = None, hash_: str = None, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by path synchronously and return its result.
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_path(path: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run script by hash synchronously and return its result.
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False) -> Any
|
||||
def run_script_by_hash(hash_: str, args: dict = None, timeout: dt.timedelta | int | float | None = None, verbose: bool = False, cleanup: bool = True, assert_result_is_not_none: bool = False, tag: str = None) -> Any
|
||||
|
||||
# Run a script on the current worker without creating a job.
|
||||
#
|
||||
@@ -669,10 +669,11 @@ def get_version() -> str
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Run a script synchronously by path and return its result.
|
||||
#
|
||||
@@ -683,10 +684,11 @@ def run_script_sync(hash: str, args: Dict[str, Any] = None, verbose: bool = Fals
|
||||
# assert_result_is_not_none: Raise exception if result is None
|
||||
# cleanup: Register cleanup handler to cancel job on exit
|
||||
# timeout: Maximum time to wait
|
||||
# tag: Override the worker tag the job runs on
|
||||
#
|
||||
# Returns:
|
||||
# Script result
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None) -> Any
|
||||
def run_script_by_path_sync(path: str, args: Dict[str, Any] = None, verbose: bool = False, assert_result_is_not_none: bool = True, cleanup: bool = True, timeout: dt.timedelta = None, tag: str = None) -> Any
|
||||
|
||||
# Convenient helpers that takes an S3 resource as input and returns the settings necessary to
|
||||
# initiate an S3 connection from DuckDB
|
||||
|
||||
@@ -689,6 +689,21 @@ def generate_ts_exports(prompts: dict[str, str]) -> str:
|
||||
return ts
|
||||
|
||||
|
||||
def generate_ts_declarations(prompts: dict[str, str]) -> str:
|
||||
"""Generate the .d.ts for prompts.ts.
|
||||
|
||||
Each export is declared as a plain `string` rather than a string-literal
|
||||
type so the declaration file does not embed (and drift against) the prompt
|
||||
contents — those live only in prompts.ts.
|
||||
"""
|
||||
dts = "// Auto-generated by generate.py - DO NOT EDIT\n\n"
|
||||
|
||||
for name in prompts.keys():
|
||||
dts += f"export declare const {name}: string;\n"
|
||||
|
||||
return dts
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Schema File Generation
|
||||
# =============================================================================
|
||||
@@ -2447,6 +2462,7 @@ def main():
|
||||
# Generate TypeScript exports
|
||||
ts_exports = generate_ts_exports(prompts)
|
||||
(OUTPUT_GENERATED_DIR / "prompts.ts").write_text(ts_exports)
|
||||
(OUTPUT_GENERATED_DIR / "prompts.d.ts").write_text(generate_ts_declarations(prompts))
|
||||
|
||||
# Generate complete script.md (all languages combined)
|
||||
script_md_parts = [script_base]
|
||||
@@ -2615,6 +2631,7 @@ export declare function getWorkflowAsCodePrompt(language?: string): string;
|
||||
print(f" - auto-generated/sdks/wac-python.md")
|
||||
print(f" - auto-generated/cli/cli-commands.md (auto-generated from CLI source)")
|
||||
print(f" - auto-generated/prompts.ts")
|
||||
print(f" - auto-generated/prompts.d.ts")
|
||||
print(f" - auto-generated/index.ts")
|
||||
print(f" - auto-generated/script.md")
|
||||
print(f" - auto-generated/flow.md")
|
||||
|
||||
Vendored
+4
-2
@@ -60,7 +60,8 @@ export declare function runScript(
|
||||
path?: string | null,
|
||||
hash_?: string | null,
|
||||
args?: Record<string, any> | null,
|
||||
verbose?: boolean
|
||||
verbose?: boolean,
|
||||
tag?: string | null
|
||||
): Promise<any>;
|
||||
export declare function waitJob(jobId: string, verbose?: boolean): Promise<any>;
|
||||
export declare function getResult(jobId: string): Promise<any>;
|
||||
@@ -70,7 +71,8 @@ export declare function runScriptAsync(
|
||||
path: string | null,
|
||||
hash_: string | null,
|
||||
args: Record<string, any> | null,
|
||||
scheduledInSeconds?: number | null
|
||||
scheduledInSeconds?: number | null,
|
||||
tag?: string | null
|
||||
): Promise<string>;
|
||||
/**
|
||||
* Resolve a resource value in case the default value was picked because the input payload was undefined
|
||||
|
||||
+42
-18
@@ -153,7 +153,8 @@ export async function runScript(
|
||||
path: string | null = null,
|
||||
hash_: string | null = null,
|
||||
args: Record<string, any> | null = null,
|
||||
verbose: boolean = false
|
||||
verbose: boolean = false,
|
||||
tag: string | null = null
|
||||
): Promise<any> {
|
||||
console.warn(
|
||||
"runScript is deprecated. Use runScriptByPath or runScriptByHash instead."
|
||||
@@ -161,14 +162,15 @@ export async function runScript(
|
||||
if (path && hash_) {
|
||||
throw new Error("path and hash_ are mutually exclusive");
|
||||
}
|
||||
return _runScriptInternal(path, hash_, args, verbose);
|
||||
return _runScriptInternal(path, hash_, args, verbose, tag);
|
||||
}
|
||||
|
||||
async function _runScriptInternal(
|
||||
path: string | null = null,
|
||||
hash_: string | null = null,
|
||||
args: Record<string, any> | null = null,
|
||||
verbose: boolean = false
|
||||
verbose: boolean = false,
|
||||
tag: string | null = null
|
||||
): Promise<any> {
|
||||
args = args || {};
|
||||
|
||||
@@ -183,7 +185,7 @@ async function _runScriptInternal(
|
||||
}
|
||||
}
|
||||
|
||||
const jobId = await _runScriptAsyncInternal(path, hash_, args);
|
||||
const jobId = await _runScriptAsyncInternal(path, hash_, args, null, tag);
|
||||
return await waitJob(jobId, verbose);
|
||||
}
|
||||
|
||||
@@ -192,14 +194,16 @@ async function _runScriptInternal(
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
export async function runScriptByPath(
|
||||
path: string,
|
||||
args: Record<string, any> | null = null,
|
||||
verbose: boolean = false
|
||||
verbose: boolean = false,
|
||||
tag: string | null = null
|
||||
): Promise<any> {
|
||||
return _runScriptInternal(path, null, args, verbose);
|
||||
return _runScriptInternal(path, null, args, verbose, tag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,14 +211,16 @@ export async function runScriptByPath(
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Script execution result
|
||||
*/
|
||||
export async function runScriptByHash(
|
||||
hash_: string,
|
||||
args: Record<string, any> | null = null,
|
||||
verbose: boolean = false
|
||||
verbose: boolean = false,
|
||||
tag: string | null = null
|
||||
): Promise<any> {
|
||||
return _runScriptInternal(null, hash_, args, verbose);
|
||||
return _runScriptInternal(null, hash_, args, verbose, tag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,12 +246,14 @@ export async function streamResult(stream: AsyncIterable<string>) {
|
||||
* @param path - Flow path in Windmill
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param verbose - Enable verbose logging
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Flow execution result
|
||||
*/
|
||||
export async function runFlow(
|
||||
path: string | null = null,
|
||||
args: Record<string, any> | null = null,
|
||||
verbose: boolean = false
|
||||
verbose: boolean = false,
|
||||
tag: string | null = null
|
||||
): Promise<any> {
|
||||
args = args || {};
|
||||
|
||||
@@ -253,7 +261,7 @@ export async function runFlow(
|
||||
console.info(`running \`${path}\` synchronously with args:`, args);
|
||||
}
|
||||
|
||||
const jobId = await runFlowAsync(path, args, null, false);
|
||||
const jobId = await runFlowAsync(path, args, null, false, tag);
|
||||
return await waitJob(jobId, verbose);
|
||||
}
|
||||
|
||||
@@ -368,7 +376,8 @@ export async function runScriptAsync(
|
||||
path: string | null,
|
||||
hash_: string | null,
|
||||
args: Record<string, any> | null,
|
||||
scheduledInSeconds: number | null = null
|
||||
scheduledInSeconds: number | null = null,
|
||||
tag: string | null = null
|
||||
): Promise<string> {
|
||||
console.warn(
|
||||
"runScriptAsync is deprecated. Use runScriptByPathAsync or runScriptByHashAsync instead."
|
||||
@@ -377,14 +386,15 @@ export async function runScriptAsync(
|
||||
if (path && hash_) {
|
||||
throw new Error("path and hash_ are mutually exclusive");
|
||||
}
|
||||
return _runScriptAsyncInternal(path, hash_, args, scheduledInSeconds);
|
||||
return _runScriptAsyncInternal(path, hash_, args, scheduledInSeconds, tag);
|
||||
}
|
||||
|
||||
async function _runScriptAsyncInternal(
|
||||
path: string | null = null,
|
||||
hash_: string | null = null,
|
||||
args: Record<string, any> | null = null,
|
||||
scheduledInSeconds: number | null = null
|
||||
scheduledInSeconds: number | null = null,
|
||||
tag: string | null = null
|
||||
): Promise<string> {
|
||||
// Create a script job and return its job id.
|
||||
args = args || {};
|
||||
@@ -394,6 +404,10 @@ async function _runScriptAsyncInternal(
|
||||
params["scheduled_in_secs"] = scheduledInSeconds;
|
||||
}
|
||||
|
||||
if (tag) {
|
||||
params["tag"] = tag;
|
||||
}
|
||||
|
||||
let parentJobId = getEnv("WM_JOB_ID");
|
||||
if (parentJobId !== undefined) {
|
||||
params["parent_job"] = parentJobId;
|
||||
@@ -431,14 +445,16 @@ async function _runScriptAsyncInternal(
|
||||
* @param path - Script path in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
export async function runScriptByPathAsync(
|
||||
path: string,
|
||||
args: Record<string, any> | null = null,
|
||||
scheduledInSeconds: number | null = null
|
||||
scheduledInSeconds: number | null = null,
|
||||
tag: string | null = null
|
||||
): Promise<string> {
|
||||
return _runScriptAsyncInternal(path, null, args, scheduledInSeconds);
|
||||
return _runScriptAsyncInternal(path, null, args, scheduledInSeconds, tag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -446,14 +462,16 @@ export async function runScriptByPathAsync(
|
||||
* @param hash_ - Script hash in Windmill
|
||||
* @param args - Arguments to pass to the script
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
export async function runScriptByHashAsync(
|
||||
hash_: string,
|
||||
args: Record<string, any> | null = null,
|
||||
scheduledInSeconds: number | null = null
|
||||
scheduledInSeconds: number | null = null,
|
||||
tag: string | null = null
|
||||
): Promise<string> {
|
||||
return _runScriptAsyncInternal(null, hash_, args, scheduledInSeconds);
|
||||
return _runScriptAsyncInternal(null, hash_, args, scheduledInSeconds, tag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,6 +480,7 @@ export async function runScriptByHashAsync(
|
||||
* @param args - Arguments to pass to the flow
|
||||
* @param scheduledInSeconds - Schedule execution for a future time (in seconds)
|
||||
* @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)
|
||||
* @param tag - Override the worker tag the job runs on
|
||||
* @returns Job ID of the created job
|
||||
*/
|
||||
export async function runFlowAsync(
|
||||
@@ -471,7 +490,8 @@ export async function runFlowAsync(
|
||||
// can only be set to false if this the job will be fully await and not concurrent with any other job
|
||||
// as otherwise the child flow and its own child will store their state in the parent job which will
|
||||
// lead to incorrectness and failures
|
||||
doNotTrackInParent: boolean = true
|
||||
doNotTrackInParent: boolean = true,
|
||||
tag: string | null = null
|
||||
): Promise<string> {
|
||||
// Create a script job and return its job id.
|
||||
|
||||
@@ -482,6 +502,10 @@ export async function runFlowAsync(
|
||||
params["scheduled_in_secs"] = scheduledInSeconds;
|
||||
}
|
||||
|
||||
if (tag) {
|
||||
params["tag"] = tag;
|
||||
}
|
||||
|
||||
if (!doNotTrackInParent) {
|
||||
let parentJobId = getEnv("WM_JOB_ID");
|
||||
if (parentJobId !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user