From e9a91ffd9d5045b55cd0992bcf815e12a0b4f9ff Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 12 Nov 2024 14:07:38 -0300 Subject: [PATCH 1/3] feat/Add Retries --- app/helpers/mission_control/jobs/jobs_helper.rb | 2 +- .../mission_control/jobs/jobs/_general_information.html.erb | 6 ++++++ app/views/mission_control/jobs/jobs/failed/_job.html.erb | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/helpers/mission_control/jobs/jobs_helper.rb b/app/helpers/mission_control/jobs/jobs_helper.rb index b37e0b52..3f8719df 100644 --- a/app/helpers/mission_control/jobs/jobs_helper.rb +++ b/app/helpers/mission_control/jobs/jobs_helper.rb @@ -25,7 +25,7 @@ def failed_job_backtrace(job, server) def attribute_names_for_job_status(status) case status.to_s - when "failed" then [ "Error", "" ] + when "failed" then [ "Error", "Retries", "" ] when "blocked" then [ "Queue", "Blocked by", "Block expiry", "" ] when "finished" then [ "Queue", "Finished" ] when "scheduled" then [ "Queue", "Scheduled", "" ] diff --git a/app/views/mission_control/jobs/jobs/_general_information.html.erb b/app/views/mission_control/jobs/jobs/_general_information.html.erb index 0030facd..318f1acb 100644 --- a/app/views/mission_control/jobs/jobs/_general_information.html.erb +++ b/app/views/mission_control/jobs/jobs/_general_information.html.erb @@ -34,6 +34,12 @@ <% end %> + + Retries + + <%= job.respond_to?(:arguments) ? job.arguments.first["executions"] : 0 %> + + <% if job.finished_at.present? %> Finished at diff --git a/app/views/mission_control/jobs/jobs/failed/_job.html.erb b/app/views/mission_control/jobs/jobs/failed/_job.html.erb index 5291336c..d41d3049 100644 --- a/app/views/mission_control/jobs/jobs/failed/_job.html.erb +++ b/app/views/mission_control/jobs/jobs/failed/_job.html.erb @@ -2,6 +2,9 @@ <%= link_to failed_job_error(job), application_job_path(@application, job.job_id, anchor: "error") %>
<%= formatted_time(job.failed_at) %>
+ + <%= job.respond_to?(:arguments) ? job.arguments.first["executions"] : 0 %> + <%= render "mission_control/jobs/jobs/failed/actions", job: job %> From d84d2d2e73eb945de5e05e7921b5ef17a3dda4b8 Mon Sep 17 00:00:00 2001 From: Felipe Date: Mon, 18 Nov 2024 14:21:44 -0300 Subject: [PATCH 2/3] Add retries to JobProxy --- .../mission_control/jobs/jobs/_general_information.html.erb | 2 +- app/views/mission_control/jobs/jobs/failed/_job.html.erb | 2 +- lib/active_job/job_proxy.rb | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/mission_control/jobs/jobs/_general_information.html.erb b/app/views/mission_control/jobs/jobs/_general_information.html.erb index 318f1acb..ca7b9ef5 100644 --- a/app/views/mission_control/jobs/jobs/_general_information.html.erb +++ b/app/views/mission_control/jobs/jobs/_general_information.html.erb @@ -37,7 +37,7 @@ Retries - <%= job.respond_to?(:arguments) ? job.arguments.first["executions"] : 0 %> + <%= job.retries %> <% if job.finished_at.present? %> diff --git a/app/views/mission_control/jobs/jobs/failed/_job.html.erb b/app/views/mission_control/jobs/jobs/failed/_job.html.erb index d41d3049..259498e7 100644 --- a/app/views/mission_control/jobs/jobs/failed/_job.html.erb +++ b/app/views/mission_control/jobs/jobs/failed/_job.html.erb @@ -3,7 +3,7 @@
<%= formatted_time(job.failed_at) %>
- <%= job.respond_to?(:arguments) ? job.arguments.first["executions"] : 0 %> + <%= job.retries %> <%= render "mission_control/jobs/jobs/failed/actions", job: job %> diff --git a/lib/active_job/job_proxy.rb b/lib/active_job/job_proxy.rb index 623415fb..cda0d712 100644 --- a/lib/active_job/job_proxy.rb +++ b/lib/active_job/job_proxy.rb @@ -20,6 +20,10 @@ def serialize end end + def retries + self.arguments.first["executions"] || 0 + end + def perform_now raise UnsupportedError, "A JobProxy doesn't support immediate execution, only enqueuing." end From 79dabee23c17ee30a1e4a0a75518438ac6d562e3 Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 4 Dec 2024 19:13:30 -0300 Subject: [PATCH 3/3] remove self ref --- lib/active_job/job_proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/active_job/job_proxy.rb b/lib/active_job/job_proxy.rb index cda0d712..5bf27c13 100644 --- a/lib/active_job/job_proxy.rb +++ b/lib/active_job/job_proxy.rb @@ -21,7 +21,7 @@ def serialize end def retries - self.arguments.first["executions"] || 0 + arguments.first["executions"] || 0 end def perform_now