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

Remove detector name requirement in test-connection #130

Draft
wants to merge 1 commit into
base: integrate-snews-data-formats
Choose a base branch
from
Draft
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
1 change: 0 additions & 1 deletion snews_pt/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def test_connection(ctx, firedrill, start_at, patience):
from .remote_commands import test_connection

test_connection(
detector_name=ctx.obj["DETECTOR_NAME"],
firedrill=firedrill,
start_at=start_at,
patience=patience,
Expand Down
9 changes: 4 additions & 5 deletions snews_pt/remote_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from hop.models import JSONBlob


def test_connection(detector_name=None, firedrill=True, start_at="LATEST", patience=8):
def test_connection(firedrill=True, start_at="LATEST", patience=8):
""" test the server connection
It should prompt your whether the
coincidence script is running in the server
Expand All @@ -31,12 +31,12 @@ def test_connection(detector_name=None, firedrill=True, start_at="LATEST", patie
None

"""
detector_name = detector_name or os.getenv("DETECTOR_NAME")

default_connection_topic = "kafka://kafka.scimma.org/snews.connection-testing"
connection_broker = os.getenv("CONNECTION_TEST_TOPIC", default_connection_topic)
stamp_time = datetime.now(UTC).isoformat()
message = {'_id': '0_test-connection',
'detector_name': detector_name,

'time': stamp_time,
'status': 'sending',
'meta':{}}
Expand Down Expand Up @@ -64,9 +64,8 @@ def test_connection(detector_name=None, firedrill=True, start_at="LATEST", patie
for read in ss:
read = read.content
if read == message_expected:
read_name = click.style(read['detector_name'], fg='green', bold=True)
read_time = click.style(read['time'], fg='green', bold=True)
click.echo(f"You ({read_name}) have a connection to the server at {read_time}")
click.echo(f"You have a connection to the server at {read_time}")
confirmed=True
break
else: # if there is no else: continue statement, it does not work
Expand Down