Class: Tasker::Orchestration::Coordinator
- Inherits:
-
Object
- Object
- Tasker::Orchestration::Coordinator
- Includes:
- Concerns::IdempotentStateTransitions
- Defined in:
- lib/tasker/orchestration/coordinator.rb
Overview
Coordinator handles orchestration system initialization and monitoring
This class ensures the orchestration system is properly initialized and provides observability into the system state. It does NOT handle task processing - that responsibility belongs to TaskHandler using the proven delegation pattern.
Class Method Summary collapse
-
.get_sequence_for_task(task, task_handler) ⇒ Tasker::Types::StepSequence
Get sequence for a task (utility method for orchestration components).
-
.initialize! ⇒ Object
Initialize the orchestration system.
-
.initialized? ⇒ Boolean
Check if the orchestration system has been initialized.
-
.reset! ⇒ Object
Reset initialization state (primarily for testing).
-
.statistics ⇒ Hash
Get statistics about the workflow orchestration system.
Methods included from Concerns::IdempotentStateTransitions
#conditional_transition_to, #in_any_state?, #safe_current_state, #safe_transition_to
Class Method Details
.get_sequence_for_task(task, task_handler) ⇒ Tasker::Types::StepSequence
Get sequence for a task (utility method for orchestration components)
82 83 84 |
# File 'lib/tasker/orchestration/coordinator.rb', line 82 def get_sequence_for_task(task, task_handler) Tasker::Orchestration::StepSequenceFactory.get_sequence(task, task_handler) end |
.initialize! ⇒ Object
Initialize the orchestration system
Sets up all orchestration components, registers events, and connects subscribers. This method is idempotent and can be called multiple times safely.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/tasker/orchestration/coordinator.rb', line 33 def initialize! return if @initialized Rails.logger.info('Tasker::Orchestration::Coordinator: Initializing orchestration system') # Initialize core orchestration components setup_publisher setup_event_subscriptions # Initialize telemetry and monitoring setup_telemetry_subscriber @initialized = true Rails.logger.info('Tasker::Orchestration::Coordinator: Orchestration system initialized successfully') rescue StandardError => e Rails.logger.error("Tasker::Orchestration::Coordinator: Failed to initialize: #{e.}") @initialized = false raise end |
.initialized? ⇒ Boolean
Check if the orchestration system has been initialized
25 26 27 |
# File 'lib/tasker/orchestration/coordinator.rb', line 25 def initialized? @initialized == true end |
.reset! ⇒ Object
Reset initialization state (primarily for testing)
54 55 56 57 58 |
# File 'lib/tasker/orchestration/coordinator.rb', line 54 def reset! @initialized = false @publisher = nil Rails.logger.debug('Tasker::Orchestration::Coordinator: Initialization state reset') end |
.statistics ⇒ Hash
Get statistics about the workflow orchestration system
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/tasker/orchestration/coordinator.rb', line 63 def statistics { initialized: @initialized || false, components: { publisher: defined?(Tasker::Events::Publisher), viable_step_discovery: defined?(Tasker::Orchestration::ViableStepDiscovery), step_executor: defined?(Tasker::Orchestration::StepExecutor), task_finalizer: defined?(Tasker::Orchestration::TaskFinalizer), task_reenqueuer: defined?(Tasker::Orchestration::TaskReenqueuer) }, publisher_instance: @publisher&.class&.name } end |