crunch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwi...@apache.org
Subject git commit: CRUNCH-374: Switch no-output default PipelineResult to DONE instead of EMPTY. Contributed by Nathan Barry.
Date Tue, 15 Apr 2014 00:23:47 GMT
Repository: crunch
Updated Branches:
  refs/heads/master 69896816b -> d0fefe729


CRUNCH-374: Switch no-output default PipelineResult to DONE instead of EMPTY. Contributed
by Nathan Barry.

Signed-off-by: Josh Wills <jwills@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/crunch/repo
Commit: http://git-wip-us.apache.org/repos/asf/crunch/commit/d0fefe72
Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/d0fefe72
Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/d0fefe72

Branch: refs/heads/master
Commit: d0fefe729fc64967cdc2e27fcf973bd97697096b
Parents: 6989681
Author: Nathan Barry <nbarry@cerner.com>
Authored: Mon Apr 14 17:32:57 2014 -0500
Committer: Josh Wills <jwills@apache.org>
Committed: Mon Apr 14 16:31:17 2014 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/crunch/PipelineResult.java  |  1 +
 .../org/apache/crunch/impl/dist/DistributedPipeline.java |  2 +-
 .../java/org/apache/crunch/impl/mr/MRPipelineTest.java   | 11 ++++++++++-
 3 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/crunch/blob/d0fefe72/crunch-core/src/main/java/org/apache/crunch/PipelineResult.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/main/java/org/apache/crunch/PipelineResult.java b/crunch-core/src/main/java/org/apache/crunch/PipelineResult.java
index 5325bf3..8895b80 100644
--- a/crunch-core/src/main/java/org/apache/crunch/PipelineResult.java
+++ b/crunch-core/src/main/java/org/apache/crunch/PipelineResult.java
@@ -173,6 +173,7 @@ public class PipelineResult {
   }
 
   public static final PipelineResult EMPTY = new PipelineResult(ImmutableList.<StageResult>
of(), PipelineExecution.Status.READY);
+  public static final PipelineResult DONE = new PipelineResult(ImmutableList.<StageResult>
of(), PipelineExecution.Status.SUCCEEDED);
 
   private final List<StageResult> stageResults;
 

http://git-wip-us.apache.org/repos/asf/crunch/blob/d0fefe72/crunch-core/src/main/java/org/apache/crunch/impl/dist/DistributedPipeline.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/main/java/org/apache/crunch/impl/dist/DistributedPipeline.java
b/crunch-core/src/main/java/org/apache/crunch/impl/dist/DistributedPipeline.java
index 82517f3..e595a72 100644
--- a/crunch-core/src/main/java/org/apache/crunch/impl/dist/DistributedPipeline.java
+++ b/crunch-core/src/main/java/org/apache/crunch/impl/dist/DistributedPipeline.java
@@ -107,7 +107,7 @@ public abstract class DistributedPipeline implements Pipeline {
 
   @Override
   public PipelineResult done() {
-    PipelineResult res = PipelineResult.EMPTY;
+    PipelineResult res = PipelineResult.DONE;
     if (!outputTargets.isEmpty()) {
       res = run();
     }

http://git-wip-us.apache.org/repos/asf/crunch/blob/d0fefe72/crunch-core/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java
----------------------------------------------------------------------
diff --git a/crunch-core/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java b/crunch-core/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java
index d04b62b..1efa0f6 100644
--- a/crunch-core/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java
+++ b/crunch-core/src/test/java/org/apache/crunch/impl/mr/MRPipelineTest.java
@@ -18,12 +18,15 @@
 package org.apache.crunch.impl.mr;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import java.io.IOException;
 
+import org.apache.crunch.PipelineExecution;
+import org.apache.crunch.PipelineResult;
 import org.apache.crunch.SourceTarget;
 import org.apache.crunch.impl.dist.collect.PCollectionImpl;
 import org.apache.crunch.impl.mr.run.RuntimeParameters;
@@ -38,7 +41,6 @@ import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
 
-
 @RunWith(MockitoJUnitRunner.class)
 public class MRPipelineTest {
   @Rule
@@ -83,4 +85,11 @@ public class MRPipelineTest {
     pipeline.getMaterializeSourceTarget(pcollection);
   }
 
+  @Test
+  public void testDonePipeline_NoOutputTargets() {
+    PipelineResult res = pipeline.done();
+    assertTrue(res.succeeded());
+    assertEquals(PipelineExecution.Status.SUCCEEDED,res.status);
+  }
+
 }


Mime
View raw message