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

add feedback to ensure that experiment messages are received #38

Open
sybenzvi opened this issue Apr 15, 2022 · 3 comments
Open

add feedback to ensure that experiment messages are received #38

sybenzvi opened this issue Apr 15, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@sybenzvi
Copy link
Contributor

We probably need a logging channel on HopSkotch that confirms receipt of test messages send to the observation channel.

@sybenzvi sybenzvi added the enhancement New feature or request label Apr 15, 2022
@KaraMelih
Copy link
Collaborator

I think related to this issue SNEWS2/SNEWS_Coincidence_System#11
we can go around and do this at least for the 'test-connection' messages. If need be, we can apply the same idea to observation messages.
If we use the timestamps to catch from this logging channel this can be done rather easily.

@KaraMelih
Copy link
Collaborator

Now there is a snews_pt test-connection function

@main.command()
@click.option('--firedrill/--no-firedrill', default=True, show_default='True', help='Whether to use firedrill brokers or default ones')
@click.option('--start_at', '-s', type=int, default=-2)
@click.pass_context
def test_connection(ctx, firedrill, start_at):
""" test the server connection
It should prompt your whether the
coincidence script is running in the server
"""
from hop import Stream
name = ctx.obj['DETECTOR_NAME']
snewstimes = snews_pt_utils.TimeStuff()
stamp_time = snewstimes.get_utcnow()
message = {'_id': '0_test-connection',
'detector_name': name,
'time': stamp_time,
'status': 'sending'}
if firedrill:
topic = os.getenv("FIREDRILL_OBSERVATION_TOPIC")
else:
topic = os.getenv("OBSERVATION_TOPIC")
substream = Stream(until_eos=True, auth=True, start_at=start_at)
pubstream = Stream(until_eos=True, auth=True)
click.secho(f"> Testing your connection to {topic}. \n Should take 4-5 seconds...\n", fg='green')
messages = []
with pubstream.open(topic, "w") as ps:
ps.write(message)
with substream.open(topic, "r") as ss:
for read in ss:
messages.append(read)
message_expected = message.copy()
message_expected["status"] = "received"
if read == message_expected:
click.secho(f"You ({read['detector_name']}) have a connection to the server at {read['time']}", fg='green', bold=True)
break

However, I think the synched logs that are transferred directly from the Purdue server are healthier for the development.
https://www.physics.purdue.edu/snews/logs/
(requires username/password access)

@justinvasel
Copy link
Contributor

Does the test-connection functionality address this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants