Skip to content

Commit

Permalink
update sample 14 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedabu98 authored Jan 22, 2024
1 parent 0dbe7bb commit 8824213
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Python/pubsub/read_pubsub_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ def run():
class ReadPubSubOptions(PipelineOptions):
@classmethod
def _add_argparse_args(cls, parser):
# Add a required flag to allow inputting a subscription from
# the command line
parser.add_argument(
"--subscription",
required=True,
help="PubSub subscription to read.",
)

# Create an instance of our custom options class
options = ReadPubSubOptions(streaming=True)

# Read from the input PubSub subscription and log the output
with beam.Pipeline(options=options) as p:
(
p
Expand All @@ -48,5 +51,4 @@ def _add_argparse_args(cls, parser):

if __name__ == "__main__":
logging.getLogger().setLevel(logging.INFO)
logging.info("Exit with Ctrl+C.")
run()

0 comments on commit 8824213

Please sign in to comment.