GoogleCloudPlatform / GoogleCloudPlatform/training-data-analyst
v2.9.0 Pub/Sub API client library compatibility for courses/streaming/publish/send_sensor_data.py
- Dominant language
- Jupyter Notebook
- Stars
- 8.6k
- Forks
- 6.1k
- Avg merge
- 4h 44m
- Merged PRs (30d)
- 2
Description
Minor code changes (highlighted below) are required to make ```courses/streaming/publish/send_sensor_data.py``` compatible with the most recent version of the Google Cloud Pub/Sub API client library (v2.9.0):
> 87 # create Pub/Sub notification topic
> 88 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
> 89 publisher = pubsub.PublisherClient()
> 90 **topic_path = publisher.topic_path(args.project,TOPIC)**
> 91
> 92 try:
> 93 **publisher.get_topic(request={"topic": topic_path})**
> 94 logging.info('Reusing pub/sub topic {}'.format(TOPIC))
> 95 except:
> 96 **publisher.create_topic(request={"name": topic_path})**
> 97 logging.info('Creating pub/sub topic {}'.format(TOPIC))
> 98
> 99 # notify about each line in the input file
> 100 programStartTime = datetime.datetime.utcnow()
> 101 with gzip.open(INPUT, 'rb') as ifp:
> 102 header = ifp.readline() # skip header
> 103 firstObsTime = peek_timestamp(ifp)
> 104 logging.info('Sending sensor data from {}'.format(firstObsTime))
> 105 **simulate(topic_path, ifp, firstObsTime, programStartTime, args.speedFactor)**
Contributor guide
Assessment
This issue has not been assessed yet.