mirror of
https://github.com/google/nomulus.git
synced 2025-07-21 10:16:07 +02:00
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.
This commit is contained in:
parent
3e473cb239
commit
7dbe0615af
1 changed files with 0 additions and 6 deletions
|
@ -16,11 +16,9 @@ package google.registry.beam.invoicing;
|
||||||
|
|
||||||
import google.registry.beam.invoicing.BillingEvent.InvoiceGroupingKey;
|
import google.registry.beam.invoicing.BillingEvent.InvoiceGroupingKey;
|
||||||
import google.registry.beam.invoicing.BillingEvent.InvoiceGroupingKey.InvoiceGroupingKeyCoder;
|
import google.registry.beam.invoicing.BillingEvent.InvoiceGroupingKey.InvoiceGroupingKeyCoder;
|
||||||
import google.registry.config.CredentialModule.LocalCredential;
|
|
||||||
import google.registry.config.RegistryConfig.Config;
|
import google.registry.config.RegistryConfig.Config;
|
||||||
import google.registry.reporting.billing.BillingModule;
|
import google.registry.reporting.billing.BillingModule;
|
||||||
import google.registry.reporting.billing.GenerateInvoicesAction;
|
import google.registry.reporting.billing.GenerateInvoicesAction;
|
||||||
import google.registry.util.GoogleCredentialsBundle;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.apache.beam.runners.dataflow.DataflowRunner;
|
import org.apache.beam.runners.dataflow.DataflowRunner;
|
||||||
|
@ -81,9 +79,6 @@ public class InvoicingPipeline implements Serializable {
|
||||||
@Config("invoiceFilePrefix")
|
@Config("invoiceFilePrefix")
|
||||||
String invoiceFilePrefix;
|
String invoiceFilePrefix;
|
||||||
|
|
||||||
@Inject @LocalCredential
|
|
||||||
GoogleCredentialsBundle credentialsBundle;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
InvoicingPipeline() {}
|
InvoicingPipeline() {}
|
||||||
|
|
||||||
|
@ -105,7 +100,6 @@ public class InvoicingPipeline implements Serializable {
|
||||||
public void deploy() {
|
public void deploy() {
|
||||||
// We can't store options as a member variable due to serialization concerns.
|
// We can't store options as a member variable due to serialization concerns.
|
||||||
InvoicingPipelineOptions options = PipelineOptionsFactory.as(InvoicingPipelineOptions.class);
|
InvoicingPipelineOptions options = PipelineOptionsFactory.as(InvoicingPipelineOptions.class);
|
||||||
options.setGcpCredential(credentialsBundle.getGoogleCredentials());
|
|
||||||
options.setProject(projectId);
|
options.setProject(projectId);
|
||||||
options.setRunner(DataflowRunner.class);
|
options.setRunner(DataflowRunner.class);
|
||||||
// This causes p.run() to stage the pipeline as a template on GCS, as opposed to running it.
|
// This causes p.run() to stage the pipeline as a template on GCS, as opposed to running it.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue