[
https://issues.apache.org/jira/browse/BEAM-6197?focusedWorklogId=176772&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-176772
]
ASF GitHub Bot logged work on BEAM-6197:
----------------------------------------
Author: ASF GitHub Bot
Created on: 18/Dec/18 22:11
Start Date: 18/Dec/18 22:11
Worklog Time Spent: 10m
Work Description: aaltay closed pull request #7235: [BEAM-6197] Log time
for Dataflow GCS upload of staged files + add a test program
URL: https://github.com/apache/beam/pull/7235
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/build.gradle
b/runners/google-cloud-dataflow-java/build.gradle
index c0b831c6e547..572136c45f76 100644
--- a/runners/google-cloud-dataflow-java/build.gradle
+++ b/runners/google-cloud-dataflow-java/build.gradle
@@ -109,6 +109,8 @@ test {
def dataflowProject = project.findProperty('dataflowProject') ?:
'apache-beam-testing'
def dataflowValidatesTempRoot = project.findProperty('dataflowTempRoot') ?:
'gs://temp-storage-for-validates-runner-tests/'
def dataflowPostCommitTempRoot = project.findProperty('dataflowTempRoot') ?:
'gs://temp-storage-for-end-to-end-tests'
+def dataflowUploadTemp = project.findProperty('dataflowTempRoot') ?:
'gs://temp-storage-for-upload-tests'
+def testFilesToStage = project.findProperty('filesToStage') ?: 'test.txt'
def dataflowLegacyWorkerJar = project.findProperty('dataflowWorkerJar') ?:
project(":beam-runners-google-cloud-dataflow-java-legacy-worker").shadowJar.archivePath
def dataflowFnApiWorkerJar = project.findProperty('dataflowWorkerJar') ?:
project(":beam-runners-google-cloud-dataflow-java-fn-api-worker").shadowJar.archivePath
@@ -440,3 +442,11 @@ createJavaExamplesArchetypeValidationTask(type:
'MobileGaming',
gcsBucket: gcsBucket,
bqDataset: bqDataset,
pubsubTopic: pubsubTopic)
+
+// Standalone task for testing GCS upload, use with -PfilesToStage and
-PdataflowTempRoot.
+task GCSUpload(type: JavaExec) {
+ main = 'org.apache.beam.runners.dataflow.util.GCSUploadMain'
+ classpath = sourceSets.test.runtimeClasspath
+ args "--stagingLocation=${dataflowUploadTemp}/staging",
+ "--filesToStage=${testFilesToStage}"
+}
diff --git
a/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/PackageUtil.java
b/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/PackageUtil.java
index a8fba4bab676..b919922a1f5e 100644
---
a/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/PackageUtil.java
+++
b/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/util/PackageUtil.java
@@ -64,6 +64,8 @@
import org.apache.beam.sdk.util.MoreFutures;
import org.apache.beam.sdk.util.ZipFiles;
import org.joda.time.Duration;
+import org.joda.time.Instant;
+import org.joda.time.Seconds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -316,6 +318,7 @@ public DataflowPackage stageToFile(
"Uploading {} files from PipelineOptions.filesToStage to staging
location to "
+ "prepare for execution.",
classpathElements.size());
+ Instant start = Instant.now();
if (classpathElements.size() > SANE_CLASSPATH_SIZE) {
LOG.warn(
@@ -386,10 +389,12 @@ public DataflowPackage stageToFile(
}
} while (!finished);
List<DataflowPackage> stagedPackages = MoreFutures.get(stagingFutures);
+ Instant done = Instant.now();
LOG.info(
- "Staging files complete: {} files cached, {} files newly uploaded",
+ "Staging files complete: {} files cached, {} files newly uploaded in
{} seconds",
numCached.get(),
- numUploaded.get());
+ numUploaded.get(),
+ Seconds.secondsBetween(start, done).getSeconds());
return stagedPackages;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
diff --git
a/runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/util/GCSUploadMain.java
b/runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/util/GCSUploadMain.java
new file mode 100644
index 000000000000..1783fd63f026
--- /dev/null
+++
b/runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/util/GCSUploadMain.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.dataflow.util;
+
+import org.apache.beam.runners.dataflow.options.DataflowPipelineOptions;
+import org.apache.beam.sdk.io.FileSystems;
+import org.apache.beam.sdk.options.PipelineOptionsFactory;
+
+/** Standalone program to upload files to GCS, for testing in isolation. */
+public class GCSUploadMain {
+ public static void main(String[] args) {
+ DataflowPipelineOptions options =
+
PipelineOptionsFactory.fromArgs(args).as(DataflowPipelineOptions.class);
+ FileSystems.setDefaultPipelineOptions(options);
+ GcsStager stager = GcsStager.fromOptions(options);
+ stager.stageFiles(options.getFilesToStage());
+ }
+}
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 176772)
Time Spent: 3h 10m (was: 3h)
> Log time for Dataflow GCS upload of staged files
> ------------------------------------------------
>
> Key: BEAM-6197
> URL: https://issues.apache.org/jira/browse/BEAM-6197
> Project: Beam
> Issue Type: Improvement
> Components: runner-dataflow
> Reporter: Alan Myrvold
> Assignee: Alan Myrvold
> Priority: Minor
> Time Spent: 3h 10m
> Remaining Estimate: 0h
>
> Would be nice to collect timing in the logs of Dataflow GCS upload of staged
> files
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)