Skip to content

Commit

Permalink
add requeue_started button to requeue DPs without a Status Message th…
Browse files Browse the repository at this point in the history
…at is 'completed normal'
  • Loading branch information
brianlball committed Aug 10, 2024
1 parent b00258f commit 3f0af6f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
19 changes: 17 additions & 2 deletions server/app/controllers/data_points_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ def result_files
end

def requeue
Rails.logger.warn "data_points_contoller.REQUEUEing #{@data_point.id}"
@data_point = DataPoint.find(params[:id])
analysis_id = @data_point.analysis
Rails.logger.warn "data_points_contoller.REQUEUEing #{@data_point.id}"
Rails.logger.debug "data_points_contoller.id: #{@data_point.id}"
Rails.logger.debug "data_points_contoller.job_id: #{@data_point.job_id}"
# Destroy the existing job in Resque queue; this is tied to a worker_host:PID:uuid
Expand Down Expand Up @@ -335,6 +335,22 @@ def requeue
end
end

def requeue_started
@analysis = Analysis.find(params[:id])
Rails.logger.warn "Requeueing all NOT completed normal simulations for analysis #{@analysis.id}"
data_points_to_requeue = @analysis.data_points.where.not(status_message: 'completed normal')

data_points_to_requeue.each do |dp|
Rails.logger.warn "Requeueing DataPoint #{dp.id}"
Resque.enqueue(ResqueJobs::RunSimulateDataPoint, dp.job_id)
end

respond_to do |format|
format.html { redirect_to analysis_path(@analysis), notice: 'Simulations were successfully requeued.' }
format.json { head :no_content }
end
end

def find_resque_worker_by_job_id(job_id)
Rails.logger.debug "data_points_contoller.find_resque_worker_by_job_id"
Resque.workers.each do |worker|
Expand All @@ -352,7 +368,6 @@ def find_resque_worker_by_job_id(job_id)
end
nil # Return nil if no worker is found processing the job_id
end


# upload results file
# POST /data_points/1/upload_file.json
Expand Down
5 changes: 5 additions & 0 deletions server/app/views/analyses/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
:view_all => 0), :class => "btn btn-mini") %>
</div>
<% end %>
<div class="button-container">
<%= link_to("Requeue Started", requeue_started_data_point_path(@analysis), method: :post,
class: "btn btn-mini btn-warning",
data: { confirm: 'Are you sure you want to requeue all simulations without a completed normal Status Message?' }) %>
</div>
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions server/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
post :upload_file
delete :result_files
post :requeue
post :requeue_started
end

collection do
Expand Down

0 comments on commit 3f0af6f

Please sign in to comment.