[ 
https://issues.apache.org/jira/browse/BEAM-11159?focusedWorklogId=508297&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-508297
 ]

ASF GitHub Bot logged work on BEAM-11159:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Nov/20 23:16
            Start Date: 05/Nov/20 23:16
    Worklog Time Spent: 10m 
      Work Description: apilloud commented on a change in pull request #13273:
URL: https://github.com/apache/beam/pull/13273#discussion_r518427792



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/TestPubsub.java
##########
@@ -195,43 +227,46 @@ public SubscriptionPath subscriptionPath() {
     return subscriptionPath;
   }
 
-  private List<SubscriptionPath> listSubscriptions(ProjectPath projectPath, 
TopicPath topicPath)
-      throws IOException {
-    return pubsub.listSubscriptions(projectPath, topicPath).stream()
-        .filter((path) -> !path.equals(subscriptionPath))
-        .collect(ImmutableList.toImmutableList());
+  private Iterable<String> listSubscriptions(TopicPath topicPath) {
+    assert topicAdmin != null;
+    return topicAdmin.listTopicSubscriptions(topicPath.getPath()).iterateAll();
   }
 
   /** Publish messages to {@link #topicPath()}. */
-  public void publish(List<PubsubMessage> messages) throws IOException {
-    List<PubsubClient.OutgoingMessage> outgoingMessages =
-        messages.stream().map(this::toOutgoingMessage).collect(toList());
-    pubsub.publish(eventsTopicPath, outgoingMessages);
-  }
+  public void publish(List<PubsubMessage> messages) {
+    assert eventsTopicPath != null;

Review comment:
       Assert isn't guaranteed to run. Would something like 
`org.apache.beam.sdk.util.Preconditions.checkArgumentNotNull` be more 
appropriate?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 508297)
    Time Spent: 40m  (was: 0.5h)

> Consider using official GCP client in TestPubsub
> ------------------------------------------------
>
>                 Key: BEAM-11159
>                 URL: https://issues.apache.org/jira/browse/BEAM-11159
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql, sdk-java-core
>            Reporter: Brian Hulette
>            Assignee: Brian Hulette
>            Priority: P2
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> TestPubsub currently uses Beam's custom PubSub client, which occasionally 
> leads to flaky failures due to requests that timed out or could be retried, 
> e.g.:
> {code}
> 1) 
> failNotFound_matchingDCSchema_sendsMessages(com.google.cloud.dataflow.sqllauncher.PubsubWriteIT)
> io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: Deadline expired before 
> operation could complete.
>       at 
> io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:240)
>       at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:221)
>       at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:140)
>       at 
> com.google.pubsub.v1.SubscriberGrpc$SubscriberBlockingStub.createSubscription(SubscriberGrpc.java:1674)
>       at 
> org.apache.beam.sdk.io.gcp.pubsub.PubsubGrpcClient.createSubscription(PubsubGrpcClient.java:352)
>       at 
> org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.createRandomSubscription(PubsubClient.java:429)
>       at 
> org.apache.beam.sdk.io.gcp.pubsub.TestPubsub.initializePubsub(TestPubsub.java:123)
>       at 
> org.apache.beam.sdk.io.gcp.pubsub.TestPubsub.access$200(TestPubsub.java:57)
>       at 
> org.apache.beam.sdk.io.gcp.pubsub.TestPubsub$1.evaluate(TestPubsub.java:102)
>       at 
> org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:266)
>       at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:305)
> {code}
> We should look into using the GCP client instead which should have better 
> tuned timeouts and retry policies by default.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to