Merge branch 'main' into fr/flow-triggers-v0

This commit is contained in:
Faton Ramadani
2024-08-20 09:22:55 +02:00
5 changed files with 41 additions and 20 deletions
@@ -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<String
String::from("BUN_INSTALL_CACHE_DIR"),
BUN_CACHE_DIR.to_string(),
),
(
String::from("BUN_RUNTIME_TRANSPILER_CACHE_PATH"),
"0".to_string(),
),
]);
if let Some(ref node_path) = NODE_PATH.as_ref() {
+14 -8
View File
@@ -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}`
);
}
}
}
+1 -2
View File
@@ -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}`);
}
}
}
+13 -5
View File
@@ -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));
+8 -5
View File
@@ -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, false);
return await waitJob(jobId, verbose);
}
@@ -272,7 +272,8 @@ export async function runScriptAsync(
export async function runFlowAsync(
path: string | null,
args: Record<string, any> | null,
scheduledInSeconds: number | null = null
scheduledInSeconds: number | null = null,
flowOutlivesParent: boolean = true
): Promise<string> {
// 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");