From 59599f83e1528d440a45fc891e65316cb0026be0 Mon Sep 17 00:00:00 2001 From: Chris Kalafarski Date: Tue, 27 Jan 2026 16:22:03 -0500 Subject: [PATCH 1/4] Fix failure logging --- src/containers/ftp/ftp.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/containers/ftp/ftp.rb b/src/containers/ftp/ftp.rb index e0cd14f..4b4439f 100755 --- a/src/containers/ftp/ftp.rb +++ b/src/containers/ftp/ftp.rb @@ -112,13 +112,12 @@ output: task_result.to_json }) rescue => e - puts e.class.name - puts e.message puts e.backtrace logger.debug(JSON.dump({ - msg: "Copying state machine results file for error", - bucket_name: bucket, + msg: "Sending task failure", + error: e.class.name, + message: e.message, object_key: RESULT_KEY })) sf.send_task_failure({ From 2e3ad6a8616aad388860c944d66ba9a290145bbe Mon Sep 17 00:00:00 2001 From: Chris Kalafarski Date: Thu, 19 Feb 2026 14:39:51 -0500 Subject: [PATCH 2/4] Include FFmpeg error info in TaskResult error message --- src/containers/transcode/transcode.rb | 13 ++++++++----- state-machine.asl.yml | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/containers/transcode/transcode.rb b/src/containers/transcode/transcode.rb index 92b4a1a..ac7ac76 100644 --- a/src/containers/transcode/transcode.rb +++ b/src/containers/transcode/transcode.rb @@ -101,7 +101,8 @@ def underscore puts "Calling FFmpeg" puts ffmpeg_cmd - raise StandardError, "FFmpeg failed" unless system ffmpeg_cmd + ff_stdout, ff_stderr, ff_status = Open3.capture3(ffmpeg_cmd) + raise StandardError, "FFmpeg failed" unless ff_status.success? end_time = Time.now.to_i duration = end_time - start_time @@ -116,11 +117,11 @@ def underscore "-print_format json" ].join(" ") - stdout, _stderr, status = Open3.capture3(ffprobe_cmd) - raise StandardError, "FFmpeg probe failed" unless status.success? + probe_stdout, probe_stderr, probe_status = Open3.capture3(ffprobe_cmd) + raise StandardError, "FFmpeg probe failed" unless probe_status.success? # Add the probe results for this output to the task result - probe_results = JSON.parse(stdout) + probe_results = JSON.parse(probe_stdout) task_result[:Duration] = probe_results["format"]["duration"].to_f * 1000 task_result[:Size] = probe_results["format"]["size"].to_i @@ -229,9 +230,11 @@ def underscore rescue => e puts JSON.dump({msg: "Task failed!", error: e.class.name, cause: e.message}) puts e.backtrace + p ff_stderr + p probe_stderr sf.send_task_failure({ task_token: ENV["STATE_MACHINE_TASK_TOKEN"], error: e.class.name, - cause: e.message + cause: [e.message, ff_stderr, probe_stderr].compact.join("\n\n") }) end diff --git a/state-machine.asl.yml b/state-machine.asl.yml index d123792..c5d0b14 100644 --- a/state-machine.asl.yml +++ b/state-machine.asl.yml @@ -695,6 +695,10 @@ States: Id.$: "$.Job.Id" Execution: Id.$: "$$.Execution.Id" + # $.Error will exist when a state takes the Catch path (because + # of `ResultPath: "$.Error"`, and will generally be an object + # like: + # { Error: "SomeError", Cause: "Something went wrong" } Error.$: "$.Error" ResultPath: "$.Void" # The output of the iterator states is discarded OutputPath: "$.Task" From f56123e15509848df555cae8b521fdf382f87908 Mon Sep 17 00:00:00 2001 From: Chris Kalafarski Date: Thu, 19 Feb 2026 14:42:40 -0500 Subject: [PATCH 3/4] Fix typo --- state-machine.asl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-machine.asl.yml b/state-machine.asl.yml index c5d0b14..fc63447 100644 --- a/state-machine.asl.yml +++ b/state-machine.asl.yml @@ -696,7 +696,7 @@ States: Execution: Id.$: "$$.Execution.Id" # $.Error will exist when a state takes the Catch path (because - # of `ResultPath: "$.Error"`, and will generally be an object + # of `ResultPath: "$.Error"`) and will generally be an object # like: # { Error: "SomeError", Cause: "Something went wrong" } Error.$: "$.Error" From 7f695a05912fa5491bfb2fadb7c2b58fc4c61e2a Mon Sep 17 00:00:00 2001 From: Chris Kalafarski Date: Thu, 19 Feb 2026 14:42:58 -0500 Subject: [PATCH 4/4] Mark variable as unused --- src/containers/transcode/transcode.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/containers/transcode/transcode.rb b/src/containers/transcode/transcode.rb index ac7ac76..632e99d 100644 --- a/src/containers/transcode/transcode.rb +++ b/src/containers/transcode/transcode.rb @@ -101,7 +101,7 @@ def underscore puts "Calling FFmpeg" puts ffmpeg_cmd - ff_stdout, ff_stderr, ff_status = Open3.capture3(ffmpeg_cmd) + _ff_stdout, ff_stderr, ff_status = Open3.capture3(ffmpeg_cmd) raise StandardError, "FFmpeg failed" unless ff_status.success? end_time = Time.now.to_i