Class: JobWorkflow::Monitoring::ExecutionRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/job_workflow/monitoring/execution_registry.rb

Class Method Summary collapse

Class Method Details

.find(job_id) ⇒ Object

: (String) -> ExecutionViewModel?



18
19
20
21
22
23
# File 'lib/job_workflow/monitoring/execution_registry.rb', line 18

def find(job_id)
  job_data = QueueAdapter.current.find_job(job_id)
  return if job_data.nil?

  build_view_model(job_data, hydrate_sub_tasks: true)
end

.page_for(job_class_name:, limit: DEFAULT_LIMIT, cursor: nil) ⇒ Object

: (job_class_name: String, ?limit: Integer, ?cursor: String?) -> ExecutionPage



11
12
13
14
15
# File 'lib/job_workflow/monitoring/execution_registry.rb', line 11

def page_for(job_class_name:, limit: DEFAULT_LIMIT, cursor: nil)
  page = QueueAdapter.current.fetch_root_workflow_job_page(job_class_name:, limit:, cursor:)
  executions = page.fetch(:jobs).filter_map { |job_data| build_view_model(job_data) }
  ExecutionPage.new(executions:, next_cursor: page[:next_cursor])
end