Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Retries field into views #204

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion app/helpers/mission_control/jobs/jobs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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", "" ]
when "finished" then [ "Queue", "Finished" ]
when "scheduled" then [ "Queue", "Scheduled", "" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
</td>
</tr>
<% end %>
<tr>
<th>Retries</th>
<td>
<%= job.retries %>
</td>
</tr>
<% if job.finished_at.present? %>
<tr>
<th>Finished at</th>
Expand Down
3 changes: 3 additions & 0 deletions app/views/mission_control/jobs/jobs/failed/_job.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<%= link_to failed_job_error(job), application_job_path(@application, job.job_id, anchor: "error") %>
<div class="has-text-grey"><%= formatted_time(job.failed_at) %></div>
</td>
<td>
<%= job.retries %>
</td>
<td class="pr-0">
<%= render "mission_control/jobs/jobs/failed/actions", job: job %>
</td>
4 changes: 4 additions & 0 deletions lib/active_job/job_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def serialize
end
end

def retries
self.arguments.first["executions"] || 0
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm... I have two questions about this... first, do we need self? Second, does this work in general? 🤔 This extends ActiveJob::Base, which means arguments are the deserialized job arguments (which probably won't be deserialized here yet, because they're lazily deserialized when they're needed).

Copy link
Author

Choose a reason for hiding this comment

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

in fact the self was not necessary.
And yes, it works, at least it is working on the screens where I applied it lol

end

def perform_now
raise UnsupportedError, "A JobProxy doesn't support immediate execution, only enqueuing."
end
Expand Down