beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-4290) ArtifactStagingService that stages to a distributed filesystem
Date Tue, 12 Jun 2018 16:44:00 GMT

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

ASF GitHub Bot logged work on BEAM-4290:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Jun/18 16:43
            Start Date: 12/Jun/18 16:43
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on a change in pull request #5591: [BEAM-4290]
Beam File System based ArtifactStagingService
URL: https://github.com/apache/beam/pull/5591#discussion_r194810545
 
 

 ##########
 File path: runners/java-fn-execution/src/test/java/org/apache/beam/runners/fnexecution/artifact/BeamFileSystemArtifactStagingServiceTest.java
 ##########
 @@ -251,17 +258,129 @@ public void putArtifactsMultipleFilesTest() throws Exception {
     assertFiles(files.keySet(), stagingToken);
   }
 
+  @Test
+  public void putArtifactsMultipleFilesConcurrentlyTest() throws Exception {
+    String stagingSession = "123";
+    Map<String, Integer> files = new HashMap<>();
+    files.put("file5cb", (DATA_1KB / 2) /*500b*/);
+    files.put("file1kb", DATA_1KB /*1 kb*/);
+    files.put("file15cb", (DATA_1KB * 3) / 2  /*1.5 kb*/);
+    files.put("nested/file1kb", DATA_1KB /*1 kb*/);
+    files.put("file10kb", 10 * DATA_1KB /*10 kb*/);
+    files.put("file100kb", 100 * DATA_1KB /*100 kb*/);
+
+    final String text = "abcdefghinklmop\n";
+    files.forEach((fileName, size) -> {
+      Path filePath = Paths.get(srcDir.toString(), fileName).toAbsolutePath();
+      try {
+        Files.createDirectories(filePath.getParent());
+        Files.write(filePath,
+            Strings.repeat(text, Double.valueOf(Math.ceil(size * 1.0 / text.length())).intValue())
+                .getBytes(CHARSET));
+      } catch (IOException ignored) {
+      }
+    });
+    String stagingSessionToken = BeamFileSystemArtifactStagingService
+        .generateStagingSessionToken(stagingSession, destDir.toUri().getPath());
+
+    List<ArtifactMetadata> metadata = new ArrayList<>();
+    ExecutorService executorService = Executors.newFixedThreadPool(8);
+    try {
+      for (String fileName : files.keySet()) {
+        executorService.execute(() -> {
+          try {
+            putArtifact(stagingSessionToken,
+                Paths.get(srcDir.toString(), fileName).toAbsolutePath().toString(), fileName);
+          } catch (Exception e) {
+            Assert.fail(e.getMessage());
+          }
+          metadata.add(ArtifactMetadata.newBuilder().setName(fileName).build());
+        });
+      }
+    } finally {
+      executorService.shutdown();
+      executorService.awaitTermination(2, TimeUnit.SECONDS);
+    }
+
+    String stagingToken = commitManifest(stagingSessionToken, metadata);
+    Assert.assertEquals(
+        Paths.get(destDir.toAbsolutePath().toString(), stagingSession, "MANIFEST").toString(),
+        stagingToken);
+    assertFiles(files.keySet(), stagingToken);
+  }
+
+  @Test
+  public void putArtifactsMultipleFilesConcurrentSessionsTest() throws Exception {
+    String stagingSession1 = "123";
+    String stagingSession2 = "abc";
+    Map<String, Integer> files = new HashMap<>();
+    files.put("file5cb", (DATA_1KB / 2) /*500b*/);
+    files.put("file1kb", DATA_1KB /*1 kb*/);
+    files.put("file15cb", (DATA_1KB * 3) / 2  /*1.5 kb*/);
+    files.put("nested/file1kb", DATA_1KB /*1 kb*/);
+    files.put("file10kb", 10 * DATA_1KB /*10 kb*/);
+    files.put("file100kb", 100 * DATA_1KB /*100 kb*/);
+
+    final String text = "abcdefghinklmop\n";
+    files.forEach((fileName, size) -> {
+      Path filePath = Paths.get(srcDir.toString(), fileName).toAbsolutePath();
+      try {
+        Files.createDirectories(filePath.getParent());
+        Files.write(filePath,
+            Strings.repeat(text, Double.valueOf(Math.ceil(size * 1.0 / text.length())).intValue())
+                .getBytes(CHARSET));
+      } catch (IOException ignored) {
+      }
+    });
+    String stagingSessionToken1 = BeamFileSystemArtifactStagingService
+        .generateStagingSessionToken(stagingSession1, destDir.toUri().getPath());
+    String stagingSessionToken2 = BeamFileSystemArtifactStagingService
+        .generateStagingSessionToken(stagingSession2, destDir.toUri().getPath());
+
+    List<ArtifactMetadata> metadata = new ArrayList<>();
+    ExecutorService executorService = Executors.newFixedThreadPool(8);
+    try {
+      for (String fileName : files.keySet()) {
+        executorService.execute(() -> {
+          try {
+            putArtifact(stagingSessionToken1,
 
 Review comment:
   I was actually thinking of something much simpler, i.e upload file 1a, upload file 2a,
upload file 1b, check, but this should have the same coverage. 

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 111119)
    Time Spent: 14h 50m  (was: 14h 40m)

> ArtifactStagingService that stages to a distributed filesystem
> --------------------------------------------------------------
>
>                 Key: BEAM-4290
>                 URL: https://issues.apache.org/jira/browse/BEAM-4290
>             Project: Beam
>          Issue Type: Sub-task
>          Components: runner-core
>            Reporter: Eugene Kirpichov
>            Assignee: Ankur Goenka
>            Priority: Major
>          Time Spent: 14h 50m
>  Remaining Estimate: 0h
>
> Using the job's staging directory from PipelineOptions.
> Physical layout on the distributed filesystem is TBD but it should allow for arbitrary
filenames and ideally for eventually avoiding uploading artifacts that are already there.
> Handling credentials is TBD.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message