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");