fix: executor output_idx corrupting --file-uuid arg in store_traced_faces.py

The PythonExecutor.run() hardcoded output_idx=1, which treats args[1] as
an output file path and rewrites it to .json.tmp. For scripts like
store_traced_faces.py that use --file-uuid (not an output path) at
position 1, this corrupted the UUID into a file path, causing the script
to fail with exit status 1 within 90ms.

- run_with_output_idx: output_idx changed from usize to Option<usize>
- run_with_output_idx_and_frames: same change
- run(): doc comment added, passes Some(1) for backward compatibility
- job_worker.rs: store_traced_faces.py and release_pack.py calls now
  pass None for output_idx (no output path substitution)
- appearance.rs: passes Some(2) explicitly (output at index 2)

Verified: Gamma 8 file completed full pipeline with 24 face traces
and 185 TKG nodes.
This commit is contained in:
Accusys
2026-08-02 20:53:51 +08:00
parent e22393d577
commit 5244386892
3 changed files with 463 additions and 306 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ pub async fn process_appearance(
uuid, uuid,
"APPEARANCE", "APPEARANCE",
Some(APPEARANCE_TIMEOUT), Some(APPEARANCE_TIMEOUT),
2, Some(2),
frames, frames,
) )
.await .await
+20 -9
View File
@@ -258,6 +258,9 @@ impl PythonExecutor {
Ok(()) Ok(())
} }
/// Run a Python script. `output_idx` specifies which arg index is the output
/// file path (rewritten to `.json.tmp` during execution, promoted on success).
/// Pass `None` if the script determines its own output path (e.g. from `--file-uuid`).
pub async fn run( pub async fn run(
&self, &self,
script_name: &str, script_name: &str,
@@ -266,8 +269,15 @@ impl PythonExecutor {
log_prefix: &str, log_prefix: &str,
timeout_duration: Option<Duration>, timeout_duration: Option<Duration>,
) -> Result<()> { ) -> Result<()> {
self.run_with_output_idx(script_name, args, uuid, log_prefix, timeout_duration, 1) self.run_with_output_idx(
.await script_name,
args,
uuid,
log_prefix,
timeout_duration,
Some(1),
)
.await
} }
/// Run a script with optional frame list for 8Hz sampling. /// Run a script with optional frame list for 8Hz sampling.
@@ -430,7 +440,7 @@ impl PythonExecutor {
uuid: Option<&str>, uuid: Option<&str>,
log_prefix: &str, log_prefix: &str,
timeout_duration: Option<Duration>, timeout_duration: Option<Duration>,
output_idx: usize, output_idx: Option<usize>,
) -> Result<()> { ) -> Result<()> {
let script_path = self.scripts_dir.join(script_name); let script_path = self.scripts_dir.join(script_name);
@@ -443,8 +453,8 @@ impl PythonExecutor {
"Pre-execution integrity check failed — possible version mismatch or corruption", "Pre-execution integrity check failed — possible version mismatch or corruption",
)?; )?;
// 標記輸出檔為處理中(add .tmp suffix) let output_path =
let output_path = args.get(output_idx).map(|p| std::path::PathBuf::from(p)); output_idx.and_then(|idx| args.get(idx).map(|p| std::path::PathBuf::from(p)));
let tmp_path = output_path.as_ref().map(|p| { let tmp_path = output_path.as_ref().map(|p| {
let mut tmp = p.to_path_buf(); let mut tmp = p.to_path_buf();
tmp.set_extension("json.tmp"); tmp.set_extension("json.tmp");
@@ -472,7 +482,7 @@ impl PythonExecutor {
// Route the script's declared output path through a .tmp file so the // Route the script's declared output path through a .tmp file so the
// fresh result is written there and promoted to the real path only on // fresh result is written there and promoted to the real path only on
// success (avoids clobbering good output with a stale/partial file). // success (avoids clobbering good output with a stale/partial file).
if i == output_idx { if Some(i) == output_idx {
if let Some(ref tmp) = tmp_path { if let Some(ref tmp) = tmp_path {
cmd.arg(tmp); cmd.arg(tmp);
continue; continue;
@@ -623,7 +633,7 @@ impl PythonExecutor {
uuid: Option<&str>, uuid: Option<&str>,
log_prefix: &str, log_prefix: &str,
timeout_duration: Option<Duration>, timeout_duration: Option<Duration>,
output_idx: usize, output_idx: Option<usize>,
frames: Option<&[i64]>, frames: Option<&[i64]>,
) -> Result<()> { ) -> Result<()> {
let script_path = self.scripts_dir.join(script_name); let script_path = self.scripts_dir.join(script_name);
@@ -636,7 +646,8 @@ impl PythonExecutor {
"Pre-execution integrity check failed — possible version mismatch or corruption", "Pre-execution integrity check failed — possible version mismatch or corruption",
)?; )?;
let output_path = args.get(output_idx).map(|p| std::path::PathBuf::from(p)); let output_path =
output_idx.and_then(|idx| args.get(idx).map(|p| std::path::PathBuf::from(p)));
let tmp_path = output_path.as_ref().map(|p| { let tmp_path = output_path.as_ref().map(|p| {
let mut tmp = p.to_path_buf(); let mut tmp = p.to_path_buf();
tmp.set_extension("json.tmp"); tmp.set_extension("json.tmp");
@@ -661,7 +672,7 @@ impl PythonExecutor {
// Route the script's declared output path through a .tmp file so the // Route the script's declared output path through a .tmp file so the
// fresh result is written there and promoted to the real path only on // fresh result is written there and promoted to the real path only on
// success (avoids clobbering good output with a stale/partial file). // success (avoids clobbering good output with a stale/partial file).
if i == output_idx { if Some(i) == output_idx {
if let Some(ref tmp) = tmp_path { if let Some(ref tmp) = tmp_path {
cmd.arg(tmp); cmd.arg(tmp);
continue; continue;
+442 -296
View File
File diff suppressed because it is too large Load Diff