Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REDUCER_DISABLE option for targets #826

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/plugin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ VARIABLE reduced_log_retain_time 2592000
LOG_RETAIN_TIME <%= log_retain_time %>
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
TLM_LOG_CYCLE_TIME 300
# Allow the reducer microservice to take 50% of the cpu (default 30%)
REDUCER_MAX_CPU_UTILIZATION 50
<% end %>

<% if include_inst2 %>
Expand All @@ -51,13 +53,19 @@ VARIABLE reduced_log_retain_time 2592000
<% if include_example %>
TARGET EXAMPLE <%= example_target_name %>
LOG_RETAIN_TIME <%= log_retain_time %>
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
# Disable data reduction (min, hour, day) on this target data
# No 'ruby reducer_microservice.rb DEFAULT__REDUCER__EXAMPLE'
# will appear in the the process list
REDUCER_DISABLE
<% end %>

<% if include_templated %>
TARGET TEMPLATED <%= templated_target_name %>
LOG_RETAIN_TIME <%= log_retain_time %>
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
# Disable data reduction (min, hour, day) on this target data
# No 'ruby reducer_microservice.rb DEFAULT__REDUCER__TEMPLATED'
# will appear in the the process list
REDUCER_DISABLE
<% end %>

<% if include_system %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
REQUIRE example_interface.rb

# Ignored Parameters
# IGNORE_PARAMETER parameter_name
# Ignored Parameters and Items
IGNORE_PARAMETER PACKET_ID

IGNORE_ITEM RECEIVED_COUNT
IGNORE_ITEM RECEIVED_TIMESECONDS
IGNORE_ITEM RECEIVED_TIMEFORMATTED
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ REQUIRE example_limits_response.rb
REQUIRE sim_inst.rb

# Ignored Parameters
# IGNORE_PARAMETER parameter_name
IGNORE_PARAMETER CCSDSVER
IGNORE_PARAMETER CCSDSTYPE
IGNORE_PARAMETER CCSDSSHF
Expand All @@ -14,7 +13,6 @@ IGNORE_PARAMETER CCSDSLENGTH
IGNORE_PARAMETER PKTID

# Ignored Items
# IGNORE_ITEM item_name
IGNORE_ITEM CCSDSVER
IGNORE_ITEM CCSDSTYPE
IGNORE_ITEM CCSDSSHF
Expand Down
2 changes: 2 additions & 0 deletions openc3/data/config/target.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ TARGET:
required: true
description: Number of seconds between runs of the cleanup process (default = 900 = 15 minutes)
values: \d+
REDUCER_DISABLE:
summary: Disables the data reduction microservice for the target
REDUCER_MAX_CPU_UTILIZATION:
summary: Maximum amount of CPU utilization to apply to data reduction
parameters:
Expand Down
13 changes: 10 additions & 3 deletions openc3/lib/openc3/models/target_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ def initialize(
cleanup_poll_time: 900,
needs_dependencies: false,
target_microservices: {'REDUCER' => [[]]},
reducer_disable: false,
reducer_max_cpu_utilization: 30.0,
scope:
)
Expand All @@ -361,7 +362,7 @@ def initialize(
reduced_minute_log_retain_time: reduced_minute_log_retain_time,
reduced_hour_log_retain_time: reduced_hour_log_retain_time, reduced_day_log_retain_time: reduced_day_log_retain_time,
cleanup_poll_time: cleanup_poll_time, needs_dependencies: needs_dependencies, target_microservices: target_microservices,
reducer_max_cpu_utilization: reducer_max_cpu_utilization,
reducer_disable: reducer_disable, reducer_max_cpu_utilization: reducer_max_cpu_utilization,
scope: scope)
@folder_name = folder_name
@requires = requires
Expand Down Expand Up @@ -392,6 +393,7 @@ def initialize(
@cleanup_poll_time = cleanup_poll_time
@needs_dependencies = needs_dependencies
@target_microservices = target_microservices
@reducer_disable = reducer_disable
@reducer_max_cpu_utilization = reducer_max_cpu_utilization
@bucket = Bucket.getClient()
@children = []
Expand Down Expand Up @@ -431,6 +433,7 @@ def as_json(*a)
'cleanup_poll_time' => @cleanup_poll_time,
'needs_dependencies' => @needs_dependencies,
'target_microservices' => @target_microservices.as_json(:allow_nan => true),
'reducer_disable' => @reducer_disable,
'reducer_max_cpu_utilization' => @reducer_max_cpu_utilization
}
end
Expand Down Expand Up @@ -513,6 +516,8 @@ def handle_config(parser, keyword, parameters)
@reduced_hour_log_retain_time = reduced_log_retain_time.to_i
@reduced_day_log_retain_time = reduced_log_retain_time.to_i
end
when 'REDUCER_DISABLE', 'REDUCER_DISABLED' # Handle typos
@reducer_disable = true
when 'REDUCER_MAX_CPU_UTILIZATION', 'REDUCED_MAX_CPU_UTILIZATION' # Handle typos
parser.verify_num_parameters(1, 1, "#{keyword} <Max cpu utilization to allocate to the reducer microservice - 0.0 to 100.0>")
@reducer_max_cpu_utilization = Float(parameters[0])
Expand Down Expand Up @@ -1063,8 +1068,10 @@ def deploy_microservices(gem_path, variables, system)
end

# Reducer Microservice
deploy_target_microservices('REDUCER', decom_topic_list, "#{@scope}__DECOM__{#{@name}}") do |topics, instance, parent|
deploy_reducer_microservice(gem_path, variables, topics, instance, parent)
unless @reducer_disable
deploy_target_microservices('REDUCER', decom_topic_list, "#{@scope}__DECOM__{#{@name}}") do |topics, instance, parent|
deploy_reducer_microservice(gem_path, variables, topics, instance, parent)
end
end
end

Expand Down