Skip to content

override_tlm sets all by default, works across processes #343

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

Merged
merged 2 commits into from
Dec 17, 2022
Merged

Conversation

jmthomas
Copy link
Member

@jmthomas jmthomas commented Dec 16, 2022

Remove dead OverrideProtocol and deprecated api methods

@jmthomas jmthomas requested a review from ryanmelt December 16, 2022 21:13
@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Base: 74.96% // Head: 74.93% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (cdde281) compared to base (49c6251).
Patch coverage: 97.29% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #343      +/-   ##
==========================================
- Coverage   74.96%   74.93%   -0.04%     
==========================================
  Files         447      446       -1     
  Lines       27191    27186       -5     
  Branches      578      578              
==========================================
- Hits        20385    20372      -13     
- Misses       6715     6724       +9     
+ Partials       91       90       -1     
Flag Coverage Δ
frontend 75.60% <ø> (-0.17%) ⬇️
ruby-api 50.43% <100.00%> (ø)
ruby-backend 79.26% <97.26%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
openc3/lib/openc3/interfaces.rb 100.00% <ø> (ø)
openc3/lib/openc3/interfaces/interface.rb 96.49% <ø> (-0.27%) ⬇️
...ib/openc3/interfaces/simulated_target_interface.rb 15.66% <ø> (-0.81%) ⬇️
openc3/lib/openc3/models/cvt_model.rb 98.27% <96.92%> (-1.73%) ⬇️
.../app/controllers/script_autocomplete_controller.rb 22.22% <100.00%> (ø)
openc3/lib/openc3/api/tlm_api.rb 98.78% <100.00%> (ø)
openc3/lib/openc3/version.rb 100.00% <100.00%> (ø)
...ol-calendar/src/tools/Calendar/SelectorOptions.vue 58.82% <0.00%> (-11.77%) ⬇️
...smos-tool-calendar/src/tools/Calendar/Calendar.vue 68.24% <0.00%> (-4.06%) ⬇️
openc3/lib/openc3/packets/telemetry.rb 89.50% <0.00%> (-1.11%) ⬇️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

check check_raw check_tolerance check_tolerance_raw
wait wait_raw wait_tolerance wait_tolerance_raw wait_check wait_check_raw
wait_check_tolerance wait_check_tolerance_raw)
check wait wait_tolerance wait_check wait_check_tolerance)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed deprecated keywords and will also update the website with deprecation notices

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check_tolerance missing?

# @param type [Symbol] Telemetry type, :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS
def override_tlm(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
# @param type [Symbol] Telemetry type, :ALL (default), :RAW, :CONVERTED, :FORMATTED, :WITH_UNITS
def override_tlm(*args, type: :ALL, scope: $openc3_scope, token: $openc3_token)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an API change we should note but I think it makes more sense. Especially because PacketViewer shows the WITH_UNITS by default and a call to override_tlm now changes the value in PacketViewer (least surprise).

@@ -179,7 +179,7 @@ def override_tlm(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_t
#
# @param args The args must either be a string or three strings
# (see the calling style in the description).
# @param type [Symbol] Telemetry type, :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS
# @param type [Symbol] Telemetry type, :ALL (default), :RAW, :CONVERTED, :FORMATTED, :WITH_UNITS
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All actually already was the default for normalize but this comment was wrong

return result.to_s
end
return result
end
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were breaking the contract of FORMATTED and WITH_UNITS that they are always a String

keys = ["#{item_name}__U", "#{item_name}__F", "#{item_name}__C", item_name]
if @overrides["#{target_name}__#{packet_name}__#{item_name}__#{value_type}"]
# Set the result as a Hash to distingish it from the key array and from an overridden Array value
keys = {'value' => @overrides["#{target_name}__#{packet_name}__#{item_name}__#{value_type}"]}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually care that it's a Hash but it can't be single value or an Array so this was an easy check

check check_raw check_tolerance check_tolerance_raw
wait wait_raw wait_tolerance wait_tolerance_raw wait_check wait_check_raw
wait_check_tolerance wait_check_tolerance_raw)
check wait wait_tolerance wait_check wait_check_tolerance)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check_tolerance missing?

@overrides["#{target_name}__#{packet_name}__#{item_name}__#{type}"] = value
def self.override(target_name, packet_name, item_name, value, type: :ALL, scope: $openc3_scope)
if type == :ALL
@overrides["#{target_name}__#{packet_name}__#{item_name}__RAW"] = value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't store state in instance variables.... That will only work in a single process. Need to store overrides in Redis.

@jmthomas jmthomas changed the title override_tlm sets all by default, remove dead OverrideProtocol override_tlm sets all by default, works across processes Dec 17, 2022
@jmthomas
Copy link
Member Author

Cleaned plugins and built main, stopped (kept plugin dir), then switched to this branch and built and ran successfully.

@jmthomas jmthomas merged commit 080696c into main Dec 17, 2022
@jmthomas jmthomas deleted the override branch December 17, 2022 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants