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

Fix to allow get_packet during server boot #541

Merged
3 commits merged into from
Aug 22, 2017
Merged

Fix to allow get_packet during server boot #541

3 commits merged into from
Aug 22, 2017

Conversation

ghost
Copy link

@ghost ghost commented Aug 18, 2017

This one was tricky. My background task was trying to call get_packet but the telemetry.rb get_packet_data method wasn't being called so that little Time.at code wasn't getting called. I removed that to make get_packet_data just call the $cmd_tlm_server version with no extras and put the Time.at code in the api_shared get_packet code.

Did the telemetry.rb code not get called because I'm part of the server as a background task?

closes #540

@ghost ghost requested review from a user and donaldatball August 18, 2017 15:02
value_type = value_type.to_s.intern
item_hash.each do |item_name, item_value|
packet.write(item_name, item_value, value_type)
if item_hash
Copy link
Author

Choose a reason for hiding this comment

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

This is required due to item_hash having a default value of nil

Copy link

Choose a reason for hiding this comment

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

Good catch

@coveralls
Copy link

coveralls commented Aug 18, 2017

Coverage Status

Coverage increased (+0.2%) to 80.915% when pulling 8d346a5 on initial_get_packet into 91d3c41 on master.

@ghost
Copy link
Author

ghost commented Aug 18, 2017

Not sure why the Java build failed. Are any of those return statements actually necessary or was this failure just a fluke?

packet = get_packet(id)
expect(packet.target_name).to eql "SYSTEM"
expect(packet.packet_name).to eql "META"
expect(packet.received_time).to be_within(0.1).of Time.now
Copy link

Choose a reason for hiding this comment

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

This won't be reliable.

Copy link
Author

Choose a reason for hiding this comment

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

Why, do I need a delay after inject?

Copy link

Choose a reason for hiding this comment

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

Requiring anything to be within 0.1 seconds of now is too tight of tolerance and will sometimes fail.

value_type = value_type.to_s.intern
item_hash.each do |item_name, item_value|
packet.write(item_name, item_value, value_type)
if item_hash
Copy link

Choose a reason for hiding this comment

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

Good catch

results.delete_at(4)
end
results
$cmd_tlm_server.get_packet_data(id, non_block)
Copy link

Choose a reason for hiding this comment

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

Doing this is a breaking change, please undo. Need to add smarts at get_packet or remove from shared.

Copy link
Author

Choose a reason for hiding this comment

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

It was super confusing that this magic was happening here when I was trying to debug it. It's deprecated. Can we just remove it altogether?

Copy link

Choose a reason for hiding this comment

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

get_packet_data is a nice api for systems that don't know the whole definition of everything (like python). It's only really deprecated from Ruby... so we can't remove it.

Time doesn't serialize to JSON which is the only reason a time object wasn't sent directly. Ideally the api should give a ruby time object.

Having the return value be different between the internal API and the script api is confusing now though...

Any breaking changes bump us to COSMOS 4.1 which I don't want to goto now. Need to just keep it around for now and maybe we can remove the Ruby script version in 4.1.

packet.received_time = received_time
packet.received_count = received_count
packet.received_time = Time.at(rx_sec, rx_usec).sys
packet.received_count = rx_count
end
packet
end
Copy link

Choose a reason for hiding this comment

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

Should probably just remove this from shared and redefine in both places. Making the change to get_packet_data at the script level is breaking backwards compat. Alternatively. could check the number of fields returned by get_packet_data.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.005%) to 80.691% when pulling d9c4789 on initial_get_packet into 91d3c41 on master.

@coveralls
Copy link

coveralls commented Aug 18, 2017

Coverage Status

Coverage increased (+0.3%) to 80.946% when pulling d9c4789 on initial_get_packet into 91d3c41 on master.

end
packet
end

Copy link

Choose a reason for hiding this comment

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

This should be in script/telemetry.rb

@coveralls
Copy link

coveralls commented Aug 21, 2017

Coverage Status

Coverage increased (+0.3%) to 80.946% when pulling 6db7355 on initial_get_packet into 91d3c41 on master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 80.946% when pulling 6db7355 on initial_get_packet into 91d3c41 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 80.946% when pulling 6db7355 on initial_get_packet into 91d3c41 on master.

@ghost
Copy link
Author

ghost commented Aug 21, 2017

@ryanatball One final review?

@ghost
Copy link

ghost commented Aug 22, 2017

👍

@ghost ghost merged commit ec8ee21 into master Aug 22, 2017
@ghost ghost deleted the initial_get_packet branch August 22, 2017 19:14
This pull request was closed.
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.

Background task packet subscription get_packet broken
2 participants