Review Board 1.7.22


SQOOP-679 Wrap exception to MSubmission metadata object

Review Request #7882 - Created Nov. 5, 2012 and submitted

Jarek Cecho
SQOOP-679
Reviewers
Sqoop
sqoop-sqoop2
I've extended MSubmission structure by exception info and exception stack trace.
I've added additional tests to TestSubmissionBean test case and also perform life testing on my test box.
client/src/main/java/org/apache/sqoop/client/utils/SubmissionDisplayer.java
Revision d4d682587e6d4b31d218f1f472a9161faab676fa New Change
[20] 15 lines
[+20]
16
 * limitations under the License.
16
 * limitations under the License.
17
 */
17
 */
18
package org.apache.sqoop.client.utils;
18
package org.apache.sqoop.client.utils;
19

    
   
19

   
20
import org.apache.sqoop.model.MSubmission;
20
import org.apache.sqoop.model.MSubmission;

    
   
21
import org.apache.sqoop.submission.SubmissionStatus;
21
import org.apache.sqoop.submission.counter.Counter;
22
import org.apache.sqoop.submission.counter.Counter;
22
import org.apache.sqoop.submission.counter.CounterGroup;
23
import org.apache.sqoop.submission.counter.CounterGroup;
23
import org.apache.sqoop.submission.counter.Counters;
24
import org.apache.sqoop.submission.counter.Counters;
24
import org.codehaus.groovy.tools.shell.IO;
25
import org.codehaus.groovy.tools.shell.IO;
25

    
   
26

   
[+20] [20] 7 lines
[+20] [+] public static void display(IO io, MSubmission submission) {
33

    
   
34

   
34
    io.out.print("Job id: ");
35
    io.out.print("Job id: ");
35
    io.out.println(submission.getJobId());
36
    io.out.println(submission.getJobId());
36

    
   
37

   
37
    io.out.print("Status: ");
38
    io.out.print("Status: ");
38
    io.out.println(submission.getStatus());
39
    printColoredStatus(io, submission.getStatus());

    
   
40
    io.out.println();
39

    
   
41

   
40
    String externalId = submission.getExternalId();
42
    String externalId = submission.getExternalId();
41
    if(externalId != null) {
43
    if(externalId != null) {
42
      io.out.print("External Id: ");
44
      io.out.print("External Id: ");
43
      io.out.println(externalId);
45
      io.out.println(externalId);
[+20] [20] 26 lines
[+20] public static void display(IO io, MSubmission submission) {
70
          io.out.print(": ");
72
          io.out.print(": ");
71
          io.out.println(counter.getValue());
73
          io.out.println(counter.getValue());
72
        }
74
        }
73
      }
75
      }
74
    }
76
    }

    
   
77

   

    
   
78
    // Exception handling

    
   
79
    if(submission.getExceptionInfo() != null) {

    
   
80
      io.out.print("@|red Exception: |@");

    
   
81
      io.out.println(submission.getExceptionInfo());

    
   
82

   

    
   
83
      if(submission.getExceptionStackTrace() != null) {

    
   
84
        io.out.print("@|bold Stack trace: |@");

    
   
85
        io.out.println(submission.getExceptionStackTrace());

    
   
86
      }

    
   
87
    }

    
   
88
  }

    
   
89

   

    
   
90
  public static void printColoredStatus(IO io, SubmissionStatus status) {

    
   
91
    if(status.isRunning()) {

    
   
92
      io.out.print("@|green " + status.toString() + " |@");

    
   
93
    } else if(status.isFailure()) {

    
   
94
      io.out.print("@|red " + status.toString() + " |@");

    
   
95
    } else {

    
   
96
      io.out.print(status.toString());

    
   
97
    }
75
  }
98
  }
76
}
99
}
common/src/main/java/org/apache/sqoop/json/SubmissionBean.java
Revision d7188f47ed206d196df97f5bebf64d9c0f9f1ee2 New Change
 
common/src/main/java/org/apache/sqoop/model/MSubmission.java
Revision f8ca32efa67f0010571363e88407c29088927b38 New Change
 
common/src/main/java/org/apache/sqoop/submission/SubmissionStatus.java
Revision 025690a1a79fdd2180b08474fb953276dda68daa New Change
 
common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java
Revision 9c5e0438261b5c11f3e2da9c139a896f70e7cb65 New Change
 
submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java
Revision 704992456ddb27f32c23b49b204f9d5406416409 New Change
 
  1. client/src/main/java/org/apache/sqoop/client/utils/SubmissionDisplayer.java: Loading...
  2. common/src/main/java/org/apache/sqoop/json/SubmissionBean.java: Loading...
  3. common/src/main/java/org/apache/sqoop/model/MSubmission.java: Loading...
  4. common/src/main/java/org/apache/sqoop/submission/SubmissionStatus.java: Loading...
  5. common/src/test/java/org/apache/sqoop/json/TestSubmissionBean.java: Loading...
  6. submission/mapreduce/src/main/java/org/apache/sqoop/submission/mapreduce/MapreduceSubmissionEngine.java: Loading...