bring the script info back for lineage job tab

This commit is contained in:
jbai 2016-05-12 15:50:35 -07:00 committed by Mars Lan
parent e873b1f1e2
commit 465559f886
2 changed files with 27 additions and 8 deletions

View File

@ -148,7 +148,8 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
private final static String GET_OBJECT_NAME_BY_MAPPED_NAME = "SELECT object_name " +
"FROM cfg_object_name_map WHERE mapped_object_name = ?";
private final static String GET_GIT_LOCATION_BY_JOB_ID = "SELECT script_url " +
private final static String GET_SCRIPT_INFO_BY_JOB_ID = "SELECT script_url, " +
"script_name, script_path, script_type " +
"FROM job_execution_script WHERE app_id = ? and job_id = ? LIMIT 1";
@ -501,20 +502,23 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
return results;
}
public static String getGitLocation(int appId, Long jobId)
public static ScriptInfo getScriptInfo(int appId, Long jobId)
{
List<Map<String, Object>> rows = null;
String location = "";
rows = getJdbcTemplate().queryForList(GET_GIT_LOCATION_BY_JOB_ID, appId, jobId);
ScriptInfo scriptInfo = new ScriptInfo();
rows = getJdbcTemplate().queryForList(GET_SCRIPT_INFO_BY_JOB_ID, appId, jobId);
if (rows != null)
{
for (Map row : rows)
{
location = (String)row.get("script_url");
scriptInfo.gitPath = (String)row.get("script_url");
scriptInfo.scriptName = (String)row.get("script_name");
scriptInfo.scriptPath = (String)row.get("script_path");
scriptInfo.scriptType = (String)row.get("script_type");
break;
}
}
return location;
return scriptInfo;
}
public static void getNodes(
@ -606,7 +610,11 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
node.application_id = (Integer)row.get("app_id");
node.job_id = (Long)row.get("job_id");
node.operation = (String) row.get("operation");
node.git_location = getGitLocation(node.application_id, node.job_id);
ScriptInfo scriptInfo = getScriptInfo(node.application_id, node.job_id);
node.git_location = scriptInfo.gitPath;
node.script_name = scriptInfo.scriptName;
node.script_path = scriptInfo.scriptPath;
node.script_type = scriptInfo.scriptType;
node.source_target_type = (String) row.get("source_target_type");
node.level = level;
node._sort_list.add("cluster");
@ -615,6 +623,9 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
node._sort_list.add("job_type");
node._sort_list.add("job_start_time");
node._sort_list.add("job_end_time");
node._sort_list.add("script_name");
node._sort_list.add("script_path");
node._sort_list.add("script_type");
node._sort_list.add("exec_id");
node._sort_list.add("job_id");
addedJobNodes.put(jobExecId, node);
@ -939,7 +950,11 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
node.pre_jobs = (String)row.get("pre_jobs");
node.post_jobs = (String)row.get("post_jobs");
node.job_id = (Long)row.get("job_id");
node.git_location = getGitLocation(appID, node.job_id);
ScriptInfo scriptInfo = getScriptInfo(node.application_id, node.job_id);
node.git_location = scriptInfo.gitPath;
node.script_name = scriptInfo.scriptName;
node.script_path = scriptInfo.scriptPath;
node.script_type = scriptInfo.scriptType;
node.job_start_time = row.get("start_time").toString();
node.job_end_time = row.get("end_time").toString();
node.exec_id = jobExecId;
@ -950,6 +965,9 @@ public class LineageDAO extends AbstractMySQLOpenSourceDAO
node._sort_list.add("job_id");
node._sort_list.add("job_start_time");
node._sort_list.add("job_end_time");
node._sort_list.add("script_name");
node._sort_list.add("script_path");
node._sort_list.add("script_type");
Integer id = addedJobNodes.get(jobExecId);
if (id == null)
{

View File

@ -29,6 +29,7 @@ public class LineageNode {
public String job_name;
public String script_name;
public String script_path;
public String script_type;
public String job_start_time;
public String job_end_time;
public Long job_start_unix_time;