Class: NodesController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- NodesController
- Defined in:
- app/controllers/nodes_controller.rb
Instance Method Summary collapse
- #accept_new_tasks ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #kill_containers ⇒ Object
- #reject_new_tasks ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#accept_new_tasks ⇒ Object
49 50 51 52 53 |
# File 'app/controllers/nodes_controller.rb', line 49 def accept_new_tasks NodeTaskAcceptance.new(node: @node).accept! head :ok end |
#create ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/nodes_controller.rb', line 14 def create @node = Node.create!(node_params) FriendlyNameNodes.new.perform AdjustNodeSlotsJob.perform_later(node: @node) render json: @node, status: :created end |
#destroy ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/nodes_controller.rb', line 34 def destroy DeleteNode.new(node: @node).perform FriendlyNameNodes.new.perform head :ok rescue DeleteNode::NodeWithRunningSlotsError head :not_acceptable end |
#index ⇒ Object
10 11 12 |
# File 'app/controllers/nodes_controller.rb', line 10 def index render json: Node.all end |
#kill_containers ⇒ Object
55 56 57 58 59 |
# File 'app/controllers/nodes_controller.rb', line 55 def kill_containers KillNodeRunners.new(node: @node).perform head :ok end |
#reject_new_tasks ⇒ Object
43 44 45 46 47 |
# File 'app/controllers/nodes_controller.rb', line 43 def reject_new_tasks NodeTaskAcceptance.new(node: @node).reject! head :ok end |
#show ⇒ Object
23 24 25 |
# File 'app/controllers/nodes_controller.rb', line 23 def show render json: @node end |
#update ⇒ Object
27 28 29 30 31 32 |
# File 'app/controllers/nodes_controller.rb', line 27 def update @node.update!(node_params.slice(:slots_execution_types)) AdjustNodeSlotsJob.perform_later(node: @node) render json: @node end |