Skip to content

Commit

Permalink
Changed the logic for error file download
Browse files Browse the repository at this point in the history
  • Loading branch information
datasetutil committed Jul 21, 2015
1 parent a87b941 commit 2cfbb99
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,24 @@ public static void getJobsAndErrorFiles(PartnerConnection partnerConnection, Str
{
if(cnt>4)
break;
getJobErrorFile(partnerConnection, datasetName, job._uid);
if(job.getType().equalsIgnoreCase("system") && (job.getStatus()==JobEntry.FAILED || job.getStatus()==JobEntry.WARNING))
{
List<NodeEntry> nodes = DataFlowMonitorUtil.getDataFlowJobNodes(partnerConnection, job.getNodeUrl());
for(NodeEntry node:nodes)
{
if(node.getNodeType() != null && (node.getNodeType().equalsIgnoreCase("csvDigest") || node.getNodeType().equalsIgnoreCase("binDigest")))
{
if(node.getOutputRowsFailed()>0)
{
File file = getJobErrorFile(partnerConnection, datasetName, job._uid);
if(file==null || !file.exists() || file.length() == 0)
{
System.out.println("Found job with {"+node.getOutputRowsFailed()+"} failures but no error file");
}
}
}
}
}
cnt++;
}
}
Expand Down Expand Up @@ -264,7 +281,18 @@ public static List<NodeEntry> getDataFlowJobNodes(PartnerConnection partnerConne
nodeEntry.startTime = (String) job.get("startTime");

nodeEntry._uid = (String) job.get("_uid");
nodeEntry.duration = (String) job.get("duration");
Object temp = job.get("duration");
if(temp != null)
{
if(temp instanceof Number)
{
nodeEntry.duration = ((Number)temp).longValue();
}else
{
BigDecimal bd = new BigDecimal(temp.toString());
nodeEntry.duration = bd.longValue();
}
}

nodeEntry.nodeName = (String) job.get("nodeName");

Expand All @@ -274,7 +302,7 @@ public static List<NodeEntry> getDataFlowJobNodes(PartnerConnection partnerConne

nodeEntry.status = (String) job.get("status");

Object temp = job.get("outputRowsFailed");
temp = job.get("outputRowsFailed");
if(temp != null)
{
if(temp instanceof Number)
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/sforce/dataset/flow/monitor/JobEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@
package com.sforce.dataset.flow.monitor;

public class JobEntry implements Comparable<JobEntry> {
String errorMessage = null;

public static final Integer SUCCESS = 1;
public static final Integer FAILED = 0;
public static final Integer RUNNING = 2;
public static final Integer QUEUED = 4;
public static final Integer WARNING = 5;

String errorMessage = null;
long startTimeEpoch = 0;

int status = 0;
long endTimeEpoch = 0;
String _uid = null;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/sforce/dataset/flow/monitor/NodeEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class NodeEntry {
String startTime = null;// : Tue Mar 03 00:41:36 GMT 2015
String _type = null;// : nodes
String duration = null;// : 0 hours, 0 minutes
long duration = 0;// : 0 hours, 0 minutes
String status = null;// : success
long outputRowsFailed = 0;// : 5
long outputRowsProcessed = 0; // : 17934
Expand All @@ -42,7 +42,7 @@ public String getStartTime() {
public String get_type() {
return _type;
}
public String getDuration() {
public long getDuration() {
return duration;
}
public String getStatus() {
Expand Down

0 comments on commit 2cfbb99

Please sign in to comment.