Sha256: 12abfd7e3cdede921b6b662c3e4614a55425813ce38a3a6c012a52a82c235e26

Contents?: true

Size: 950 Bytes

Versions: 12

Compression:

Stored size: 950 Bytes

Contents

class Kuroko2::ExecutionsController < Kuroko2::ApplicationController

  before_action :set_execution, only: %i(destroy)

  def index
    @executions = Kuroko2::Execution.where(finished_at: nil).order(created_at: :desc).includes(job_instance: :job_definition)
  end

  def destroy
    if @execution.try(:pid)
      hostname = Kuroko2::Worker.executing(@execution.id).try(:hostname)
      Kuroko2::ProcessSignal.create!(pid: @execution.pid, hostname: hostname) if hostname
    end

    redirect_to job_definition_job_instance_path(job_definition_id: execution_params[:job_definition_id], id: execution_params[:job_instance_id])
  end

  private

  def set_execution
    @execution = Kuroko2::Execution.where(job_definition_id: execution_params[:job_definition_id], job_instance_id: execution_params[:job_instance_id], id: execution_params[:id]).take
  end

  def execution_params
    params.permit(:id, :job_definition_id, :job_instance_id)
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kuroko2-0.4.2 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.4.1 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.4.0 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.3.4 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.3.3 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.3.2 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.3.1 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.3.0 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.2.3 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.2.2 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.2.1 app/controllers/kuroko2/executions_controller.rb
kuroko2-0.2.0 app/controllers/kuroko2/executions_controller.rb