From 7dbe0615afefcf47ddb8683811833e622c3aa6fc Mon Sep 17 00:00:00 2001 From: Shicong Huang Date: Wed, 3 Jul 2019 15:12:48 -0400 Subject: [PATCH] Remove injected credentials from invoice pipeline (#155) We got non-serialization object error when deploying the invoicing pipeline. It turns out that Beam requires every field in the pipeline object is serilizable. However, it is non-trivial to make GoogleCredentialsBundle serilizable because almost all of its dependency are not serilizable and not contraled by us. Also, it is non-necessary to inject the credential as the spec11 pipeline also writes output to GCS without having injected credential. So, removing the injected variable can solve the problem. TESTED=First reproduced the problem locally by deploying the invoicing pipeline with the previous code; applied this change and successfully deploy the pipeline without having any issue. --- .../google/registry/beam/invoicing/InvoicingPipeline.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/core/src/main/java/google/registry/beam/invoicing/InvoicingPipeline.java b/core/src/main/java/google/registry/beam/invoicing/InvoicingPipeline.java index 6f4d4aff2..0f70ff631 100644 --- a/core/src/main/java/google/registry/beam/invoicing/InvoicingPipeline.java +++ b/core/src/main/java/google/registry/beam/invoicing/InvoicingPipeline.java @@ -16,11 +16,9 @@ package google.registry.beam.invoicing; import google.registry.beam.invoicing.BillingEvent.InvoiceGroupingKey; import google.registry.beam.invoicing.BillingEvent.InvoiceGroupingKey.InvoiceGroupingKeyCoder; -import google.registry.config.CredentialModule.LocalCredential; import google.registry.config.RegistryConfig.Config; import google.registry.reporting.billing.BillingModule; import google.registry.reporting.billing.GenerateInvoicesAction; -import google.registry.util.GoogleCredentialsBundle; import java.io.Serializable; import javax.inject.Inject; import org.apache.beam.runners.dataflow.DataflowRunner; @@ -81,9 +79,6 @@ public class InvoicingPipeline implements Serializable { @Config("invoiceFilePrefix") String invoiceFilePrefix; - @Inject @LocalCredential - GoogleCredentialsBundle credentialsBundle; - @Inject InvoicingPipeline() {} @@ -105,7 +100,6 @@ public class InvoicingPipeline implements Serializable { public void deploy() { // We can't store options as a member variable due to serialization concerns. InvoicingPipelineOptions options = PipelineOptionsFactory.as(InvoicingPipelineOptions.class); - options.setGcpCredential(credentialsBundle.getGoogleCredentials()); options.setProject(projectId); options.setRunner(DataflowRunner.class); // This causes p.run() to stage the pipeline as a template on GCS, as opposed to running it.