Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/containers/ftp/ftp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just needed to be updated since we don't write results files anymore

error: e.class.name,
message: e.message,
object_key: RESULT_KEY
}))
sf.send_task_failure({
Expand Down
13 changes: 8 additions & 5 deletions src/containers/transcode/transcode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions state-machine.asl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down