Skip to content

Commit

Permalink
Don't try to infer hostname from environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdswinbank committed Jul 8, 2019
1 parent 9745250 commit 40c4538
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
11 changes: 4 additions & 7 deletions bin/filterStream.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from __future__ import print_function
import argparse
import sys
import os
import inspect
import platform
from lsst.alert.stream import alertConsumer, alertProducer
from lsst.alert.stream import filterBase
from lsst.alert.stream import filters
Expand All @@ -48,18 +48,15 @@ def main():
help='Globally unique name of the consumer group. '
'Consumers in the same group will share messages '
'(i.e., only one consumer will receive a message, '
'as in a queue). Default is value of $HOSTNAME.')
'as in a queue). Default is the current hostname.',
default=platform.node())

args = parser.parse_args()
fnum = args.filterNum

# Configure consumer connection to Kafka broker
cconf = {'bootstrap.servers': args.broker,
cconf = {'bootstrap.servers': args.broker, 'group.id': args.group,
'default.topic.config': {'auto.offset.reset': 'smallest'}}
if args.group:
cconf['group.id'] = args.group
else:
cconf['group.id'] = os.environ['HOSTNAME']

pconf = {'bootstrap.servers': args.broker}

Expand Down
10 changes: 4 additions & 6 deletions bin/monitorStream.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import argparse
import os
import platform
import sys
from lsst.alert.stream import alertConsumer

Expand All @@ -43,16 +44,13 @@ def main():
help='Globally unique name of the consumer group. '
'Consumers in the same group will share messages '
'(i.e., only one consumer will receive a message, '
'as in a queue). Default is value of $HOSTNAME.')
'as in a queue). Default is the current hostname.',
default=platform.node())
args = parser.parse_args()

# Configure consumer connection to Kafka broker
conf = {'bootstrap.servers': args.broker,
conf = {'bootstrap.servers': args.broker, 'group.id': args.group,
'default.topic.config': {'auto.offset.reset': 'smallest'}}
if args.group:
conf['group.id'] = args.group
else:
conf['group.id'] = os.environ['HOSTNAME']

# Start consumer and monitor alert stream
with alertConsumer.AlertConsumer(args.topic, **conf) as streamWatcher:
Expand Down
13 changes: 6 additions & 7 deletions bin/printStream.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import argparse
import sys
import os
import platform

from lsst.alert.stream import alertConsumer


Expand Down Expand Up @@ -87,20 +89,17 @@ def main():
help='Globally unique name of the consumer group. '
'Consumers in the same group will share messages '
'(i.e., only one consumer will receive a message, '
'as in a queue). Default is value of $HOSTNAME.')
'as in a queue). Default is the current hostname.',
default=platform.node())
parser.add_argument('--stampDir', type=str,
help='Output directory for writing postage stamp'
help='Output directory for writing postage stamp '
'cutout files. **THERE ARE NO STAMPS RIGHT NOW.**')

args = parser.parse_args()

# Configure consumer connection to Kafka broker
conf = {'bootstrap.servers': args.broker,
conf = {'bootstrap.servers': args.broker, 'group.id': args.group,
'default.topic.config': {'auto.offset.reset': 'smallest'}}
if args.group:
conf['group.id'] = args.group
else:
conf['group.id'] = os.environ['HOSTNAME']

# Start consumer and print alert stream
with alertConsumer.AlertConsumer(args.topic, **conf) as streamReader:
Expand Down

0 comments on commit 40c4538

Please sign in to comment.