Skip to content

Commit 5cc883b

Browse files
committed
zk action migration versions
1 parent c3e6d9f commit 5cc883b

File tree

14 files changed

+359
-53
lines changed

14 files changed

+359
-53
lines changed

cognito-lambda-nonvpc/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ GEM
33
specs:
44
ast (2.4.2)
55
aws-eventstream (1.3.0)
6-
aws-partitions (1.923.0)
6+
aws-partitions (1.924.0)
77
aws-sdk-cognitoidentityprovider (1.90.0)
88
aws-sdk-core (~> 3, >= 3.193.0)
99
aws-sigv4 (~> 1.1)
10-
aws-sdk-core (3.194.0)
10+
aws-sdk-core (3.194.1)
1111
aws-eventstream (~> 1, >= 1.3.0)
1212
aws-partitions (~> 1, >= 1.651.0)
1313
aws-sigv4 (~> 1.8)

mysql-ruby-lambda/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ GEM
1313
specs:
1414
ast (2.4.2)
1515
aws-eventstream (1.3.0)
16-
aws-partitions (1.923.0)
17-
aws-sdk-core (3.194.0)
16+
aws-partitions (1.924.0)
17+
aws-sdk-core (3.194.1)
1818
aws-eventstream (~> 1, >= 1.3.0)
1919
aws-partitions (~> 1, >= 1.651.0)
2020
aws-sigv4 (~> 1.8)

src-admintool/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ GEM
1313
specs:
1414
ast (2.4.2)
1515
aws-eventstream (1.3.0)
16-
aws-partitions (1.923.0)
17-
aws-sdk-core (3.194.0)
16+
aws-partitions (1.924.0)
17+
aws-sdk-core (3.194.1)
1818
aws-eventstream (~> 1, >= 1.3.0)
1919
aws-partitions (~> 1, >= 1.651.0)
2020
aws-sigv4 (~> 1.8)

src-colladmin/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ gem 'aws-sdk-lambda'
1212
gem 'aws-sdk-s3'
1313
gem 'aws-sdk-ssm'
1414
gem 'csv'
15-
gem 'mrt-zk', git: 'https://github.com/CDLUC3/mrt-zk.git', tag: '1.0.2.a'
15+
gem 'mrt-zk', git: 'https://github.com/CDLUC3/mrt-zk.git', tag: '1.0.3.c'
1616
gem 'rest-client'
1717
gem 'rubocop'
1818
gem 'uc3-ssm', '0.3.10', git: 'https://github.com/CDLUC3/uc3-ssm.git', branch: 'main'

src-colladmin/Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GIT
22
remote: https://github.com/CDLUC3/mrt-zk.git
3-
revision: 0666a075c9026c8f81868a1d81c8c4572296c9c1
4-
tag: 1.0.2.a
3+
revision: 0e70ab21c3588d8519366039905e5255b8e4ec58
4+
tag: 1.0.3.c
55
specs:
66
mrt-zk (1.0.1)
77
zk (~> 1.10.0)
@@ -22,13 +22,13 @@ GEM
2222
specs:
2323
ast (2.4.2)
2424
aws-eventstream (1.3.0)
25-
aws-partitions (1.923.0)
26-
aws-sdk-core (3.194.0)
25+
aws-partitions (1.924.0)
26+
aws-sdk-core (3.194.1)
2727
aws-eventstream (~> 1, >= 1.3.0)
2828
aws-partitions (~> 1, >= 1.651.0)
2929
aws-sigv4 (~> 1.8)
3030
jmespath (~> 1, >= 1.6.1)
31-
aws-sdk-ec2 (1.454.0)
31+
aws-sdk-ec2 (1.455.0)
3232
aws-sdk-core (~> 3, >= 3.193.0)
3333
aws-sigv4 (~> 1.1)
3434
aws-sdk-kms (1.80.0)

src-colladmin/actions/replication_action.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ def perform_action
224224
[coll, nodenum]
225225
).each do |r|
226226
endpoint = "delete/#{nodenum}/#{CGI.escape(r[0])}"
227-
puts endpoint
228227
begin
229228
qjson = HttpDeleteJson.new(get_replic_server, endpoint)
230229
puts qjson.status

src-colladmin/actions/zookeeper_action.rb

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def to_table
3232
end
3333

3434
## Base class for actions that interact directly with Zookeeper using the mrt-zk library
35-
class ZookeeperAction < AdminAction
35+
class ZookeeperListAction < AdminAction
3636
def initialize(config, action, path, myparams, _filters)
3737
super(config, action, path, myparams)
3838
@filters = {}
@@ -69,6 +69,7 @@ def register_item(item)
6969
end
7070

7171
def perform_action
72+
$migration = migration_level if migration_m1?
7273
jobs = migration_m1? ? MerrittZK::Job.list_jobs(@zk) : MerrittZK::LegacyIngestJob.list_jobs(@zk)
7374
jobs.each do |po|
7475
register_item(QueueEntry.new(po))
@@ -81,13 +82,87 @@ def table_rows(_body)
8182
end
8283

8384
def get_zookeeper_conn
84-
# @config.fetch('zookeeper', '').split(',').first
8585
@config.fetch('zookeeper', '')
8686
end
8787
end
8888

89+
class ZookeeperAction < AdminAction
90+
def initialize(config, action, path, myparams)
91+
super(config, action, path, myparams)
92+
@zk = ZK.new(get_zookeeper_conn)
93+
@qid = myparams.fetch('queue-path', '')
94+
end
95+
96+
def get_zookeeper_conn
97+
@config.fetch('zookeeper', '')
98+
end
99+
100+
def perform_action
101+
{ message: "No response for #{@path}: #{@qid}" }.to_json
102+
rescue StandardError => e
103+
log(e.message)
104+
log(e.backtrace)
105+
{ error: "#{e.message} for #{@path}: #{@qid}" }.to_json
106+
end
107+
end
108+
109+
class ZkRequeueM1Action < ZookeeperAction
110+
end
111+
112+
class ZkDeleteM1Action < ZookeeperAction
113+
end
114+
115+
class ZkHoldM1Action < ZookeeperAction
116+
end
117+
118+
class ZkReleaseM1Action < ZookeeperAction
119+
end
120+
121+
class LegacyZkAction < ZookeeperAction
122+
def status_vals
123+
%w[Pending Consumed Deleted Failed Completed Held]
124+
end
125+
126+
def set_status(status)
127+
path = "/ingest/#{@qid}"
128+
i = status_vals.find_index(status)
129+
retun if i.nil?
130+
data = @zk.get(path)
131+
return if data.nil?
132+
bytes = data[0].bytes
133+
orig = bytes[0]
134+
bytes[0] = i
135+
@zk.set(path, bytes.pack("CCCCCCCCCc*"))
136+
{message: "Status #{orig} -- > #{status}"}.to_json
137+
end
138+
end
139+
140+
class ZkRequeueM2Action < LegacyZkAction
141+
def perform_action
142+
set_status('Pending')
143+
end
144+
end
145+
146+
class ZkDeleteM2Action < LegacyZkAction
147+
def perform_action
148+
set_status('Deleted')
149+
end
150+
end
151+
152+
class ZkHoldM2Action < LegacyZkAction
153+
def perform_action
154+
set_status('Held')
155+
end
156+
end
157+
158+
class ZkReleaseM2Action < LegacyZkAction
159+
def perform_action
160+
set_status('Pending')
161+
end
162+
end
163+
89164
## Class for reading the legacy Merritt Ingest Queue
90-
class IngestQueueZookeeperAction < ZookeeperAction
165+
class IngestQueueZookeeperAction < ZookeeperListAction
91166
def zk_path
92167
'/ingest'
93168
end

src-colladmin/config/actions.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,32 @@ queue-delete:
918918
documentation: |
919919
Ingest: POST /admin/deleteq
920920
migration: m1, m2, m3
921+
queue-delete-m1:
922+
link-title: Remove an item from a Zookeeper queue
923+
class: ZkDeleteM1Action
924+
category: Queue Management
925+
sensitivity: irreversible change
926+
testing: manual
927+
description: |
928+
Remove an item from a Zookeeper queue.
929+
report-datatypes:
930+
- qdelete
931+
documentation: |
932+
Zk: tbd
933+
migration: m1
934+
queue-delete-m2:
935+
link-title: Remove an item from a Zookeeper queue
936+
class: ZkDeleteM2Action
937+
category: Queue Management
938+
sensitivity: irreversible change
939+
testing: manual
940+
description: |
941+
Remove an item from a Zookeeper queue.
942+
report-datatypes:
943+
- qdelete
944+
documentation: |
945+
Zk: tbd
946+
migration: m1
921947
requeue:
922948
link-title: Re-queue an item from a Zookeeper queue
923949
class: QueueAction
@@ -932,6 +958,32 @@ requeue:
932958
documentation: |
933959
Ingest: POST /admin/requeue
934960
migration: m1, m2, m3
961+
requeue-m1:
962+
link-title: Re-queue an item from a Zookeeper queue
963+
class: ZkRequeueM1Action
964+
category: Queue Management
965+
sensitivity: irreversible change
966+
testing: manual
967+
description: |
968+
Re-queue an item from a Zookeeper queue.
969+
report-datatypes:
970+
- requeue
971+
documentation: |
972+
ZK tbd
973+
migration: m1
974+
requeue-m2:
975+
link-title: Re-queue an item from a Zookeeper queue
976+
class: ZkRequeueM2Action
977+
category: Queue Management
978+
sensitivity: irreversible change
979+
testing: manual
980+
description: |
981+
Re-queue an item from a Zookeeper queue.
982+
report-datatypes:
983+
- requeue
984+
documentation: |
985+
ZK tbd
986+
migration: m1
935987
hold-queue-item:
936988
link-title: Move a pending item from in Zookeeper queue to a Held status
937989
class: QueueAction
@@ -946,6 +998,32 @@ hold-queue-item:
946998
documentation: |
947999
Ingest: POST /admin/hold
9481000
migration: m1, m2
1001+
hold-queue-item-m1:
1002+
link-title: Move a pending item from in Zookeeper queue to a Held status
1003+
class: ZkHoldM1Action
1004+
category: Queue Management
1005+
sensitivity: irreversible change
1006+
testing: manual
1007+
description: |
1008+
Move a pending item from in Zookeeper queue to a Held status.
1009+
report-datatypes:
1010+
- hold
1011+
documentation: |
1012+
Zk: tbd
1013+
migration: m1
1014+
hold-queue-item-m2:
1015+
link-title: Move a pending item from in Zookeeper queue to a Held status
1016+
class: ZkHoldM2Action
1017+
category: Queue Management
1018+
sensitivity: irreversible change
1019+
testing: manual
1020+
description: |
1021+
Move a pending item from in Zookeeper queue to a Held status.
1022+
report-datatypes:
1023+
- hold
1024+
documentation: |
1025+
Zk: tbd
1026+
migration: m1
9491027
release-queue-item:
9501028
link-title: Release a held item from in Zookeeper queue to a Pending status
9511029
class: QueueAction
@@ -960,6 +1038,32 @@ release-queue-item:
9601038
documentation: |
9611039
Ingest: POST /admin/release
9621040
migration: m1, m2
1041+
release-queue-item-m1:
1042+
link-title: Release a held item from in Zookeeper queue to a Pending status
1043+
class: ZkReleaseM1Action
1044+
category: Queue Management
1045+
sensitivity: irreversible change
1046+
testing: manual
1047+
description: |
1048+
Release a held item from in Zookeeper queue to a Pending status.
1049+
report-datatypes:
1050+
- release
1051+
documentation: |
1052+
Zk: tbd
1053+
migration: m1
1054+
release-queue-item-m2:
1055+
link-title: Release a held item from in Zookeeper queue to a Pending status
1056+
class: ZkReleaseM2Action
1057+
category: Queue Management
1058+
sensitivity: irreversible change
1059+
testing: manual
1060+
description: |
1061+
Release a held item from in Zookeeper queue to a Pending status.
1062+
report-datatypes:
1063+
- release
1064+
documentation: |
1065+
Zk: tbd
1066+
migration: m1
9631067
cleanup-queue:
9641068
link-title: Cleanup Deleted and Completed items from a Zookeeper Queue
9651069
class: IterateQueueAction

0 commit comments

Comments
 (0)