Class: JobWorkflow::Monitoring::ExecutionViewModel
- Inherits:
-
Object
- Object
- JobWorkflow::Monitoring::ExecutionViewModel
- Defined in:
- lib/job_workflow/monitoring/execution_view_model.rb
Instance Attribute Summary collapse
-
#job_id ⇒ Object
readonly
: String.
-
#queue_name ⇒ Object
readonly
: String?.
-
#status ⇒ Object
readonly
: WorkflowStatus.
Instance Method Summary collapse
-
#arguments ⇒ Object
: () -> Arguments.
-
#current_task_name ⇒ Object
: () -> Symbol?.
-
#dag_layout ⇒ Object
: () -> Hash[Symbol, untyped].
-
#failed_task_name ⇒ Object
: () -> Symbol?.
-
#filtered_arguments ⇒ Object
: () -> Hash[untyped, untyped].
-
#initialize(job_id:, queue_name:, status:) ⇒ ExecutionViewModel
constructor
: (job_id: String, queue_name: String?, status: WorkflowStatus) -> void.
-
#job_class_name ⇒ Object
: () -> String.
-
#mission_control_job_path ⇒ Object
: () -> String?.
-
#running? ⇒ Boolean
: () -> bool.
-
#tasks ⇒ Object
: () -> Array[Hash[Symbol, untyped]].
-
#to_h ⇒ Object
: () -> Hash[Symbol, untyped].
-
#workflow_status ⇒ Object
: () -> Symbol.
Constructor Details
#initialize(job_id:, queue_name:, status:) ⇒ ExecutionViewModel
: (job_id: String, queue_name: String?, status: WorkflowStatus) -> void
11 12 13 14 15 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 11 def initialize(job_id:, queue_name:, status:) @job_id = job_id @queue_name = queue_name @status = status end |
Instance Attribute Details
#job_id ⇒ Object (readonly)
: String
6 7 8 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 6 def job_id @job_id end |
#queue_name ⇒ Object (readonly)
: String?
7 8 9 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 7 def queue_name @queue_name end |
#status ⇒ Object (readonly)
: WorkflowStatus
8 9 10 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 8 def status @status end |
Instance Method Details
#arguments ⇒ Object
: () -> Arguments
33 34 35 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 33 def arguments status.arguments end |
#current_task_name ⇒ Object
: () -> Symbol?
28 29 30 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 28 def current_task_name status.current_task_name end |
#dag_layout ⇒ Object
: () -> Hash[Symbol, untyped]
61 62 63 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 61 def dag_layout @dag_layout ||= DagLayout.new(tasks:).to_h end |
#failed_task_name ⇒ Object
: () -> Symbol?
48 49 50 51 52 53 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 48 def failed_task_name @failed_task_name ||= begin failed_task = tasks.find { |task| task[:status] == :failed } failed_task&.fetch(:name) end end |
#filtered_arguments ⇒ Object
: () -> Hash[untyped, untyped]
38 39 40 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 38 def filtered_arguments ParameterFilter.filter(arguments.to_h) end |
#job_class_name ⇒ Object
: () -> String
18 19 20 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 18 def job_class_name status.job_class_name end |
#mission_control_job_path ⇒ Object
: () -> String?
56 57 58 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 56 def mission_control_job_path JobWorkflow::Monitoring.mission_control_job_path(job_id, status: workflow_status) end |
#running? ⇒ Boolean
: () -> bool
66 67 68 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 66 def running? workflow_status == :running end |
#tasks ⇒ Object
: () -> Array[Hash[Symbol, untyped]]
43 44 45 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 43 def tasks @tasks ||= status.context.workflow.tasks.map { |task| task_view_model(task) } end |
#to_h ⇒ Object
: () -> Hash[Symbol, untyped]
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 71 def to_h { job_id:, queue_name:, job_class_name:, status: workflow_status, current_task_name:, failed_task_name:, arguments: filtered_arguments, tasks:, mission_control_job_path: } end |
#workflow_status ⇒ Object
: () -> Symbol
23 24 25 |
# File 'lib/job_workflow/monitoring/execution_view_model.rb', line 23 def workflow_status status.status end |