diff --git a/app/views/good_job/jobs/_executions.erb b/app/views/good_job/jobs/_executions.erb index f01f01e1c..e6830d7d6 100644 --- a/app/views/good_job/jobs/_executions.erb +++ b/app/views/good_job/jobs/_executions.erb @@ -38,7 +38,7 @@ <% end %>
- <%= tag.pre JSON.pretty_generate(execution.serialized_params), id: dom_id(execution, "params"), class: "collapse bg-light card card-body p-3 my-3" %> + <%= tag.pre JSON.pretty_generate(execution.display_serialized_params), id: dom_id(execution, "params"), class: "collapse bg-light card card-body p-3 my-3" %>
<% end %> <% end %> diff --git a/app/views/good_job/jobs/_table.erb b/app/views/good_job/jobs/_table.erb index 311c14459..b20fa9876 100644 --- a/app/views/good_job/jobs/_table.erb +++ b/app/views/good_job/jobs/_table.erb @@ -13,7 +13,7 @@ Executions Error - ActiveJob Params  + Parameters  <%= tag.button "Toggle", type: "button", class: "btn btn-sm btn-outline-primary", role: "button", data: { bs_toggle: "collapse", bs_target: ".job-params" }, aria: { expanded: false, controls: jobs.map { |job| "##{dom_id(job, "params")}" }.join(" ") } @@ -71,7 +71,7 @@ data: { bs_toggle: "collapse", bs_target: "##{dom_id(job, 'params')}" }, aria: { expanded: false, controls: dom_id(job, "params") } %> - <%= tag.pre JSON.pretty_generate(job.serialized_params), id: dom_id(job, "params"), class: "collapse job-params" %> + <%= tag.pre JSON.pretty_generate(job.display_serialized_params), id: dom_id(job, "params"), class: "collapse job-params" %>
diff --git a/lib/models/good_job/cron_entry.rb b/lib/models/good_job/cron_entry.rb index e94a23fe8..69ee0e2eb 100644 --- a/lib/models/good_job/cron_entry.rb +++ b/lib/models/good_job/cron_entry.rb @@ -112,9 +112,11 @@ def display_properties class: job_class, cron: schedule, set: display_property(set), - args: display_property(args), description: display_property(description), - } + }.tap do |properties| + properties[:args] = display_property(args) if args.present? + properties[:kwargs] = display_property(kwargs) if kwargs.present? + end end private diff --git a/lib/models/good_job/execution.rb b/lib/models/good_job/execution.rb index 6d12354fa..709d85fb7 100644 --- a/lib/models/good_job/execution.rb +++ b/lib/models/good_job/execution.rb @@ -299,6 +299,14 @@ def status end end + # Return formatted serialized_params for display in the dashboard + # @return [Hash] + def display_serialized_params + serialized_params.merge({ + _good_job: attributes.except('serialized_params', 'locktype', 'owns_advisory_lock'), + }) + end + def running? if has_attribute?(:locktype) self['locktype'].present? diff --git a/lib/models/good_job/job.rb b/lib/models/good_job/job.rb index a48cf3681..24f5d88f2 100644 --- a/lib/models/good_job/job.rb +++ b/lib/models/good_job/job.rb @@ -160,6 +160,14 @@ def recent_error error || executions[-2]&.error end + # Return formatted serialized_params for display in the dashboard + # @return [Hash] + def display_serialized_params + serialized_params.merge({ + _good_job: attributes.except('serialized_params', 'locktype', 'owns_advisory_lock'), + }) + end + # Tests whether the job is being executed right now. # @return [Boolean] def running? diff --git a/lib/models/good_job/process.rb b/lib/models/good_job/process.rb index a9aa79bfe..daf30041c 100644 --- a/lib/models/good_job/process.rb +++ b/lib/models/good_job/process.rb @@ -45,6 +45,8 @@ def self.current_state hostname: Socket.gethostname, pid: ::Process.pid, proctitle: $PROGRAM_NAME, + preserve_job_records: GoodJob.preserve_job_records, + retry_on_unhandled_error: GoodJob.retry_on_unhandled_error, schedulers: GoodJob::Scheduler.instances.map(&:name), } end