Skip to content

Commit 72d3661

Browse files
committed
Revert "Sharded Operator Support"
This reverts commit e25d5e8.
1 parent 2cda837 commit 72d3661

8 files changed

+8
-67
lines changed

openc3/lib/openc3/models/interface_model.rb

-8
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class InterfaceModel < Model
5050
attr_accessor :work_dir
5151
attr_accessor :ports
5252
attr_accessor :prefix
53-
attr_accessor :shard
5453

5554
# NOTE: The following three class methods are used by the ModelController
5655
# and are reimplemented to enable various Model class methods to work
@@ -122,7 +121,6 @@ def initialize(
122121
env: {},
123122
container: nil,
124123
prefix: nil,
125-
shard: 0,
126124
scope:
127125
)
128126
if self.class._get_type == 'INTERFACE'
@@ -160,7 +158,6 @@ def initialize(
160158
@env = env
161159
@container = container
162160
@prefix = prefix
163-
@shard = shard.to_i # to_i to handle nil
164161
@secrets = secrets
165162
end
166163

@@ -225,7 +222,6 @@ def as_json(*a)
225222
'env' => @env,
226223
'container' => @container,
227224
'prefix' => @prefix,
228-
'shard' => @shard,
229225
'updated_at' => @updated_at
230226
}
231227
end
@@ -345,9 +341,6 @@ def handle_config(parser, keyword, parameters)
345341
parser.verify_num_parameters(1, 1, "#{keyword} <Route Prefix>")
346342
@prefix = parameters[0]
347343

348-
when 'SHARD'
349-
parser.verify_num_parameters(1, 1, "#{keyword} <Shard Number Starting from 0>")
350-
@shard = Integer(parameters[0])
351344
else
352345
raise ConfigParser::Error.new(parser, "Unknown keyword and parameters for Interface/Router: #{keyword} #{parameters.join(" ")}")
353346

@@ -372,7 +365,6 @@ def deploy(gem_path, variables, validate_only: false)
372365
needs_dependencies: @needs_dependencies,
373366
secrets: @secrets,
374367
prefix: @prefix,
375-
shard: @shard,
376368
scope: @scope
377369
)
378370
unless validate_only

openc3/lib/openc3/models/microservice_model.rb

+1-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class MicroserviceModel < Model
4444
attr_accessor :prefix
4545
attr_accessor :disable_erb
4646
attr_accessor :ignore_changes
47-
attr_accessor :shard
4847

4948
# NOTE: The following three class methods are used by the ModelController
5049
# and are reimplemented to enable various Model class methods to work
@@ -106,7 +105,6 @@ def initialize(
106105
prefix: nil,
107106
disable_erb: nil,
108107
ignore_changes: nil,
109-
shard: 0,
110108
scope:
111109
)
112110
parts = name.split("__")
@@ -133,7 +131,6 @@ def initialize(
133131
@prefix = prefix
134132
@disable_erb = disable_erb
135133
@ignore_changes = ignore_changes
136-
@shard = shard.to_i # to_i to handle nil
137134
@bucket = Bucket.getClient()
138135
end
139136

@@ -156,8 +153,7 @@ def as_json(*a)
156153
'secrets' => @secrets.as_json(*a),
157154
'prefix' => @prefix,
158155
'disable_erb' => @disable_erb,
159-
'ignore_changes' => @ignore_changes,
160-
'shard' => @shard,
156+
'ignore_changes' => @ignore_changes
161157
}
162158
end
163159

@@ -219,9 +215,6 @@ def handle_config(parser, keyword, parameters)
219215
if parameters
220216
@disable_erb.concat(parameters)
221217
end
222-
when 'SHARD'
223-
parser.verify_num_parameters(1, 1, "#{keyword} <Shard Number Starting from 0>")
224-
@shard = Integer(parameters[0])
225218
else
226219
raise ConfigParser::Error.new(parser, "Unknown keyword and parameters for Microservice: #{keyword} #{parameters.join(" ")}")
227220
end

openc3/lib/openc3/models/reaction_model.rb

+1-5
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def self.delete(name:, scope:)
8282
end
8383

8484
attr_reader :name, :scope, :snooze, :triggers, :actions, :enabled, :triggerLevel, :snoozed_until
85-
attr_accessor :username, :shard
85+
attr_accessor :username
8686

8787
def initialize(
8888
name:,
@@ -94,7 +94,6 @@ def initialize(
9494
enabled: true,
9595
snoozed_until: nil,
9696
username: nil,
97-
shard: 0,
9897
updated_at: nil
9998
)
10099
super("#{scope}#{PRIMARY_KEY}", name: name, scope: scope)
@@ -106,7 +105,6 @@ def initialize(
106105
@actions = validate_actions(actions)
107106
@triggers = validate_triggers(triggers)
108107
@username = username
109-
@shard = shard.to_i # to_i to handle nil
110108
@updated_at = updated_at
111109
end
112110

@@ -265,7 +263,6 @@ def as_json(*a)
265263
'triggers' => @triggers,
266264
'actions' => @actions,
267265
'username' => @username,
268-
'shard' => @shard,
269266
'updated_at' => @updated_at
270267
}
271268
end
@@ -298,7 +295,6 @@ def create_microservice(topics:)
298295
topics: topics,
299296
target_names: [],
300297
plugin: nil,
301-
shard: @shard,
302298
scope: @scope
303299
)
304300
microservice.create

openc3/lib/openc3/models/scope_model.rb

+2-13
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class ScopeModel < Model
5656
attr_accessor :cleanup_poll_time
5757
attr_accessor :command_authority
5858
attr_accessor :critical_commanding
59-
attr_accessor :shard
6059

6160
# NOTE: The following three class methods are used by the ModelController
6261
# and are reimplemented to enable various Model class methods to work
@@ -98,7 +97,6 @@ def initialize(name:,
9897
cleanup_poll_time: 900,
9998
command_authority: false,
10099
critical_commanding: "OFF",
101-
shard: 0,
102100
updated_at: nil
103101
)
104102
super(
@@ -120,7 +118,6 @@ def initialize(name:,
120118
if not ["OFF", "NORMAL", "ALL"].include?(@critical_commanding)
121119
raise "Invalid value for critical_commanding: #{@critical_commanding}"
122120
end
123-
@shard = shard.to_i # to_i to handle nil
124121
@children = []
125122
end
126123

@@ -177,7 +174,6 @@ def as_json(*_a)
177174
'cleanup_poll_time' => @cleanup_poll_time,
178175
'command_authority' => @command_authority,
179176
'critical_commanding' => @critical_commanding,
180-
'shard' => @shard,
181177
}
182178
end
183179

@@ -198,7 +194,6 @@ def deploy_openc3_log_messages_microservice(gem_path, variables, parent)
198194
],
199195
topics: topics,
200196
parent: parent,
201-
shard: @shard,
202197
scope: @scope
203198
)
204199
microservice.create
@@ -221,7 +216,6 @@ def deploy_unknown_commandlog_microservice(gem_path, variables, parent)
221216
topics: ["#{@scope}__COMMAND__{UNKNOWN}__UNKNOWN"],
222217
target_names: [],
223218
parent: parent,
224-
shard: @shard,
225219
scope: @scope
226220
)
227221
microservice.create
@@ -244,7 +238,6 @@ def deploy_unknown_packetlog_microservice(gem_path, variables, parent)
244238
topics: ["#{@scope}__TELEMETRY__{UNKNOWN}__UNKNOWN"],
245239
target_names: [],
246240
parent: parent,
247-
shard: @shard,
248241
scope: @scope
249242
)
250243
microservice.create
@@ -260,7 +253,6 @@ def deploy_periodic_microservice(gem_path, variables, parent)
260253
cmd: ["ruby", "periodic_microservice.rb", microservice_name],
261254
work_dir: '/openc3/lib/openc3/microservices',
262255
parent: parent,
263-
shard: @shard,
264256
scope: @scope
265257
)
266258
microservice.create
@@ -276,7 +268,6 @@ def deploy_scopecleanup_microservice(gem_path, variables, parent)
276268
cmd: ["ruby", "scope_cleanup_microservice.rb", microservice_name],
277269
work_dir: '/openc3/lib/openc3/microservices',
278270
parent: parent,
279-
shard: @shard,
280271
scope: @scope
281272
)
282273
microservice.create
@@ -292,7 +283,6 @@ def deploy_critical_cmd_microservice(gem_path, variables, parent)
292283
cmd: ["ruby", "critical_cmd_microservice.rb", microservice_name],
293284
work_dir: '/openc3-enterprise/lib/openc3-enterprise/microservices',
294285
parent: parent,
295-
shard: @shard,
296286
scope: @scope
297287
)
298288
microservice.create
@@ -308,7 +298,6 @@ def deploy_scopemulti_microservice(gem_path, variables)
308298
cmd: ["ruby", "multi_microservice.rb", *@children],
309299
work_dir: '/openc3/lib/openc3/microservices',
310300
target_names: [],
311-
shard: @shard,
312301
scope: @scope
313302
)
314303
microservice.create
@@ -323,14 +312,14 @@ def deploy(gem_path, variables)
323312
# Create DEFAULT trigger group model
324313
model = TriggerGroupModel.get(name: 'DEFAULT', scope: @scope)
325314
unless model
326-
model = TriggerGroupModel.new(name: 'DEFAULT', shard: @shard, scope: @scope)
315+
model = TriggerGroupModel.new(name: 'DEFAULT', scope: @scope)
327316
model.create()
328317
model.deploy()
329318
end
330319
end
331320

332321
# Create UNKNOWN target for display of unknown data
333-
model = TargetModel.new(name: "UNKNOWN", shard: @shard, scope: @scope)
322+
model = TargetModel.new(name: "UNKNOWN", scope: @scope)
334323
model.create
335324

336325
@parent = "#{@scope}__SCOPEMULTI__#{@scope}"

openc3/lib/openc3/models/target_model.rb

+1-17
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class TargetModel < Model
8080
attr_accessor :target_microservices
8181
attr_accessor :children
8282
attr_accessor :disable_erb
83-
attr_accessor :shard
8483

8584
# NOTE: The following three class methods are used by the ModelController
8685
# and are reimplemented to enable various Model class methods to work
@@ -346,7 +345,6 @@ def initialize(
346345
reducer_disable: false,
347346
reducer_max_cpu_utilization: 30.0,
348347
disable_erb: nil,
349-
shard: 0,
350348
scope:
351349
)
352350
super("#{scope}__#{PRIMARY_KEY}", name: name, plugin: plugin, updated_at: updated_at,
@@ -395,7 +393,6 @@ def initialize(
395393
@reducer_disable = reducer_disable
396394
@reducer_max_cpu_utilization = reducer_max_cpu_utilization
397395
@disable_erb = disable_erb
398-
@shard = shard.to_i # to_i to handle nil
399396
@bucket = Bucket.getClient()
400397
@children = []
401398
end
@@ -436,8 +433,7 @@ def as_json(*_a)
436433
'target_microservices' => @target_microservices.as_json(:allow_nan => true),
437434
'reducer_disable' => @reducer_disable,
438435
'reducer_max_cpu_utilization' => @reducer_max_cpu_utilization,
439-
'disable_erb' => @disable_erb,
440-
'shard' => @shard,
436+
'disable_erb' => @disable_erb
441437
}
442438
end
443439

@@ -552,10 +548,6 @@ def handle_config(parser, keyword, parameters)
552548
if parameters
553549
@disable_erb.concat(parameters)
554550
end
555-
when 'SHARD'
556-
parser.verify_num_parameters(1, 1, "#{keyword} <Shard Number Starting from 0>")
557-
@shard = Integer(parameters[0])
558-
559551
else
560552
raise ConfigParser::Error.new(parser, "Unknown keyword and parameters for Target: #{keyword} #{parameters.join(" ")}")
561553
end
@@ -930,7 +922,6 @@ def deploy_commmandlog_microservice(gem_path, variables, topics, instance = nil,
930922
plugin: @plugin,
931923
parent: parent,
932924
needs_dependencies: @needs_dependencies,
933-
shard: @shard,
934925
scope: @scope
935926
)
936927
microservice.create
@@ -957,7 +948,6 @@ def deploy_decomcmdlog_microservice(gem_path, variables, topics, instance = nil,
957948
plugin: @plugin,
958949
parent: parent,
959950
needs_dependencies: @needs_dependencies,
960-
shard: @shard,
961951
scope: @scope
962952
)
963953
microservice.create
@@ -984,7 +974,6 @@ def deploy_packetlog_microservice(gem_path, variables, topics, instance = nil, p
984974
plugin: @plugin,
985975
parent: parent,
986976
needs_dependencies: @needs_dependencies,
987-
shard: @shard,
988977
scope: @scope
989978
)
990979
microservice.create
@@ -1011,7 +1000,6 @@ def deploy_decomlog_microservice(gem_path, variables, topics, instance = nil, pa
10111000
plugin: @plugin,
10121001
parent: parent,
10131002
needs_dependencies: @needs_dependencies,
1014-
shard: @shard,
10151003
scope: @scope
10161004
)
10171005
microservice.create
@@ -1040,7 +1028,6 @@ def deploy_decom_microservice(target, gem_path, variables, topics, instance = ni
10401028
plugin: @plugin,
10411029
parent: parent,
10421030
needs_dependencies: @needs_dependencies,
1043-
shard: @shard,
10441031
scope: @scope
10451032
)
10461033
microservice.create
@@ -1064,7 +1051,6 @@ def deploy_reducer_microservice(gem_path, variables, topics, instance = nil, par
10641051
plugin: @plugin,
10651052
parent: parent,
10661053
needs_dependencies: @needs_dependencies,
1067-
shard: @shard,
10681054
scope: @scope
10691055
)
10701056
microservice.create
@@ -1081,7 +1067,6 @@ def deploy_cleanup_microservice(gem_path, variables, instance = nil, parent = ni
10811067
work_dir: '/openc3/lib/openc3/microservices',
10821068
plugin: @plugin,
10831069
parent: parent,
1084-
shard: @shard,
10851070
scope: @scope
10861071
)
10871072
microservice.create
@@ -1099,7 +1084,6 @@ def deploy_multi_microservice(gem_path, variables, instance = nil)
10991084
work_dir: '/openc3/lib/openc3/microservices',
11001085
plugin: @plugin,
11011086
needs_dependencies: @needs_dependencies,
1102-
shard: @shard,
11031087
scope: @scope
11041088
)
11051089
microservice.create

openc3/lib/openc3/models/timeline_model.rb

+1-4
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,14 @@ def self.from_json(json, name:, scope:)
7474
self.new(**json.transform_keys(&:to_sym), name: name, scope: scope)
7575
end
7676

77-
def initialize(name:, scope:, updated_at: nil, color: nil, shard: 0)
77+
def initialize(name:, scope:, updated_at: nil, color: nil)
7878
if name.nil? || scope.nil?
7979
raise TimelineInputError.new "name or scope must not be nil"
8080
end
8181

8282
super(PRIMARY_KEY, name: "#{scope}#{KEY}#{name}", scope: scope)
8383
@updated_at = updated_at
8484
@timeline_name = name
85-
@shard = shard.to_i # to_i to handle nil
8685
update_color(color: color)
8786
end
8887

@@ -105,7 +104,6 @@ def as_json(*a)
105104
{
106105
'name' => @timeline_name,
107106
'color' => @color,
108-
'shard' => @shard,
109107
'scope' => @scope,
110108
'updated_at' => @updated_at
111109
}
@@ -138,7 +136,6 @@ def deploy
138136
topics: topics,
139137
target_names: [],
140138
plugin: nil,
141-
shard: @shard,
142139
scope: @scope
143140
)
144141
microservice.create

0 commit comments

Comments
 (0)