Skip to content

Commit

Permalink
requeue special
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Feb 20, 2025
1 parent 3400399 commit 7ab1d35
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src-colladmin/actions/zookeeper_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,43 @@ def perform_action
end
end

class ZkRequeueSpecialAction < ZkAction
def perform_action
if @qpath =~ /access/
acc = MerrittZK::Access.new(get_access_queue, get_id)
acc.load(@zk)
acc.set_status(@zk, MerrittZK::AccessState::Pending)
{ message: "Acc #{acc.id} requeued " }.to_json
else
job = MerrittZK::Job.new(get_id)
job.load(@zk)
js = job.json_property(@zk, MerrittZK::ZkKeys::STATUS)
laststat = js.fetch(:last_successful_status, '')

job.lock(@zk)

case laststat
when 'Pending', '', nil
job.set_status(@zk, MerrittZK::JobState::Estimating, job_retry: true)
when 'Estimating'
job.set_status(@zk, MerrittZK::JobState::Provisioning, job_retry: true)
when 'Provisioning'
job.set_status(@zk, MerrittZK::JobState::Processing, job_retry: true)
when 'Downloading'
job.set_status(@zk, MerrittZK::JobState::Processing, job_retry: true)
when 'Processing'
job.set_status(@zk, MerrittZK::JobState::Recording, job_retry: true)
when 'Recording'
job.set_status(@zk, MerrittZK::JobState::Notify, job_retry: true)
end

job.unlock(@zk)

{ message: "Job #{job.id} requeued to status #{job.status_name}" }.to_json
end
end
end

## Queue manipulation action using new mrt-zk
class ZkDeleteAction < ZkAction
def perform_action
Expand Down
12 changes: 12 additions & 0 deletions src-colladmin/config/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,18 @@ requeue-mrtzk:
- requeue
documentation: |
ZK tbd
requeue-special-mrtzk:
link-title: Re-queue an item from a Zookeeper queue
class: ZkRequeueSpecialAction
category: Queue Management
sensitivity: irreversible change
testing: manual
description: |
Re-queue an item from a Zookeeper queue.
report-datatypes:
- requeue
documentation: |
ZK tbd
hold-queue-item-mrtzk:
link-title: Move a pending item from in Zookeeper queue to a Held status
class: ZkHoldAction
Expand Down
2 changes: 2 additions & 0 deletions src-common/template/api-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,8 @@ function format(cell, v, type, merritt_path) {
} else if (type == 'requeue-mrtzk' && v != '') {
p = colladmin_root + "/lambda?path=requeue-mrtzk&queue-path="+v;
makeLink(cell, 'Requeue', "javascript:ajax_invoke('"+encodeURIComponent(p)+"');testRequeue()").addClass("ajax");
p = colladmin_root + "/lambda?path=requeue-special-mrtzk&queue-path="+v;
makeLink(cell, 'Requeue Special', "javascript:ajax_invoke('"+encodeURIComponent(p)+"');testRequeue()").addClass("ajax");
} else if (type == 'hold' && v != '') {
p = colladmin_root + "/lambda?path=hold-queue-item&queue-path="+v;
makeLink(cell, 'Hold', "javascript:ajax_invoke('"+encodeURIComponent(p)+"')").addClass("ajax");
Expand Down

0 comments on commit 7ab1d35

Please sign in to comment.