[ https://issues.apache.org/jira/browse/BEAM-2524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16338250#comment-16338250 ]
ASF GitHub Bot commented on BEAM-2524: -------------------------------------- tgroh closed pull request #4473: [BEAM-2524] Update the gcloud cancel command to include the --region flag URL: https://github.com/apache/beam/pull/4473 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/MonitoringUtil.java b/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/MonitoringUtil.java index cf464066c12..42788b52f57 100644 --- a/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/MonitoringUtil.java +++ b/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/MonitoringUtil.java @@ -214,8 +214,9 @@ public static String getGcloudCancelCommand(DataflowPipelineOptions options, Str } // Assemble cancel command from optional prefix and project/job parameters. - return String.format("%s%s jobs --project=%s cancel %s", - dataflowApiOverridePrefix, GCLOUD_DATAFLOW_PREFIX, options.getProject(), jobId); + return String.format("%s%s jobs --project=%s cancel --region=%s %s", + dataflowApiOverridePrefix, GCLOUD_DATAFLOW_PREFIX, options.getProject(), + options.getRegion(), jobId); } public static State toState(String stateName) { diff --git a/runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/util/MonitoringUtilTest.java b/runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/util/MonitoringUtilTest.java index 499198221a7..1f75af13982 100644 --- a/runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/util/MonitoringUtilTest.java +++ b/runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/util/MonitoringUtilTest.java @@ -49,6 +49,7 @@ @RunWith(JUnit4.class) public class MonitoringUtilTest { private static final String PROJECT_ID = "someProject"; + private static final String REGION_ID = "thatRegion"; private static final String JOB_ID = "1234"; @Rule public ExpectedLogs expectedLogs = ExpectedLogs.none(LoggingHandler.class); @@ -119,9 +120,11 @@ public void testDontOverrideEndpointWithDefaultApi() { DataflowPipelineOptions options = PipelineOptionsFactory.create().as(DataflowPipelineOptions.class); options.setProject(PROJECT_ID); + options.setRegion(REGION_ID); options.setGcpCredential(new TestCredential()); String cancelCommand = MonitoringUtil.getGcloudCancelCommand(options, JOB_ID); - assertEquals("gcloud dataflow jobs --project=someProject cancel 1234", cancelCommand); + assertEquals("gcloud dataflow jobs --project=someProject cancel --region=thatRegion 1234", + cancelCommand); } @Test @@ -129,13 +132,14 @@ public void testOverridesEndpointWithStagedDataflowEndpoint() { DataflowPipelineOptions options = PipelineOptionsFactory.create().as(DataflowPipelineOptions.class); options.setProject(PROJECT_ID); + options.setRegion(REGION_ID); options.setGcpCredential(new TestCredential()); String stagingDataflowEndpoint = "v0neverExisted"; options.setDataflowEndpoint(stagingDataflowEndpoint); String cancelCommand = MonitoringUtil.getGcloudCancelCommand(options, JOB_ID); assertEquals( "CLOUDSDK_API_ENDPOINT_OVERRIDES_DATAFLOW=https://dataflow.googleapis.com/v0neverExisted/ " - + "gcloud dataflow jobs --project=someProject cancel 1234", + + "gcloud dataflow jobs --project=someProject cancel --region=thatRegion 1234", cancelCommand); } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Update Google Cloud Console URL returned by DataflowRunner to support regions. > ------------------------------------------------------------------------------ > > Key: BEAM-2524 > URL: https://issues.apache.org/jira/browse/BEAM-2524 > Project: Beam > Issue Type: Improvement > Components: runner-dataflow > Reporter: Robert Burke > Assignee: Robert Burke > Priority: Major > Fix For: 2.2.0 > > Original Estimate: 24h > Remaining Estimate: 24h > > Both the Java and Python Dataflow Runners need to be updated with a > regionalized form of the Google Cloud Console URL to support multiple > Dataflow Regions. > The new URL format will be: > https://console.cloud.corp.google.com/dataflow/jobsDetail/locations/<regionId>/jobs/<jobId>?project=<projectId> -- This message was sent by Atlassian JIRA (v7.6.3#76005)