fix autogen script names

This commit is contained in:
Ruben Fiszel
2023-03-28 21:07:21 +02:00
parent fa37d4c3f6
commit 2dfbf5ffcf
3 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -686,7 +686,7 @@ def main(error, port):
result,
json!({
"recv": 42,
"from failure module": {"error": {"name": "IndexError", "stack": " File \"/tmp/inner.py\", line 5, in main\n return sock.recv(1)[0]\n", "message": "index out of range"}},
"from failure module": {"error": {"name": "IndexError", "stack": " File \"/tmp/windmill/3/retry::test_with_failure_module/0187299b-1ea5-d1a3-5197-f48a6a84fcff/tmp/main/step_0.py\", line 5, in main\n return sock.recv(1)[0]\n", "message": "index out of range"}},
})
);
}
@@ -2069,7 +2069,7 @@ async fn test_branchall_skip_failure(db: Pool<Postgres>) {
assert_eq!(
result,
serde_json::json!([{"error": {"name": "Error", "stack": "Error: failure\n at main (file:///tmp/inner.ts:1:31)\n at run (file:///tmp/main.ts:9:26)\n at file:///tmp/main.ts:14:1", "message": "failure"}}, [1,3]])
serde_json::json!([{"error": {"name": "Error", "stack": "Error: failure\n at main (file:///tmp/main.ts:1:31)\n at run (file:///tmp/wrapper.ts:9:26)\n at file:///tmp/wrapper.ts:14:1", "message": "failure"}}, [1,3]])
);
let flow: FlowValue = serde_json::from_value(json!({
@@ -61,8 +61,8 @@ mount {
mount {
src: "{JOB_DIR}/inner.ts"
dst: "/tmp/inner.ts"
src: "{JOB_DIR}/wrapper.ts"
dst: "/tmp/wrapper.ts"
is_bind: true
}
+6 -6
View File
@@ -1556,14 +1556,14 @@ async fn handle_deno_job(
// TODO: Separately cache dependencies here using `deno cache --reload --lock=lock.json src/deps.ts` (https://deno.land/manual@v1.27.0/linking_to_external_code/integrity_checking)
// Then require caching below using --cached-only. This makes it so we require zero network interaction when running the process below
let _ = write_file(job_dir, "inner.ts", inner_content).await?;
let _ = write_file(job_dir, "main.ts", inner_content).await?;
let sig = trace_span!("parse_deno_signature")
.in_scope(|| windmill_parser_ts::parse_deno_signature(inner_content))?;
create_args_and_out_file(client, job, job_dir).await?;
let spread = sig.args.into_iter().map(|x| x.name).join(",");
let wrapper_content: String = format!(
r#"
import {{ main }} from "./inner.ts";
import {{ main }} from "./main.ts";
const args = await Deno.readTextFile("args.json")
.then(JSON.parse)
@@ -1593,12 +1593,12 @@ run().catch(async (e) => {{
if c == script_path_parts_len - 1 { "" } else { "/" },
);
}
write_file(job_dir, "main.ts", &wrapper_content).await?;
write_file(job_dir, "wrapper.ts", &wrapper_content).await?;
let import_map = format!(
r#"{{
"imports": {{
"/": "{base_internal_url}/api/w/{w_id}/scripts/raw/p/",
"./inner.ts": "./inner.ts",
"./wrapper.ts": "./wrapper.ts",
"./main.ts": "./main.ts"{relative_mounts}
}}
}}"#,
@@ -1642,7 +1642,7 @@ run().catch(async (e) => {{
} else {
args.push("-A");
}
args.push("/tmp/main.ts");
args.push("/tmp/wrapper.ts");
Command::new(NSJAIL_PATH.as_str())
.current_dir(job_dir)
@@ -1655,7 +1655,7 @@ run().catch(async (e) => {{
.spawn()?
} else {
let mut args = Vec::new();
let script_path = format!("{job_dir}/main.ts");
let script_path = format!("{job_dir}/wrapper.ts");
let import_map_path = format!("{job_dir}/import_map.json");
args.push("run");
args.push("--import-map");