From 010e0fdc2352d740a72de124cc26eea8fc1915af Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 19 Aug 2024 17:03:06 +0200 Subject: [PATCH 1/4] fix(typescript-client): runFlowAsync by default assume job doesn't outlive flow --- typescript-client/client.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/typescript-client/client.ts b/typescript-client/client.ts index 73c1c1834e..01029ecac2 100644 --- a/typescript-client/client.ts +++ b/typescript-client/client.ts @@ -134,7 +134,7 @@ export async function runFlow( console.info(`running \`${path}\` synchronously with args:`, args); } - const jobId = await runFlowAsync(path, args); + const jobId = await runFlowAsync(path, args, null, true); return await waitJob(jobId, verbose); } @@ -272,7 +272,8 @@ export async function runScriptAsync( export async function runFlowAsync( path: string | null, args: Record | null, - scheduledInSeconds: number | null = null + scheduledInSeconds: number | null = null, + flowOutlivesParent: boolean = false ): Promise { // Create a script job and return its job id. @@ -283,9 +284,11 @@ export async function runFlowAsync( params["scheduled_in_secs"] = scheduledInSeconds; } - let parentJobId = getEnv("WM_JOB_ID"); - if (parentJobId !== undefined) { - params["parent_job"] = parentJobId; + if (flowOutlivesParent) { + let parentJobId = getEnv("WM_JOB_ID"); + if (parentJobId !== undefined) { + params["parent_job"] = parentJobId; + } } let rootJobId = getEnv("WM_ROOT_FLOW_JOB_ID"); From 75852f27b5407da5dba723fd0d739a37a495339a Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 19 Aug 2024 17:16:22 +0200 Subject: [PATCH 2/4] Update client.ts --- typescript-client/client.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/typescript-client/client.ts b/typescript-client/client.ts index 01029ecac2..0c7c672f78 100644 --- a/typescript-client/client.ts +++ b/typescript-client/client.ts @@ -134,7 +134,7 @@ export async function runFlow( console.info(`running \`${path}\` synchronously with args:`, args); } - const jobId = await runFlowAsync(path, args, null, true); + const jobId = await runFlowAsync(path, args, null, false); return await waitJob(jobId, verbose); } @@ -273,7 +273,7 @@ export async function runFlowAsync( path: string | null, args: Record | null, scheduledInSeconds: number | null = null, - flowOutlivesParent: boolean = false + flowOutlivesParent: boolean = true ): Promise { // Create a script job and return its job id. @@ -284,7 +284,7 @@ export async function runFlowAsync( params["scheduled_in_secs"] = scheduledInSeconds; } - if (flowOutlivesParent) { + if (!flowOutlivesParent) { let parentJobId = getEnv("WM_JOB_ID"); if (parentJobId !== undefined) { params["parent_job"] = parentJobId; From f3bcadbfb1e42b56996e273800aa0dcb01a6868b Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 19 Aug 2024 22:18:48 +0200 Subject: [PATCH 3/4] fix(cli): improve error message of cli --- cli/flow.ts | 22 ++++++++++++++-------- cli/folder.ts | 3 +-- cli/script.ts | 18 +++++++++++++----- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/cli/flow.ts b/cli/flow.ts index f47d319a07..929e0c2b34 100644 --- a/cli/flow.ts +++ b/cli/flow.ts @@ -115,14 +115,20 @@ export async function pushFlow( }); } else { log.info(colors.bold.yellow("Creating new flow...")); - await FlowService.createFlow({ - workspace: workspace, - requestBody: { - path: remotePath.replaceAll(SEP, "/"), - deployment_message: message, - ...localFlow, - }, - }); + try { + await FlowService.createFlow({ + workspace: workspace, + requestBody: { + path: remotePath.replaceAll(SEP, "/"), + deployment_message: message, + ...localFlow, + }, + }); + } catch (e) { + throw new Error( + `Failed to create flow ${remotePath}: ${e.body ?? e.message}` + ); + } } } diff --git a/cli/folder.ts b/cli/folder.ts index 4c1ddd85c0..ecc6e56e24 100644 --- a/cli/folder.ts +++ b/cli/folder.ts @@ -92,8 +92,7 @@ export async function pushFolder( }, }); } catch (e) { - console.error(e.body); - throw e; + throw Error(`Failed to create folder ${name}: ${e.body ?? e.message}`); } } } diff --git a/cli/script.ts b/cli/script.ts index 408f131b60..5ac01324f6 100644 --- a/cli/script.ts +++ b/cli/script.ts @@ -366,11 +366,19 @@ async function createScript( workspace: Workspace ) { if (!bundleContent) { - // no parent hash - await ScriptService.createScript({ - workspace: workspaceId, - requestBody: body, - }); + try { + // no parent hash + await ScriptService.createScript({ + workspace: workspaceId, + requestBody: body, + }); + } catch (e) { + throw Error( + `Script creation for ${body.path} with parent ${ + body.parent_hash + } was not successful: ${e.body ?? e.message}` + ); + } } else { const form = new FormData(); form.append("script", JSON.stringify(body)); From 1a0e32b40b5f1ac5dcfe3639e697affb6e79a558 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 20 Aug 2024 08:49:51 +0200 Subject: [PATCH 4/4] fix(bun): disable large transpiling cache --- backend/windmill-worker/src/bun_executor.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/windmill-worker/src/bun_executor.rs b/backend/windmill-worker/src/bun_executor.rs index a1bc2ed299..c7ff297ff1 100644 --- a/backend/windmill-worker/src/bun_executor.rs +++ b/backend/windmill-worker/src/bun_executor.rs @@ -571,6 +571,7 @@ pub fn copy_recursively( } } } + let original = entry.path(); if filetype.is_dir() { @@ -1290,6 +1291,10 @@ pub async fn get_common_bun_proc_envs(base_internal_url: &str) -> HashMap