[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-11 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 11/Sep/19 17:26
Start Date: 11/Sep/19 17:26
Worklog Time Spent: 10m 
  Work Description: lukecwik commented on pull request #9511: [BEAM-8169] 
DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511
 
 
   
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 310873)
Time Spent: 2h  (was: 1h 50m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
> Fix For: 2.16.0
>
>  Time Spent: 2h
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 18:44
Start Date: 07/Sep/19 18:44
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on issue #9511: [BEAM-8169] 
DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#issuecomment-529135828
 
 
   Run sql postcommit
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308380)
Time Spent: 1h 50m  (was: 1h 40m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 18:44
Start Date: 07/Sep/19 18:44
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on issue #9511: [BEAM-8169] 
DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#issuecomment-529135816
 
 
   Run JavaPortabilityApi PreCommit
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308379)
Time Spent: 1h 40m  (was: 1.5h)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 17:57
Start Date: 07/Sep/19 17:57
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on pull request #9511: 
[BEAM-8169] DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#discussion_r321977454
 
 

 ##
 File path: 
sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogClientAdapter.java
 ##
 @@ -31,63 +30,51 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
 import io.grpc.auth.MoreCallCredentials;
-import java.io.IOException;
+import java.util.function.Supplier;
 import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
 import org.apache.beam.sdk.extensions.sql.meta.Table;
 
 /** Wraps DataCatalog GRPC client and exposes simplified APIS for Data Catalog 
Table Provider. */
 class DataCatalogClientAdapter {
 
-  private DataCatalogBlockingStub dcClient;
+  private DataCatalogPipelineOptions options;
 
-  private DataCatalogClientAdapter(DataCatalogBlockingStub dcClient) {
-this.dcClient = dcClient;
+  private Supplier dcClient = () -> 
newClient(options);
+
+  private DataCatalogClientAdapter(DataCatalogPipelineOptions options) {
+this.options = options;
   }
 
   /** Prod endpoint (default set in pipeline options): 
datacatalog.googleapis.com. */
-  public static DataCatalogClientAdapter withDefaultCredentials(String 
endpoint)
-  throws IOException {
-return new DataCatalogClientAdapter(newClient(endpoint));
+  public static DataCatalogClientAdapter 
withOptions(DataCatalogPipelineOptions options) {
+return new DataCatalogClientAdapter(options);
   }
 
-  private static DataCatalogBlockingStub newClient(String endpoint) throws 
IOException {
+  private DataCatalogBlockingStub newClient(DataCatalogPipelineOptions 
options) {
 
 Review comment:
   TBH it seems like a "client adapter" should have a separate client per 
adapter. But I'm not really convinced that this class needs to exist at all...
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308374)
Time Spent: 1.5h  (was: 1h 20m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 17:57
Start Date: 07/Sep/19 17:57
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on pull request #9511: 
[BEAM-8169] DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#discussion_r321977873
 
 

 ##
 File path: 
sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogClientAdapter.java
 ##
 @@ -31,63 +30,51 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
 import io.grpc.auth.MoreCallCredentials;
-import java.io.IOException;
+import java.util.function.Supplier;
 import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
 import org.apache.beam.sdk.extensions.sql.meta.Table;
 
 /** Wraps DataCatalog GRPC client and exposes simplified APIS for Data Catalog 
Table Provider. */
 class DataCatalogClientAdapter {
 
-  private DataCatalogBlockingStub dcClient;
+  private DataCatalogPipelineOptions options;
 
-  private DataCatalogClientAdapter(DataCatalogBlockingStub dcClient) {
-this.dcClient = dcClient;
+  private Supplier dcClient = () -> 
newClient(options);
+
+  private DataCatalogClientAdapter(DataCatalogPipelineOptions options) {
+this.options = options;
   }
 
   /** Prod endpoint (default set in pipeline options): 
datacatalog.googleapis.com. */
-  public static DataCatalogClientAdapter withDefaultCredentials(String 
endpoint)
-  throws IOException {
-return new DataCatalogClientAdapter(newClient(endpoint));
+  public static DataCatalogClientAdapter 
withOptions(DataCatalogPipelineOptions options) {
+return new DataCatalogClientAdapter(options);
   }
 
-  private static DataCatalogBlockingStub newClient(String endpoint) throws 
IOException {
+  private DataCatalogBlockingStub newClient(DataCatalogPipelineOptions 
options) {
 
 Review comment:
   Actually, I think the client and the adapter should have the same lifetime 
if the client is an internal detail. And each new `DataCatalogClientAdapter` 
could have different pipeline options, so you would need to manage multiple 
underlying clients.
   
   I tried the alternative of injecting a client, so the caller could own the 
configuration and lifecycle. And that made this class pretty pointless, so I 
just inlined the whole class and some other trivial methods.
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308372)
Time Spent: 1h 20m  (was: 1h 10m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 17:57
Start Date: 07/Sep/19 17:57
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on pull request #9511: 
[BEAM-8169] DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#discussion_r321977834
 
 

 ##
 File path: 
sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogClientAdapter.java
 ##
 @@ -31,63 +30,51 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
 import io.grpc.auth.MoreCallCredentials;
-import java.io.IOException;
+import java.util.function.Supplier;
 import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
 import org.apache.beam.sdk.extensions.sql.meta.Table;
 
 /** Wraps DataCatalog GRPC client and exposes simplified APIS for Data Catalog 
Table Provider. */
 class DataCatalogClientAdapter {
 
-  private DataCatalogBlockingStub dcClient;
+  private DataCatalogPipelineOptions options;
 
-  private DataCatalogClientAdapter(DataCatalogBlockingStub dcClient) {
-this.dcClient = dcClient;
+  private Supplier dcClient = () -> 
newClient(options);
+
+  private DataCatalogClientAdapter(DataCatalogPipelineOptions options) {
+this.options = options;
   }
 
   /** Prod endpoint (default set in pipeline options): 
datacatalog.googleapis.com. */
-  public static DataCatalogClientAdapter withDefaultCredentials(String 
endpoint)
-  throws IOException {
-return new DataCatalogClientAdapter(newClient(endpoint));
+  public static DataCatalogClientAdapter 
withOptions(DataCatalogPipelineOptions options) {
+return new DataCatalogClientAdapter(options);
   }
 
-  private static DataCatalogBlockingStub newClient(String endpoint) throws 
IOException {
+  private DataCatalogBlockingStub newClient(DataCatalogPipelineOptions 
options) {
 Channel authedChannel =
 ClientInterceptors.intercept(
-ManagedChannelBuilder.forTarget(endpoint).build(),
-CredentialsInterceptor.defaultCredentials());
+
ManagedChannelBuilder.forTarget(options.getDataCatalogEndpoint()).build(),
+new CredentialsInterceptor());
 return DataCatalogGrpc.newBlockingStub(authedChannel);
 
 Review comment:
   Nice.
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308373)
Time Spent: 1h 20m  (was: 1h 10m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 17:40
Start Date: 07/Sep/19 17:40
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on pull request #9511: 
[BEAM-8169] DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#discussion_r321977369
 
 

 ##
 File path: 
sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogClientAdapter.java
 ##
 @@ -31,63 +30,51 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
 import io.grpc.auth.MoreCallCredentials;
-import java.io.IOException;
+import java.util.function.Supplier;
 import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
 import org.apache.beam.sdk.extensions.sql.meta.Table;
 
 /** Wraps DataCatalog GRPC client and exposes simplified APIS for Data Catalog 
Table Provider. */
 class DataCatalogClientAdapter {
 
-  private DataCatalogBlockingStub dcClient;
+  private DataCatalogPipelineOptions options;
 
-  private DataCatalogClientAdapter(DataCatalogBlockingStub dcClient) {
-this.dcClient = dcClient;
+  private Supplier dcClient = () -> 
newClient(options);
+
+  private DataCatalogClientAdapter(DataCatalogPipelineOptions options) {
+this.options = options;
   }
 
   /** Prod endpoint (default set in pipeline options): 
datacatalog.googleapis.com. */
-  public static DataCatalogClientAdapter withDefaultCredentials(String 
endpoint)
-  throws IOException {
-return new DataCatalogClientAdapter(newClient(endpoint));
+  public static DataCatalogClientAdapter 
withOptions(DataCatalogPipelineOptions options) {
+return new DataCatalogClientAdapter(options);
   }
 
-  private static DataCatalogBlockingStub newClient(String endpoint) throws 
IOException {
+  private DataCatalogBlockingStub newClient(DataCatalogPipelineOptions 
options) {
 
 Review comment:
   Yea, good call. At first I didn't wrap it because it was a ThrowingSupplier 
where we don't have the nice utilities already. But turns out it didn't need to 
be, so that's easy.
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308368)
Time Spent: 1h 10m  (was: 1h)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 17:40
Start Date: 07/Sep/19 17:40
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on pull request #9511: 
[BEAM-8169] DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#discussion_r321977369
 
 

 ##
 File path: 
sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogClientAdapter.java
 ##
 @@ -31,63 +30,51 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
 import io.grpc.auth.MoreCallCredentials;
-import java.io.IOException;
+import java.util.function.Supplier;
 import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
 import org.apache.beam.sdk.extensions.sql.meta.Table;
 
 /** Wraps DataCatalog GRPC client and exposes simplified APIS for Data Catalog 
Table Provider. */
 class DataCatalogClientAdapter {
 
-  private DataCatalogBlockingStub dcClient;
+  private DataCatalogPipelineOptions options;
 
-  private DataCatalogClientAdapter(DataCatalogBlockingStub dcClient) {
-this.dcClient = dcClient;
+  private Supplier dcClient = () -> 
newClient(options);
+
+  private DataCatalogClientAdapter(DataCatalogPipelineOptions options) {
+this.options = options;
   }
 
   /** Prod endpoint (default set in pipeline options): 
datacatalog.googleapis.com. */
-  public static DataCatalogClientAdapter withDefaultCredentials(String 
endpoint)
-  throws IOException {
-return new DataCatalogClientAdapter(newClient(endpoint));
+  public static DataCatalogClientAdapter 
withOptions(DataCatalogPipelineOptions options) {
+return new DataCatalogClientAdapter(options);
   }
 
-  private static DataCatalogBlockingStub newClient(String endpoint) throws 
IOException {
+  private DataCatalogBlockingStub newClient(DataCatalogPipelineOptions 
options) {
 
 Review comment:
   Yea, good call. At first I didn't wrap it because it was a ThrowingSupplier 
where we don't have the nice utilities already. But turns out it didn't need to 
be, so that's easy.
   
   This is actually created only once, during pipeline construction time. I 
have refactored to make it more clear.
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308367)
Time Spent: 1h  (was: 50m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 17:35
Start Date: 07/Sep/19 17:35
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on pull request #9511: 
[BEAM-8169] DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#discussion_r321977369
 
 

 ##
 File path: 
sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogClientAdapter.java
 ##
 @@ -31,63 +30,51 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
 import io.grpc.auth.MoreCallCredentials;
-import java.io.IOException;
+import java.util.function.Supplier;
 import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
 import org.apache.beam.sdk.extensions.sql.meta.Table;
 
 /** Wraps DataCatalog GRPC client and exposes simplified APIS for Data Catalog 
Table Provider. */
 class DataCatalogClientAdapter {
 
-  private DataCatalogBlockingStub dcClient;
+  private DataCatalogPipelineOptions options;
 
-  private DataCatalogClientAdapter(DataCatalogBlockingStub dcClient) {
-this.dcClient = dcClient;
+  private Supplier dcClient = () -> 
newClient(options);
+
+  private DataCatalogClientAdapter(DataCatalogPipelineOptions options) {
+this.options = options;
   }
 
   /** Prod endpoint (default set in pipeline options): 
datacatalog.googleapis.com. */
-  public static DataCatalogClientAdapter withDefaultCredentials(String 
endpoint)
-  throws IOException {
-return new DataCatalogClientAdapter(newClient(endpoint));
+  public static DataCatalogClientAdapter 
withOptions(DataCatalogPipelineOptions options) {
+return new DataCatalogClientAdapter(options);
   }
 
-  private static DataCatalogBlockingStub newClient(String endpoint) throws 
IOException {
+  private DataCatalogBlockingStub newClient(DataCatalogPipelineOptions 
options) {
 
 Review comment:
   Yea, good call. At first I didn't wrap it because it was a ThrowingSupplier 
where we don't have the nice utilities already. But turns out it didn't need to 
be, so that's easy.
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308365)
Time Spent: 50m  (was: 40m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 16:29
Start Date: 07/Sep/19 16:29
Worklog Time Spent: 10m 
  Work Description: lukecwik commented on pull request #9511: [BEAM-8169] 
DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#discussion_r321975162
 
 

 ##
 File path: 
sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogClientAdapter.java
 ##
 @@ -31,63 +30,51 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
 import io.grpc.auth.MoreCallCredentials;
-import java.io.IOException;
+import java.util.function.Supplier;
 import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
 import org.apache.beam.sdk.extensions.sql.meta.Table;
 
 /** Wraps DataCatalog GRPC client and exposes simplified APIS for Data Catalog 
Table Provider. */
 class DataCatalogClientAdapter {
 
-  private DataCatalogBlockingStub dcClient;
+  private DataCatalogPipelineOptions options;
 
-  private DataCatalogClientAdapter(DataCatalogBlockingStub dcClient) {
-this.dcClient = dcClient;
+  private Supplier dcClient = () -> 
newClient(options);
+
+  private DataCatalogClientAdapter(DataCatalogPipelineOptions options) {
+this.options = options;
   }
 
   /** Prod endpoint (default set in pipeline options): 
datacatalog.googleapis.com. */
-  public static DataCatalogClientAdapter withDefaultCredentials(String 
endpoint)
-  throws IOException {
-return new DataCatalogClientAdapter(newClient(endpoint));
+  public static DataCatalogClientAdapter 
withOptions(DataCatalogPipelineOptions options) {
+return new DataCatalogClientAdapter(options);
   }
 
-  private static DataCatalogBlockingStub newClient(String endpoint) throws 
IOException {
+  private DataCatalogBlockingStub newClient(DataCatalogPipelineOptions 
options) {
 Channel authedChannel =
 ClientInterceptors.intercept(
-ManagedChannelBuilder.forTarget(endpoint).build(),
-CredentialsInterceptor.defaultCredentials());
+
ManagedChannelBuilder.forTarget(options.getDataCatalogEndpoint()).build(),
+new CredentialsInterceptor());
 return DataCatalogGrpc.newBlockingStub(authedChannel);
 
 Review comment:
   You don't need to create a CredentialsInterceptor class, you can invoke 
`withCallCredentials(creds)` on the return from `newBlockingStub`
 

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:
us...@infra.apache.org


Issue Time Tracking
---

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

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 16:29
Start Date: 07/Sep/19 16:29
Worklog Time Spent: 10m 
  Work Description: lukecwik commented on pull request #9511: [BEAM-8169] 
DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#discussion_r321974948
 
 

 ##
 File path: 
sdks/java/extensions/sql/datacatalog/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datacatalog/DataCatalogClientAdapter.java
 ##
 @@ -31,63 +30,51 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.MethodDescriptor;
 import io.grpc.auth.MoreCallCredentials;
-import java.io.IOException;
+import java.util.function.Supplier;
 import javax.annotation.Nullable;
+import org.apache.beam.sdk.extensions.gcp.options.GcpOptions;
 import org.apache.beam.sdk.extensions.sql.meta.Table;
 
 /** Wraps DataCatalog GRPC client and exposes simplified APIS for Data Catalog 
Table Provider. */
 class DataCatalogClientAdapter {
 
-  private DataCatalogBlockingStub dcClient;
+  private DataCatalogPipelineOptions options;
 
-  private DataCatalogClientAdapter(DataCatalogBlockingStub dcClient) {
-this.dcClient = dcClient;
+  private Supplier dcClient = () -> 
newClient(options);
+
+  private DataCatalogClientAdapter(DataCatalogPipelineOptions options) {
+this.options = options;
   }
 
   /** Prod endpoint (default set in pipeline options): 
datacatalog.googleapis.com. */
-  public static DataCatalogClientAdapter withDefaultCredentials(String 
endpoint)
-  throws IOException {
-return new DataCatalogClientAdapter(newClient(endpoint));
+  public static DataCatalogClientAdapter 
withOptions(DataCatalogPipelineOptions options) {
+return new DataCatalogClientAdapter(options);
   }
 
-  private static DataCatalogBlockingStub newClient(String endpoint) throws 
IOException {
+  private DataCatalogBlockingStub newClient(DataCatalogPipelineOptions 
options) {
 
 Review comment:
   Client setup isn't free, maintaining an existing channel that has already 
been through auth and possibly has an active http connection will be noticeable 
from a performance perspective and load on datacatalogs service.
   
   Swap the supplier to be wrapped with Guava's memoizing supplier or JDK 
equivalent.
 

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:
us...@infra.apache.org


Issue Time Tracking
---

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

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-07 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 07/Sep/19 16:16
Start Date: 07/Sep/19 16:16
Worklog Time Spent: 10m 
  Work Description: lukecwik commented on issue #9511: [BEAM-8169] 
DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#issuecomment-529122403
 
 
   Note, I also noticed that this was an issue in BigqueryClient: 
https://github.com/apache/beam/blob/058f5bc1d03e207ce5c8b9d221a231f390b088f3/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/BigqueryClient.java#L135
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308362)
Time Spent: 0.5h  (was: 20m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-06 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 06/Sep/19 23:32
Start Date: 06/Sep/19 23:32
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on issue #9511: [BEAM-8169] 
DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511#issuecomment-529046151
 
 
   run sql postcommit
 

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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 308222)
Time Spent: 20m  (was: 10m)

> DataCatalogTableProvider should use credentials from PipelineOptions
> 
>
> Key: BEAM-8169
> URL: https://issues.apache.org/jira/browse/BEAM-8169
> Project: Beam
>  Issue Type: Bug
>  Components: dsl-sql
>Reporter: Kenneth Knowles
>Assignee: Kenneth Knowles
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently it is hardcoded to the default credentials, but the use should be 
> in control via PipelineOptions. This is also the mechanism for injecting 
> mock/test credentials.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (BEAM-8169) DataCatalogTableProvider should use credentials from PipelineOptions

2019-09-06 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-8169:


Author: ASF GitHub Bot
Created on: 06/Sep/19 23:31
Start Date: 06/Sep/19 23:31
Worklog Time Spent: 10m 
  Work Description: kennknowles commented on pull request #9511: 
[BEAM-8169] DataCatalogTableProvider to use GCP credentials from PipelineOptions
URL: https://github.com/apache/beam/pull/9511
 
 
   This switches the metastore from Google Cloud Data Catalog to use the 
credentials specified in the options.
   
   
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   
- [x] [**Choose 
reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and 
mention them in a comment (`R: @username`).
- [x] Format the pull request title like `[BEAM-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA 
issue, if applicable. This will automatically link the pull request to the 
issue.
- [x] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   Post-Commit Tests Status (on master branch)
   

   
   Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
   --- | --- | --- | --- | --- | --- | --- | ---
   Go | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/)
 | --- | --- | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/)
 | --- | --- | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/)
   Java | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/)
   Python | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/)[![Build