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

Message Data Serialization [minor] #271

Open
wants to merge 82 commits into
base: main
Choose a base branch
from
Open

Message Data Serialization [minor] #271

wants to merge 82 commits into from

Conversation

ric-evans
Copy link
Member

@ric-evans ric-evans commented Sep 19, 2024

JSON objects/files will now be used during message I/0. This change will ease the transition to SkyDriver 2.0 (EWMS 1.0).

This change can be seen in the following sections:

await pub.send(
{
cfg.MsgKeyToClient.RECO_ALGO: reco_algo,
cfg.MsgKeyToClient.PFRAME_PKL_B64: messages.Serialization.encode_pkl_b64(
pframe
),
}
)

with open(args.infile, "r") as f:
msg = json.load(f)
reco_algo = msg[cfg.MsgKeyToClient.RECO_ALGO]
pframe = messages.Serialization.decode_pkl_b64(
msg[cfg.MsgKeyToClient.PFRAME_PKL_B64]
)

json.dump(
{
cfg.MsgKeyFromClient.RECO_PIXEL_VARIATION_PKL_B64: messages.Serialization.encode_pkl_b64(
reco_pixel_variation
),
# can't trust the clocks running in containers, but we can trust the relative time
cfg.MsgKeyFromClient.RUNTIME: time.time() - start_time,
},
f,
)

async with from_clients_queue.open_sub() as sub: # re-open to avoid inactivity timeout (applicable for rabbitmq)
async for msg in sub:
reco_pixel_variation = messages.Serialization.decode_pkl_b64(
msg[cfg.MsgKeyFromClient.RECO_PIXEL_VARIATION_PKL_B64]
)

Testing

The test data format for the single-pixel tests is now unified, so no script is needed to pre-transform data--this follows general best practices for testing.

@ric-evans ric-evans added the CI / Testing About CI and/or testing label Sep 19, 2024
@ric-evans ric-evans self-assigned this Sep 19, 2024
@ric-evans ric-evans changed the title Make Test Data Absolutely Static Message Data Serialization [minor] Sep 20, 2024
@ric-evans ric-evans marked this pull request as ready for review September 24, 2024 18:02
ric-evans added a commit that referenced this pull request Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI / Testing About CI and/or testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants