BundleJobBean:
mysql> desc BUNDLE_JOBS;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | varchar(255) | NO | PRI | NULL | |
app_name | varchar(255) | YES | NULL | ||
app_path | varchar(255) | YES | NULL | ||
conf | mediumblob | YES | NULL | ||
created_time | datetime | YES | MUL | NULL | |
end_time | datetime | YES | NULL | ||
external_id | varchar(255) | YES | NULL | ||
group_name | varchar(255) | YES | NULL | ||
job_xml | mediumblob | YES | NULL | ||
kickoff_time | datetime | YES | NULL | ||
last_modified_time | datetime | YES | MUL | NULL | |
orig_job_xml | mediumblob | YES | NULL | ||
pause_time | datetime | YES | NULL | ||
pending | int(11) | YES | NULL | ||
start_time | datetime | YES | NULL | ||
status | varchar(255) | YES | MUL | NULL | |
suspended_time | datetime | YES | MUL | NULL | |
time_out | int(11) | YES | NULL | ||
time_unit | varchar(255) | YES | NULL | ||
user_name | varchar(255) | YES | NULL |
Java Entity-Mapper:
@Table(name = "BUNDLE_JOBS")
public class BundleJobBean implements Writable, BundleJob, JsonBean {
@Id
private String id;
@Basic
@Column(name = "app_path")
private String appPath = null;
@Basic
@Column(name = "app_name")
private String appName = null;
@Basic
@Column(name = "external_id")
private String externalId = null;
@Basic
@Column(name = "conf")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob conf;
@Basic
@Column(name = "time_out")
private int timeOut = 0;
@Basic
@Column(name = "user_name")
private String user = null;
@Basic
@Column(name = "group_name")
private String group = null;
@Transient
private String consoleUrl;
@Basic
@Index
@Column(name = "status")
private String statusStr = Job.Status.PREP.toString();
@Basic
@Column(name = "kickoff_time")
private java.sql.Timestamp kickoffTimestamp = null;
@Basic
@Column(name = "start_time")
private java.sql.Timestamp startTimestamp = null;
@Basic
@Column(name = "end_time")
private java.sql.Timestamp endTimestamp = null;
@Basic
@Column(name = "pause_time")
private java.sql.Timestamp pauseTimestamp = null;
@Basic
@Index
@Column(name = "created_time")
private java.sql.Timestamp createdTimestamp = null;
@Basic
@Column(name = "time_unit")
private String timeUnitStr = BundleJob.Timeunit.NONE.toString();
@Basic
@Column(name = "pending")
private int pending = 0;
@Basic
@Index
@Column(name = "last_modified_time")
private java.sql.Timestamp lastModifiedTimestamp = null;
@Basic
@Index
@Column(name = "suspended_time")
private java.sql.Timestamp suspendedTimestamp = null;
@Basic
@Column(name = "job_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob jobXml;
@Basic
@Column(name = "orig_job_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob origJobXml = null;
@Transient
private List coordJobs;
UPDATE_BUNDLE_JOB: query = "update BundleJobBean w set w.appName = :appName, w.appPath = :appPath, w.conf = :conf, w.externalId = :externalId, w.timeOut = :timeOut, w.createdTimestamp = :createdTime, w.endTimestamp = :endTime, w.jobXml = :jobXml, w.lastModifiedTimestamp = :lastModifiedTime, w.origJobXml = :origJobXml, w.startTimestamp = :startTime, w.statusStr = :status, w.timeUnitStr = :timeUnit, w.pending = :pending where w.id = :id"),
UPDATE_BUNDLE_JOB_STATUS: query = "update BundleJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending where w.id = :id"),
UPDATE_BUNDLE_JOB_STATUS_PENDING: query = "update BundleJobBean w set w.statusStr = :status, w.pending = :pending where w.id = :id"),
UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME: query = "update BundleJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending where w.id = :id"),
UPDATE_BUNDLE_JOB_STATUS_PENDING_SUSP_MOD_TIME: query = "update BundleJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending, w.suspendedTimestamp = :suspendedTime where w.id = :id"),
UPDATE_BUNDLE_JOB_STATUS_PAUSE_ENDTIME: query = "update BundleJobBean w set w.statusStr = :status, w.pauseTimestamp = :pauseTime, w.endTimestamp = :endTime where w.id = :id"),
UPDATE_BUNDLE_JOB_PAUSE_KICKOFF: query = "update BundleJobBean w set w.kickoffTimestamp = :kickoffTime, w.pauseTimestamp = :pauseTime where w.id = :id"),
DELETE_BUNDLE_JOB: query = "delete from BundleJobBean w where w.id IN (:id)"),
GET_BUNDLE_JOBS: query = "select OBJECT(w) from BundleJobBean w"),
GET_BUNDLE_JOB: query = "select OBJECT(w) from BundleJobBean w where w.id = :id"),
GET_BUNDLE_JOB_STATUS: query = "select w.statusStr from BundleJobBean w where w.id = :id"),
GET_BUNDLE_JOB_ID_STATUS_PENDING_MODTIME: query = "select w.id, w.statusStr, w.pending, w.lastModifiedTimestamp from BundleJobBean w where w.id = :id"),
GET_BUNDLE_JOB_ID_JOBXML_CONF: query = "select w.id, w.jobXml, w.conf from BundleJobBean w where w.id = :id"),
GET_BUNDLE_JOBS_COUNT: query = "select count(w) from BundleJobBean w"),
GET_BUNDLE_JOBS_COLUMNS: query = "select w.id, w.appName, w.appPath, w.conf, w.statusStr, w.kickoffTimestamp, w.startTimestamp, w.endTimestamp, w.pauseTimestamp, w.createdTimestamp, w.user, w.group, w.timeUnitStr, w.timeOut from BundleJobBean w order by w.createdTimestamp desc"),
GET_BUNDLE_JOBS_RUNNING_OR_PENDING: query = "select OBJECT(w) from BundleJobBean w where w.statusStr = 'RUNNING' OR w.statusStr = 'RUNNINGWITHERROR' OR w.pending = 1 order by w.lastModifiedTimestamp"),
GET_BUNDLE_JOBS_NEED_START: query = "select OBJECT(w) from BundleJobBean w where w.statusStr = 'PREP' AND (w.kickoffTimestamp IS NULL OR (w.kickoffTimestamp IS NOT NULL AND w.kickoffTimestamp <= :currentTime)) order by w.lastModifiedTimestamp"),
GET_BUNDLE_JOBS_PAUSED: query = "select OBJECT(w) from BundleJobBean w where w.statusStr = 'PAUSED' OR w.statusStr = 'PAUSEDWITHERROR' OR w.statusStr = 'PREPPAUSED' order by w.lastModifiedTimestamp"),
GET_BUNDLE_JOBS_UNPAUSED: query = "select OBJECT(w) from BundleJobBean w where w.statusStr = 'RUNNING' OR w.statusStr = 'RUNNINGWITHERROR' OR w.statusStr = 'PREP' order by w.lastModifiedTimestamp"),
GET_BUNDLE_JOBS_OLDER_THAN: query = "select OBJECT(w) from BundleJobBean w where w.startTimestamp <= :matTime AND (w.statusStr = 'PREP' OR w.statusStr = 'RUNNING' or w.statusStr = 'RUNNINGWITHERROR') order by w.lastModifiedTimestamp"),
GET_BUNDLE_JOBS_OLDER_THAN_STATUS: query = "select OBJECT(w) from BundleJobBean w where w.statusStr = :status AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
GET_COMPLETED_BUNDLE_JOBS_OLDER_THAN: query = "select w.id from BundleJobBean w where ( w.statusStr = 'SUCCEEDED' OR w.statusStr = 'FAILED' OR w.statusStr = 'KILLED' OR w.statusStr = 'DONEWITHERROR') AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
BULK_MONITOR_BUNDLE_QUERY: query = "SELECT b.id, b.appName, b.statusStr, b.user FROM BundleJobBean b"),
// Join query
BULK_MONITOR_ACTIONS_QUERY: query = "SELECT a.id, a.actionNumber, a.errorCode, a.errorMessage, a.externalId, " +
"a.externalStatus, a.statusStr, a.createdTimestamp, a.nominalTimestamp, a.missingDependencies, " +
"c.id, c.appName, c.statusStr FROM CoordinatorActionBean a, CoordinatorJobBean c " +
"WHERE a.jobId = c.id AND c.bundleId = :bundleId ORDER BY a.jobId, a.createdTimestamp"),
BULK_MONITOR_COUNT_QUERY: query = "SELECT COUNT(a) FROM CoordinatorActionBean a, CoordinatorJobBean c"),
GET_BUNDLE_IDS_FOR_STATUS_TRANSIT: query = "select DISTINCT w.id from BundleActionBean a , BundleJobBean w where a.lastModifiedTimestamp >= :lastModifiedTime and w.id = a.bundleId and (w.statusStr = 'RUNNING' OR w.statusStr = 'RUNNINGWITHERROR' OR w.statusStr = 'PAUSED' OR w.statusStr = 'PAUSEDWITHERROR' OR w.pending = 1)"),
GET_BUNDLE_JOB_FOR_USER: query = "select w.user from BundleJobBean w where w.id = :id") })
BundleActionBean
mysql> desc BUNDLE_ACTIONS;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
bundle_action_id | varchar(255) | NO | PRI | NULL | |
bundle_id | varchar(255) | YES | MUL | NULL | |
coord_id | varchar(255) | YES | NULL | ||
coord_name | varchar(255) | YES | NULL | ||
critical | int(11) | YES | NULL | ||
last_modified_time | datetime | YES | NULL | ||
pending | int(11) | YES | NULL | ||
status | varchar(255) | YES | NULL |
Java Entity-Mapper:
public class BundleActionBean implements Writable, JsonBean {
@Id
@Column(name = "bundle_action_id")
private String bundleActionId = null;
@Index
@Column(name = "bundle_id")
private String bundleId = null;
@Column(name = "coord_name")
private String coordName = null;
@Basic
@Column(name = "coord_id")
private String coordId = null;
@Basic
@Column(name = "status")
private String statusStr = null;
@Basic
@Column(name = "critical")
private int critical = 0;
@Basic
@Column(name = "pending")
private int pending = 0;
@Basic
@Column(name = "last_modified_time")
private java.sql.Timestamp lastModifiedTimestamp = null;
DELETE_BUNDLE_ACTION: query = "delete from BundleActionBean w where w.bundleActionId = :bundleActionId"),
UPDATE_BUNDLE_ACTION_PENDING_MODTIME: query = "update BundleActionBean w set w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending where w.bundleActionId = :bundleActionId"),
UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME: query = "update BundleActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending where w.bundleActionId = :bundleActionId"),
UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID: query = "update BundleActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending, w.coordId = :coordId where w.bundleActionId = :bundleActionId"),
GET_BUNDLE_ACTIONS_STATUS_UNIGNORED_FOR_BUNDLE: query = "select OBJECT(w) from BundleActionBean w where w.bundleId = :bundleId AND w.statusStr <> 'IGNORED'"),
GET_BUNDLE_UNIGNORED_ACTION_STATUS_PENDING_FOR_BUNDLE: query = "select w.coordId, w.statusStr, w.pending from BundleActionBean w where w.bundleId = :bundleId AND w.statusStr <> 'IGNORED'"),
GET_BUNDLE_ACTIONS: query = "select OBJECT(w) from BundleActionBean w"),
GET_BUNDLE_WAITING_ACTIONS_OLDER_THAN: query = "select w.bundleActionId, w.bundleId, w.statusStr, w.coordId, w.coordName from BundleActionBean w where w.pending > 0 AND w.lastModifiedTimestamp <= :lastModifiedTime"),
GET_BUNDLE_ACTION: query = "select OBJECT(w) from BundleActionBean w where w.bundleActionId = :bundleActionId"),
GET_BUNDLE_ACTIONS_COUNT: query = "select count(w) from BundleActionBean w"),
GET_BUNDLE_ACTIONS_COUNT_BY_JOB: query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId"),
GET_BUNDLE_ACTIONS_PENDING_TRUE_COUNT: query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.pending > 0"),
GET_BUNDLE_ACTIONS_NOT_EQUAL_STATUS_COUNT: query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.statusStr <> :status"),
GET_BUNDLE_ACTIONS_NOT_TERMINATE_STATUS_COUNT: query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND (w.statusStr = 'PREP' OR w.statusStr = 'RUNNING' OR w.statusStr = 'RUNNINGWITHERROR' OR w.statusStr = 'SUSPENDED' OR w.statusStr = 'SUSPENDEDWITHERROR' OR w.statusStr = 'PREPSUSPENDED' OR w.statusStr = 'PAUSED' OR w.statusStr = 'PAUSEDWITHERROR' OR w.statusStr = 'PREPPAUSED')"),
GET_BUNDLE_ACTIONS_FAILED_NULL_COORD_COUNT: query = "select count(w) from BundleActionBean w where w.bundleId = :bundleId AND w.statusStr = 'FAILED' AND w.coordId IS NULL"),
GET_BUNDLE_ACTIONS_OLDER_THAN: query = "select OBJECT(w) from BundleActionBean w order by w.lastModifiedTimestamp"),
DELETE_COMPLETED_ACTIONS_FOR_BUNDLE: query = "delete from BundleActionBean a where a.bundleId = :bundleId and (a.statusStr = 'SUCCEEDED' OR a.statusStr = 'FAILED' OR a.statusStr= 'KILLED' OR a.statusStr = 'DONEWITHERROR')"),
DELETE_ACTIONS_FOR_BUNDLE: query = "delete from BundleActionBean a where a.bundleId IN (:bundleId)")})
CoordinatorJobBean
mysql> desc COORD_JOBS;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | varchar(255) | NO | PRI | NULL | |
app_name | varchar(255) | YES | NULL | ||
app_namespace | varchar(255) | YES | NULL | ||
app_path | varchar(255) | YES | NULL | ||
bundle_id | varchar(255) | YES | MUL | NULL | |
concurrency | int(11) | YES | NULL | ||
conf | mediumblob | YES | NULL | ||
created_time | datetime | YES | MUL | NULL | |
done_materialization | int(11) | YES | NULL | ||
end_time | datetime | YES | NULL | ||
execution | varchar(255) | YES | NULL | ||
external_id | varchar(255) | YES | NULL | ||
frequency | varchar(255) | YES | NULL | ||
group_name | varchar(255) | YES | NULL | ||
job_xml | mediumblob | YES | NULL | ||
last_action_number | int(11) | YES | NULL | ||
last_action | datetime | YES | NULL | ||
last_modified_time | datetime | YES | MUL | NULL | |
mat_throttling | int(11) | YES | NULL | ||
next_matd_time | datetime | YES | MUL | NULL | |
orig_job_xml | mediumblob | YES | NULL | ||
pause_time | datetime | YES | NULL | ||
pending | int(11) | YES | NULL | ||
sla_xml | mediumblob | YES | NULL | ||
start_time | datetime | YES | NULL | ||
status | varchar(255) | YES | MUL | NULL | |
suspended_time | datetime | YES | MUL | NULL | |
time_out | int(11) | YES | NULL | ||
time_unit | varchar(255) | YES | NULL | ||
time_zone | varchar(255) | YES | NULL | ||
user_name | varchar(255) | YES | NULL |
Java Entity-Mapper:
@Table(name = "COORD_JOBS")
public class CoordinatorJobBean implements Writable, CoordinatorJob, JsonBean {
@Id
private String id;
@Basic
@Column(name = "app_path")
private String appPath = null;
@Basic
@Column(name = "app_name")
private String appName = null;
@Basic
@Column(name = "external_id")
private String externalId = null;
@Basic
@Column(name = "conf")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob conf = null;
@Basic
@Column(name = "frequency")
private String frequency = "0";
@Basic
@Column(name = "time_zone")
private String timeZone = null;
@Basic
@Column(name = "concurrency")
private int concurrency = 0;
@Basic
@Column(name = "mat_throttling")
private int matThrottling = 0;
@Basic
@Column(name = "time_out")
private int timeOut = 0;
@Basic
@Column(name = "last_action_number")
private int lastActionNumber;
@Basic
@Column(name = "user_name")
private String user = null;
@Basic
@Column(name = "group_name")
private String group = null;
@Basic
@Index
@Column(name = "bundle_id")
private String bundleId = null;
@Transient
private String consoleUrl;
@Transient
private List actions;
@Transient
private int numActions = 0;
@Basic
@Index
@Column(name = "status")
private String statusStr = CoordinatorJob.Status.PREP.toString();
@Basic
@Column(name = "start_time")
private java.sql.Timestamp startTimestamp = null;
@Basic
@Column(name = "end_time")
private java.sql.Timestamp endTimestamp = null;
@Basic
@Column(name = "pause_time")
private java.sql.Timestamp pauseTimestamp = null;
@Basic
@Index
@Column(name = "created_time")
private java.sql.Timestamp createdTimestamp = null;
@Basic
@Column(name = "time_unit")
private String timeUnitStr = CoordinatorJob.Timeunit.NONE.toString();
@Basic
@Column(name = "execution")
private String execution = CoordinatorJob.Execution.FIFO.toString();
@Basic
@Column(name = "last_action")
private java.sql.Timestamp lastActionTimestamp = null;
@Basic
@Index
@Column(name = "next_matd_time")
private java.sql.Timestamp nextMaterializedTimestamp = null;
@Basic
@Index
@Column(name = "last_modified_time")
private java.sql.Timestamp lastModifiedTimestamp = null;
@Basic
@Index
@Column(name = "suspended_time")
private java.sql.Timestamp suspendedTimestamp = null;
@Basic
@Column(name = "job_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob jobXml = null;
@Basic
@Column(name = "orig_job_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob origJobXml = null;
@Basic
@Column(name = "sla_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob slaXml = null;
@Basic
@Column(name = "pending")
private int pending = 0;
@Basic
@Column(name = "done_materialization")
private int doneMaterialization = 0;
@Basic
@Column(name = "app_namespace")
private String appNamespace = null;
================================================================================
UPDATE_COORD_JOB: query = "update CoordinatorJobBean w set w.appName = :appName, w.appPath = :appPath,w.concurrency = :concurrency, w.conf = :conf, w.externalId = :externalId, w.frequency = :frequency, w.lastActionNumber = :lastActionNumber, w.timeOut = :timeOut, w.timeZone = :timeZone, w.createdTimestamp = :createdTime, w.endTimestamp = :endTime, w.execution = :execution, w.jobXml = :jobXml, w.lastActionTimestamp = :lastAction, w.lastModifiedTimestamp = :lastModifiedTime, w.nextMaterializedTimestamp = :nextMaterializedTime, w.origJobXml = :origJobXml, w.slaXml=:slaXml, w.startTimestamp = :startTime, w.statusStr = :status, w.timeUnitStr = :timeUnit, w.appNamespace = :appNamespace, w.bundleId = :bundleId, w.matThrottling = :matThrottling where w.id = :id");
UPDATE_COORD_JOB_STATUS: query = "update CoordinatorJobBean w set w.statusStr =:status, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id");
UPDATE_COORD_JOB_PENDING: query = "update CoordinatorJobBean w set w.pending = :pending, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id");
UPDATE_COORD_JOB_BUNDLEID: query = "update CoordinatorJobBean w set w.bundleId = :bundleId where w.id = :id");
UPDATE_COORD_JOB_APPNAMESPACE: query = "update CoordinatorJobBean w set w.appNamespace = :appNamespace where w.id = :id");
UPDATE_COORD_JOB_STATUS_PENDING: query = "update CoordinatorJobBean w set w.statusStr = :status, w.pending = :pending where w.id = :id");
UPDATE_COORD_JOB_BUNDLEID_APPNAMESPACE_PAUSETIME: query = "update CoordinatorJobBean w set w.bundleId = :bundleId, w.appNamespace = :appNamespace, w.pauseTimestamp = :pauseTime where w.id = :id");
UPDATE_COORD_JOB_STATUS_MODTIME: query = "update CoordinatorJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id");
UPDATE_COORD_JOB_STATUS_PENDING_MODTIME: query = "update CoordinatorJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending where w.id = :id");
UPDATE_COORD_JOB_LAST_MODIFIED_TIME: query = "update CoordinatorJobBean w set w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id");
UPDATE_COORD_JOB_STATUS_PENDING_TIME: query = "update CoordinatorJobBean w set w.statusStr = :status, w.pending = :pending, w.doneMaterialization = :doneMaterialization, w.lastModifiedTimestamp = :lastModifiedTime, w.suspendedTimestamp = :suspendedTime where w.id = :id");
UPDATE_COORD_JOB_MATERIALIZE: query = "update CoordinatorJobBean w set w.statusStr = :status, w.pending = :pending, w.doneMaterialization = :doneMaterialization, w.lastActionTimestamp = :lastActionTime, w.lastActionNumber = :lastActionNumber, w.nextMaterializedTimestamp = :nextMatdTime where w.id = :id");
UPDATE_COORD_JOB_CHANGE: query = "update CoordinatorJobBean w set w.endTimestamp = :endTime, w.statusStr = :status, w.pending = :pending, w.doneMaterialization = :doneMaterialization, w.concurrency = :concurrency, w.pauseTimestamp = :pauseTime, w.lastActionNumber = :lastActionNumber, w.lastActionTimestamp = :lastActionTime, w.nextMaterializedTimestamp = :nextMatdTime, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id");
UPDATE_COORD_JOB_CONF: query = "update CoordinatorJobBean w set w.conf = :conf where w.id = :id");
UPDATE_COORD_JOB_XML: query = "update CoordinatorJobBean w set w.jobXml = :jobXml where w.id = :id");
DELETE_COORD_JOB: query = "delete from CoordinatorJobBean w where w.id IN (:id)");
GET_COORD_JOBS: query = "select OBJECT(w) from CoordinatorJobBean w");
GET_COORD_JOB: query = "select OBJECT(w) from CoordinatorJobBean w where w.id = :id");
GET_COORD_JOB_USER_APPNAME: query = "select w.user, w.appName from CoordinatorJobBean w where w.id = :id");
GET_COORD_JOB_INPUT_CHECK: query = "select w.user, w.appName, w.statusStr, w.appNamespace, w.execution, w.frequency, w.timeUnitStr, w.timeZone, w.endTimestamp from CoordinatorJobBean w where w.id = :id");
GET_COORD_JOB_ACTION_READY: query = "select w.id, w.user, w.group, w.appName, w.statusStr, w.execution, w.concurrency from CoordinatorJobBean w where w.id = :id");
GET_COORD_JOB_ACTION_KILL: query = "select w.id, w.user, w.group, w.appName, w.statusStr from CoordinatorJobBean w where w.id = :id");
GET_COORD_JOB_MATERIALIZE: query = "select w.id, w.user, w.group, w.appName, w.statusStr, w.frequency, w.matThrottling, w.timeOut, w.timeZone, w.startTimestamp, w.endTimestamp, w.pauseTimestamp, w.nextMaterializedTimestamp, w.lastActionTimestamp, w.lastActionNumber, w.doneMaterialization, w.bundleId, w.conf, w.jobXml, w.appNamespace, w.timeUnitStr, w.execution from CoordinatorJobBean w where w.id = :id");
GET_COORD_JOB_SUSPEND_KILL: query = "select w.id, w.user, w.group, w.appName, w.statusStr, w.bundleId, w.appNamespace, w.doneMaterialization from CoordinatorJobBean w where w.id = :id");
GET_COORD_JOBS_PENDING: query = "select OBJECT(w) from CoordinatorJobBean w where w.pending = 1 order by w.lastModifiedTimestamp");
GET_COORD_JOBS_CHANGED: query = "select OBJECT(w) from CoordinatorJobBean w where w.pending = 1 AND w.doneMaterialization = 1 AND w.lastModifiedTimestamp >= :lastModifiedTime"),
GET_COORD_JOBS_COUNT: query = "select count(w) from CoordinatorJobBean w"),
GET_COORD_JOBS_COLUMNS: query = "select w.id, w.appName, w.statusStr, w.user, w.group, w.startTimestamp, w.endTimestamp, w.appPath, w.concurrency, w.frequency, w.lastActionTimestamp, w.nextMaterializedTimestamp, w.createdTimestamp, w.timeUnitStr, w.timeZone, w.timeOut from CoordinatorJobBean w order by w.createdTimestamp desc"),
//TODO need to remove.
GET_COORD_JOBS_OLDER_THAN: query = "select OBJECT(w) from CoordinatorJobBean w where w.startTimestamp <= :matTime AND (w.statusStr = 'PREP' OR w.statusStr = 'RUNNING' or w.statusStr = 'RUNNINGWITHERROR') AND (w.nextMaterializedTimestamp < :matTime OR w.nextMaterializedTimestamp IS NULL) AND (w.nextMaterializedTimestamp IS NULL OR (w.endTimestamp > w.nextMaterializedTimestamp AND (w.pauseTimestamp IS NULL OR w.pauseTimestamp > w.nextMaterializedTimestamp))) order by w.lastModifiedTimestamp"),
GET_COORD_JOBS_OLDER_FOR_MATERIALIZATION: query = "select w.id from CoordinatorJobBean w where w.startTimestamp <= :matTime AND (w.statusStr = 'PREP' OR w.statusStr = 'RUNNING' or w.statusStr = 'RUNNINGWITHERROR') AND (w.nextMaterializedTimestamp < :matTime OR w.nextMaterializedTimestamp IS NULL) AND (w.nextMaterializedTimestamp IS NULL OR (w.endTimestamp > w.nextMaterializedTimestamp AND (w.pauseTimestamp IS NULL OR w.pauseTimestamp > w.nextMaterializedTimestamp))) and w.matThrottling > ( select count(a.jobId) from CoordinatorActionBean a where a.jobId = w.id and a.statusStr = 'WAITING') order by w.lastModifiedTimestamp"),
GET_COORD_JOBS_OLDER_THAN_STATUS: query = "select OBJECT(w) from CoordinatorJobBean w where w.statusStr = :status AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
GET_COMPLETED_COORD_JOBS_OLDER_THAN_STATUS: query = "select OBJECT(w) from CoordinatorJobBean w where ( w.statusStr = 'SUCCEEDED' OR w.statusStr = 'FAILED' or w.statusStr = 'KILLED') AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
GET_COMPLETED_COORD_JOBS_WITH_NO_PARENT_OLDER_THAN_STATUS: query = "select w.id from CoordinatorJobBean w where ( w.statusStr = 'SUCCEEDED' OR w.statusStr = 'FAILED' or w.statusStr = 'KILLED' or w.statusStr = 'DONEWITHERROR') AND w.lastModifiedTimestamp <= :lastModTime and w.bundleId is null order by w.lastModifiedTimestamp"),
GET_COORD_JOBS_UNPAUSED: query = "select OBJECT(w) from CoordinatorJobBean w where w.statusStr = 'RUNNING' OR w.statusStr = 'RUNNINGWITHERROR' OR w.statusStr = 'PREP' order by w.lastModifiedTimestamp"),
GET_COORD_JOBS_PAUSED: query = "select OBJECT(w) from CoordinatorJobBean w where w.statusStr = 'PAUSED' OR w.statusStr = 'PAUSEDWITHERROR' OR w.statusStr = 'PREPPAUSED' order by w.lastModifiedTimestamp"),
GET_COORD_JOBS_FOR_BUNDLE: query = "select OBJECT(w) from CoordinatorJobBean w where w.bundleId = :bundleId order by w.lastModifiedTimestamp"),
GET_COORD_JOBS_WITH_PARENT_ID: query = "select w.id from CoordinatorJobBean w where w.bundleId = :parentId"),
GET_COORD_COUNT_WITH_PARENT_ID_NOT_READY_FOR_PURGE: query = "select count(w) from CoordinatorJobBean w where w.bundleId = :parentId and (w.statusStr NOT IN ('SUCCEEDED', 'FAILED', 'KILLED', 'DONEWITHERROR') OR w.lastModifiedTimestamp >= :lastModTime)"),
GET_COORD_JOB_FOR_USER_APPNAME: query = "select w.user, w.appName from CoordinatorJobBean w where w.id = :id"),
GET_COORD_JOB_FOR_USER: query = "select w.user from CoordinatorJobBean w where w.id = :id"),
GET_COORD_JOB_STATUS: query = "select w.statusStr from CoordinatorJobBean w where w.id = :id"),
GET_COORD_JOB_STATUS_PARENTID: query = "select w.statusStr, w.bundleId from CoordinatorJobBean w where w.id = :id"),
GET_COORD_IDS_FOR_STATUS_TRANSIT: query = "select DISTINCT w.id from CoordinatorActionBean a, CoordinatorJobBean w where w.id = a.jobId and a.lastModifiedTimestamp >= :lastModifiedTime and (w.statusStr IN ('PAUSED', 'RUNNING', 'RUNNINGWITHERROR', 'PAUSEDWITHERROR') or w.pending = 1) and w.statusStr <> 'IGNORED'"),
GET_COORD_JOBS_FOR_BUNDLE_BY_APPNAME_ID: query = "select w.id from CoordinatorJobBean w where ( w.appName IN (:appName) OR w.id IN (:appName) ) AND w.bundleId = :bundleId"),
GET_COORD_JOB_CONF: query = "select w.conf from CoordinatorJobBean w where w.id = :id"),
GET_COORD_JOB_XML: query = "select w.jobXml from CoordinatorJobBean w where w.id = :id")
CoordinatorActionBean
mysql> desc COORD_ACTIONS;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | varchar(255) | NO | PRI | NULL | |
action_number | int(11) | YES | NULL | ||
action_xml | mediumblob | YES | NULL | ||
console_url | varchar(255) | YES | NULL | ||
created_conf | mediumblob | YES | NULL | ||
created_time | datetime | YES | MUL | NULL | |
error_code | varchar(255) | YES | NULL | ||
error_message | varchar(255) | YES | NULL | ||
external_id | varchar(255) | YES | MUL | NULL | |
external_status | varchar(255) | YES | NULL | ||
job_id | varchar(255) | YES | MUL | NULL | |
last_modified_time | datetime | YES | MUL | NULL | |
missing_dependencies | mediumblob | YES | NULL | ||
nominal_time | datetime | YES | MUL | NULL | |
pending | int(11) | YES | NULL | ||
push_missing_dependencies | mediumblob | YES | NULL | ||
rerun_time | datetime | YES | MUL | NULL | |
run_conf | mediumblob | YES | NULL | ||
sla_xml | mediumblob | YES | NULL | ||
status | varchar(255) | YES | MUL | NULL | |
time_out | int(11) | YES | NULL | ||
tracker_uri | varchar(255) | YES | NULL | ||
job_type | varchar(255) | YES | NULL |
Java Entity-Mapper:
@Table(name = "COORD_ACTIONS")
public class CoordinatorActionBean implements
Writable,CoordinatorAction,JsonBean {
@Id
private String id;
@Basic
@Index
@Column(name = "job_id")
private String jobId;
@Basic
@Index
@Column(name = "status")
private String statusStr = CoordinatorAction.Status.WAITING.toString();
@Basic
@Index
@Column(name = "nominal_time")
private java.sql.Timestamp nominalTimestamp = null;
@Basic
@Index
@Column(name = "last_modified_time")
private java.sql.Timestamp lastModifiedTimestamp = null;
@Basic
@Index
@Column(name = "created_time")
private java.sql.Timestamp createdTimestamp = null;
@Basic
@Index
@Column(name = "rerun_time")
private java.sql.Timestamp rerunTimestamp = null;
@Basic
@Index
@Column(name = "external_id")
private String externalId;
@Basic
@Column(name = "sla_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob slaXml = null;
@Basic
@Column(name = "pending")
private int pending = 0;
@Basic
@Column(name = "job_type")
private String type;
@Basic
@Column(name = "action_number")
private int actionNumber;
@Basic
@Column(name = "created_conf")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob createdConf;
@Basic
@Column(name = "time_out")
private int timeOut = 0;
@Basic
@Column(name = "run_conf")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob runConf;
@Basic
@Column(name = "action_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob actionXml;
@Basic
@Column(name = "missing_dependencies")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob missingDependencies;
@Basic
@Column(name = "push_missing_dependencies")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob pushMissingDependencies;
@Basic
@Column(name = "external_status")
private String externalStatus;
@Basic
@Column(name = "tracker_uri")
private String trackerUri;
@Basic
@Column(name = "console_url")
private String consoleUrl;
@Basic
@Column(name = "error_code")
private String errorCode;
@Basic
@Column(name = "error_message")
private String errorMessage;
================================================================================
UPDATE_COORD_ACTION: query = "update CoordinatorActionBean w set w.actionNumber = :actionNumber, w.actionXml = :actionXml, w.consoleUrl = :consoleUrl, w.createdConf = :createdConf, w.errorCode = :errorCode, w.errorMessage = :errorMessage, w.externalStatus = :externalStatus, w.missingDependencies = :missingDependencies, w.runConf = :runConf, w.timeOut = :timeOut, w.trackerUri = :trackerUri, w.type = :type, w.createdTimestamp = :createdTime, w.externalId = :externalId, w.jobId = :jobId, w.lastModifiedTimestamp = :lastModifiedTime, w.nominalTimestamp = :nominalTime, w.slaXml = :slaXml, w.statusStr = :status where w.id = :id"),
UPDATE_COORD_ACTION_MIN: query = "update CoordinatorActionBean w set w.actionXml = :actionXml, w.missingDependencies = :missingDependencies, w.lastModifiedTimestamp = :lastModifiedTime, w.statusStr = :status where w.id = :id"),
// Query to update the action status, pending status and last modified time stamp of a Coordinator action
UPDATE_COORD_ACTION_STATUS_PENDING_TIME: query = "update CoordinatorActionBean w set w.statusStr =:status, w.pending =:pending, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
// Update query for InputCheck
UPDATE_COORD_ACTION_FOR_INPUTCHECK", query = "update CoordinatorActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.actionXml = :actionXml, w.missingDependencies = :missingDependencies where w.id = :id"),
// Update query for Push-based missing dependency check
UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK: query = "update CoordinatorActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.actionXml = :actionXml, w.pushMissingDependencies = :pushMissingDependencies where w.id = :id"),
// Update query for Push-based missing dependency check
UPDATE_COORD_ACTION_DEPENDENCIES: query = "update CoordinatorActionBean w set w.missingDependencies = :missingDependencies, w.pushMissingDependencies = :pushMissingDependencies where w.id = :id"),
// Update query for Start
UPDATE_COORD_ACTION_FOR_START: query = "update CoordinatorActionBean w set w.statusStr =:status, w.lastModifiedTimestamp = :lastModifiedTime, w.runConf = :runConf, w.externalId = :externalId, w.pending = :pending, w.errorCode = :errorCode, w.errorMessage = :errorMessage where w.id = :id"),
UPDATE_COORD_ACTION_FOR_MODIFIED_DATE: query = "update CoordinatorActionBean w set w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
UPDATE_COORD_ACTION_RERUN: query = "update CoordinatorActionBean w set w.actionXml =:actionXml, w.statusStr = :status, w.externalId = :externalId, w.externalStatus = :externalStatus, w.rerunTimestamp = :rerunTime, w.lastModifiedTimestamp = :lastModifiedTime, w.createdTimestamp = :createdTime, w.createdConf = :createdConf, w.runConf = :runConf, w.missingDependencies = :missingDependencies, w.pushMissingDependencies = :pushMissingDependencies, w.errorCode = :errorCode, w.errorMessage = :errorMessage where w.id = :id"),
DELETE_COMPLETED_ACTIONS_FOR_COORDINATOR: query = "delete from CoordinatorActionBean a where a.jobId = :jobId and (a.statusStr = 'SUCCEEDED' OR a.statusStr = 'FAILED' OR a.statusStr= 'KILLED')"),
DELETE_ACTIONS_FOR_LONG_RUNNING_COORDINATOR: query = "delete from CoordinatorActionBean a where a.id IN (:actionId)"),
DELETE_UNSCHEDULED_ACTION: query = "delete from CoordinatorActionBean a where a.id = :id and (a.statusStr = 'WAITING' OR a.statusStr = 'READY')"),
GET_COORD_ACTIONS_FOR_COORDINATOR: query = "select a.id from CoordinatorActionBean a where a.jobId = :jobId"),
// Query used by XTestcase to setup tables
GET_COORD_ACTIONS: query = "select OBJECT(w) from CoordinatorActionBean w"),
// Select query used only by test cases
GET_COORD_ACTION: query = "select OBJECT(a) from CoordinatorActionBean a where a.id = :id"),
// Select query used by SLAService on restart
GET_COORD_ACTION_FOR_SLA: query = "select a.id, a.jobId, a.statusStr, a.externalId, a.lastModifiedTimestamp from CoordinatorActionBean a where a.id = :id"),
// Select query used by ActionInfo command
GET_COORD_ACTION_FOR_INFO: query = "select a.id, a.jobId, a.actionNumber, a.consoleUrl, a.errorCode, a.errorMessage, a.externalId, a.externalStatus, a.trackerUri, a.createdTimestamp, a.nominalTimestamp, a.statusStr, a.lastModifiedTimestamp, a.missingDependencies, a.pushMissingDependencies from CoordinatorActionBean a where a.id = :id"),
// Select Query used by Timeout and skip commands
GET_COORD_ACTION_FOR_TIMEOUT: query = "select a.id, a.jobId, a.statusStr, a.runConf, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
// Select query used by InputCheck command
GET_COORD_ACTION_FOR_INPUTCHECK: query = "select a.id, a.jobId, a.statusStr, a.runConf, a.nominalTimestamp, a.createdTimestamp, a.actionXml, a.missingDependencies, a.pushMissingDependencies, a.timeOut, a.externalId from CoordinatorActionBean a where a.id = :id"),
// Select query used by CoordActionUpdate command
GET_COORD_ACTION_FOR_EXTERNALID: query = "select a.id, a.jobId, a.statusStr, a.pending, a.externalId, a.lastModifiedTimestamp, a.slaXml, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.externalId = :externalId"),
// Select query used by Check command
GET_COORD_ACTION_FOR_CHECK: query = "select a.id, a.jobId, a.statusStr, a.pending, a.externalId, a.lastModifiedTimestamp, a.slaXml, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
// Select query used by Start command
GET_COORD_ACTION_FOR_START: query = "select a.id, a.jobId, a.statusStr, a.pending, a.createdConf, a.slaXml, a.actionXml, a.externalId, a.errorMessage, a.errorCode, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.id = :id"),
GET_COORD_ACTIONS_FOR_JOB_FIFO: query = "select a.id, a.jobId, a.statusStr, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr = 'READY' order by a.nominalTimestamp"),
GET_COORD_ACTIONS_FOR_JOB_LIFO: query = "select a.id, a.jobId, a.statusStr, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr = 'READY' order by a.nominalTimestamp desc"),
GET_COORD_RUNNING_ACTIONS_COUNT: query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND (a.statusStr = 'RUNNING' OR a.statusStr='SUBMITTED')"),
GET_COORD_ACTIONS_COUNT_BY_JOBID: query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId"),
GET_COORD_ACTIVE_ACTIONS_COUNT_BY_JOBID: query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr = 'WAITING'"),
GET_COORD_ACTIONS_PENDING_FALSE_COUNT: query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending = 0 AND (a.statusStr = 'SUSPENDED' OR a.statusStr = 'TIMEDOUT' OR a.statusStr = 'SUCCEEDED' OR a.statusStr = 'KILLED' OR a.statusStr = 'FAILED')"),
GET_COORD_ACTIONS_PENDING_FALSE_STATUS_COUNT: query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending = 0 AND a.statusStr = :status"),
GET_ACTIONS_FOR_COORD_JOB: query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId"),
// Query to retrieve Coordinator actions sorted by nominal time
GET_ACTIONS_FOR_COORD_JOB_ORDER_BY_NOMINAL_TIME: query = "select a.id, a.actionNumber, a.consoleUrl, a.errorCode, a.errorMessage, a.externalId, a.externalStatus, a.jobId, a.trackerUri, a.createdTimestamp, a.nominalTimestamp, a.statusStr, a.lastModifiedTimestamp, a.missingDependencies, a.pushMissingDependencies, a.timeOut from CoordinatorActionBean a where a.jobId = :jobId order by a.nominalTimestamp"),
// Query to maintain backward compatibility for coord job info command
GET_ALL_COLS_FOR_ACTIONS_FOR_COORD_JOB_ORDER_BY_NOMINAL_TIME: query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId order by a.nominalTimestamp"),
// Query to retrieve action id, action status, pending status and external Id of not completed Coordinator actions
GET_COORD_ACTIONS_NOT_COMPLETED: query = "select a.id, a.statusStr, a.pending, a.externalId, a.pushMissingDependencies, a.nominalTimestamp, a.createdTimestamp, a.jobId from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr <> 'FAILED' AND a.statusStr <> 'TIMEDOUT' AND a.statusStr <> 'SUCCEEDED' AND a.statusStr <> 'KILLED' AND a.statusStr <> 'IGNORED'"),
// Query to retrieve action id, action status, pending status and external Id of running Coordinator actions
GET_COORD_ACTIONS_RUNNING: query = "select a.id, a.statusStr, a.pending, a.externalId, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId and a.statusStr = 'RUNNING'"),
// Query to retrieve action id, action status, pending status and external Id of suspended Coordinator actions
GET_COORD_ACTIONS_SUSPENDED", query = "select a.id, a.statusStr, a.pending, a.externalId, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId and a.statusStr = 'SUSPENDED'"),
// Query to retrieve count of Coordinator actions which are pending
GET_COORD_ACTIONS_PENDING_COUNT", query = "select count(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.pending > 0"),
// Query to retrieve status of Coordinator actions
GET_COORD_ACTIONS_STATUS_UNIGNORED", query = "select a.statusStr, a.pending from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr <> 'IGNORED'"),
// Query to retrieve status of Coordinator actions
GET_COORD_ACTION_STATUS", query = "select a.statusStr from CoordinatorActionBean a where a.id = :id"),
GET_COORD_ACTION_FOR_COORD_JOB_BY_ACTION_NUMBER", query = "select a.id from CoordinatorActionBean a where a.jobId = :jobId AND a.actionNumber = :actionNumber"),
GET_COORD_ACTIONS_BY_LAST_MODIFIED_TIME", query = "select a.jobId from CoordinatorActionBean a where a.lastModifiedTimestamp >= :lastModifiedTime"),
//Used by coordinator store only
GET_RUNNING_ACTIONS_FOR_COORD_JOB", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.statusStr = 'RUNNING'"),
GET_RUNNING_ACTIONS_OLDER_THAN", query = "select a.id from CoordinatorActionBean a where a.statusStr = 'RUNNING' AND a.lastModifiedTimestamp <= :lastModifiedTime"),
GET_COORD_ACTIONS_WAITING_SUBMITTED_OLDER_THAN", query = "select a.id, a.jobId, a.statusStr, a.externalId, a.pushMissingDependencies from CoordinatorActionBean a where (a.statusStr = 'WAITING' OR a.statusStr = 'SUBMITTED') AND a.lastModifiedTimestamp <= :lastModifiedTime"),
GET_COORD_ACTIONS_FOR_RECOVERY_OLDER_THAN", query = "select a.id, a.jobId, a.statusStr, a.externalId, a.pending from CoordinatorActionBean a where a.pending > 0 AND (a.statusStr = 'SUSPENDED' OR a.statusStr = 'KILLED' OR a.statusStr = 'RUNNING') AND a.lastModifiedTimestamp <= :lastModifiedTime"),
// Select query used by rerun, requires almost all columns so select * is used
GET_TERMINATED_ACTIONS_FOR_DATES", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId AND (a.statusStr = 'TIMEDOUT' OR a.statusStr = 'SUCCEEDED' OR a.statusStr = 'KILLED' OR a.statusStr = 'FAILED' OR a.statusStr = 'IGNORED') AND a.nominalTimestamp >= :startTime AND a.nominalTimestamp <= :endTime"),
// Select query used by log
GET_TERMINATED_ACTION_IDS_FOR_DATES", query = "select a.id from CoordinatorActionBean a where a.jobId = :jobId AND (a.statusStr = 'TIMEDOUT' OR a.statusStr = 'SUCCEEDED' OR a.statusStr = 'KILLED' OR a.statusStr = 'FAILED') AND a.nominalTimestamp >= :startTime AND a.nominalTimestamp <= :endTime"),
// Select query used by rerun, requires almost all columns so select * is used
GET_ACTION_FOR_NOMINALTIME", query = "select OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId AND a.nominalTimestamp = :nominalTime"),
GET_ACTIVE_ACTIONS_FOR_DATES", query = "select a.id, a.jobId, a.statusStr, a.externalId, a.pending, a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where a.jobId = :jobId AND (a.statusStr = 'WAITING' OR a.statusStr = 'READY' OR a.statusStr = 'SUBMITTED' OR a.statusStr = 'RUNNING' OR a.statusStr = 'SUSPENDED') AND a.nominalTimestamp >= :startTime AND a.nominalTimestamp <= :endTime"),
GET_COORD_ACTIONS_COUNT", query = "select count(w) from CoordinatorActionBean w"),
GET_COORD_ACTIONS_COUNT_RUNNING_FOR_RANGE", query = "select count(w) from CoordinatorActionBean w where w.statusStr = 'RUNNING' and w.jobId= :jobId and w.id >= :startAction AND w.id <= :endAction"),
GET_COORD_ACTIONS_MAX_MODIFIED_DATE_FOR_RANGE", query = "select max(w.lastModifiedTimestamp) from CoordinatorActionBean w where w.jobId= :jobId and w.id >= :startAction AND w.id <= :endAction"),
GET_READY_ACTIONS_GROUP_BY_JOBID", query = "select a.jobId, min(a.lastModifiedTimestamp) from CoordinatorActionBean a where a.statusStr = 'READY' group by a.jobId having min(a.lastModifiedTimestamp) < :lastModifiedTime"),
GET_ACTIVE_ACTIONS_IDS_FOR_SLA_CHANGE", query = "select a.id, a.nominalTimestamp, a.createdTimestamp, a.actionXml from CoordinatorActionBean a where a.id in (:ids) and (a.statusStr <> 'FAILED' AND a.statusStr <> 'KILLED' AND a.statusStr <> 'SUCCEEDED' AND a.statusStr <> 'TIMEDOUT' AND a.statusStr <> 'IGNORED')"),
GET_ACTIVE_ACTIONS_JOBID_FOR_SLA_CHANGE", query = "select a.id, a.nominalTimestamp, a.createdTimestamp, a.actionXml from CoordinatorActionBean a where a.jobId = :jobId and (a.statusStr <> 'FAILED' AND a.statusStr <> 'KILLED' AND a.statusStr <> 'SUCCEEDED' AND a.statusStr <> 'TIMEDOUT' AND a.statusStr <> 'IGNORED')")
WorkflowJobBean:
mysql> desc WF_JOBS ;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | varchar(255) | NO | PRI | NULL | |
app_name | varchar(255) | YES | NULL | ||
app_path | varchar(255) | YES | NULL | ||
conf | mediumblob | YES | NULL | ||
created_time | datetime | YES | NULL | ||
end_time | datetime | YES | MUL | NULL | |
external_id | varchar(255) | YES | MUL | NULL | |
group_name | varchar(255) | YES | NULL | ||
last_modified_time | datetime | YES | MUL | NULL | |
log_token | varchar(255) | YES | NULL | ||
parent_id | varchar(255) | YES | MUL | NULL | |
proto_action_conf | mediumblob | YES | NULL | ||
run | int(11) | YES | NULL | ||
sla_xml | mediumblob | YES | NULL | ||
start_time | datetime | YES | NULL | ||
status | varchar(255) | YES | MUL | NULL | |
user_name | varchar(255) | YES | NULL | ||
wf_instance | mediumblob | YES | NULL |
Java Entity-Mapper:
@Table(name = "WF_JOBS")
public class WorkflowJobBean implements Writable, WorkflowJob, JsonBean {
@Id
private String id;
@Basic
@Column(name = "proto_action_conf")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob protoActionConf;
@Basic
@Column(name = "log_token")
private String logToken = null;
@Basic
@Index
@Column(name = "external_id")
private String externalId = null;
@Basic
@Index
@Column(name = "status")
private String statusStr = WorkflowJob.Status.PREP.toString();
@Basic
@Column(name = "created_time")
private java.sql.Timestamp createdTimestamp = null;
@Basic
@Column(name = "start_time")
private java.sql.Timestamp startTimestamp = null;
@Basic
@Index
@Column(name = "end_time")
private java.sql.Timestamp endTimestamp = null;
@Basic
@Index
@Column(name = "last_modified_time")
private java.sql.Timestamp lastModifiedTimestamp = null;
@Basic
@Column(name = "wf_instance")
@Lob
@Strategy("org.apache.oozie.executor.jpa.BinaryBlobValueHandler")
private BinaryBlob wfInstance ;
@Basic
@Column(name = "sla_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob slaXml;
@Basic
@Column(name = "app_name")
private String appName = null;
@Basic
@Column(name = "app_path")
private String appPath = null;
@Basic
@Column(name = "conf")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob conf;
@Basic
@Column(name = "user_name")
private String user = null;
@Basic
@Column(name = "group_name")
private String group;
@Basic
@Column(name = "run")
private int run = 1;
@Basic
@Index
@Column(name = "parent_id")
private String parentId;
@Transient
private String consoleUrl;
@Transient
private List actions;
================================================================================
UPDATE_WORKFLOW: query = "update WorkflowJobBean w set w.appName = :appName, w.appPath = :appPath, w.conf = :conf, w.group = :groupName, w.run = :run, w.user = :user, w.createdTimestamp = :createdTime, w.endTimestamp = :endTime, w.externalId = :externalId, w.lastModifiedTimestamp = :lastModTime,w.logToken = :logToken, w.protoActionConf = :protoActionConf, w.slaXml =:slaXml, w.startTimestamp = :startTime, w.statusStr = :status, w.wfInstance = :wfInstance where w.id = :id");
UPDATE_WORKFLOW_MODTIME: query = "update WorkflowJobBean w set w.lastModifiedTimestamp = :lastModTime where w.id = :id");
UPDATE_WORKFLOW_STATUS_MODTIME: query = "update WorkflowJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModTime where w.id = :id");
UPDATE_WORKFLOW_PARENT_MODIFIED: query = "update WorkflowJobBean w set w.parentId = :parentId, w.lastModifiedTimestamp = :lastModTime where w.id = :id");
UPDATE_WORKFLOW_STATUS_INSTANCE_MODIFIED: query = "update WorkflowJobBean w set w.statusStr = :status, w.wfInstance = :wfInstance, w.lastModifiedTimestamp = :lastModTime where w.id = :id");
UPDATE_WORKFLOW_STATUS_INSTANCE_MOD_END: query = "update WorkflowJobBean w set w.statusStr = :status, w.wfInstance = :wfInstance, w.lastModifiedTimestamp = :lastModTime, w.endTimestamp = :endTime where w.id = :id");
UPDATE_WORKFLOW_STATUS_INSTANCE_MOD_START_END: query = "update WorkflowJobBean w set w.statusStr = :status, w.wfInstance = :wfInstance, w.lastModifiedTimestamp = :lastModTime, w.startTimestamp = :startTime, w.endTimestamp = :endTime where w.id = :id");
UPDATE_WORKFLOW_RERUN: query = "update WorkflowJobBean w set w.appName = :appName, w.protoActionConf = :protoActionConf, w.appPath = :appPath, w.conf = :conf, w.logToken = :logToken, w.user = :user, w.group = :group, w.externalId = :externalId, w.endTimestamp = :endTime, w.run = :run, w.statusStr = :status, w.wfInstance = :wfInstance, w.lastModifiedTimestamp = :lastModTime where w.id = :id");
DELETE_WORKFLOW: query = "delete from WorkflowJobBean w where w.id IN (:id)");
GET_WORKFLOWS: query = "select OBJECT(w) from WorkflowJobBean w order by w.startTimestamp desc");
GET_WORKFLOWS_COLUMNS: query = "select w.id, w.appName, w.statusStr, w.run, w.user, w.group, w.createdTimestamp, w.startTimestamp, w.lastModifiedTimestamp, w.endTimestamp, w.externalId, w.parentId from WorkflowJobBean w order by w.createdTimestamp desc");
GET_WORKFLOWS_COUNT: query = "select count(w) from WorkflowJobBean w");
GET_COMPLETED_WORKFLOWS_OLDER_THAN: query = "select w from WorkflowJobBean w where w.endTimestamp < :endTime");
GET_COMPLETED_WORKFLOWS_WITH_NO_PARENT_OLDER_THAN: query = "select w.id from WorkflowJobBean w where w.endTimestamp < :endTime and w.parentId is null");
GET_COMPLETED_COORD_WORKFLOWS_OLDER_THAN: query = "select w.id, w.parentId from WorkflowJobBean w where w.endTimestamp < :endTime and w.parentId like '%C@%'");
GET_WORKFLOW: query = "select OBJECT(w) from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_STARTTIME: query = "select w.id, w.startTimestamp from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_START_END_TIME: query = "select w.id, w.startTimestamp, w.endTimestamp from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_USER_GROUP: query = "select w.user, w.group from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_SUSPEND: query = "select w.id, w.user, w.group, w.appName, w.statusStr, w.parentId, w.startTimestamp, w.endTimestamp, w.logToken, w.wfInstance from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_RERUN: query = "select w.id, w.user, w.group, w.appName, w.statusStr, w.run, w.logToken, w.wfInstance, w.parentId from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_DEFINITION: query = "select w.id, w.user, w.group, w.appName, w.logToken, w.wfInstance from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_ACTION_OP: query = "select w.id, w.user, w.group, w.appName, w.appPath, w.statusStr, w.run, w.parentId, w.logToken, w.wfInstance, w.protoActionConf from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_KILL: "select w.id, w.user, w.group, w.appName, w.appPath, w.statusStr, w.parentId, w.startTimestamp, w.endTimestamp, w.logToken, w.wfInstance, w.slaXml from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_RESUME: query = "select w.id, w.user, w.group, w.appName, w.appPath, w.statusStr, w.parentId, w.startTimestamp, w.endTimestamp, w.logToken, w.wfInstance, w.protoActionConf from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_FOR_UPDATE: query = "select OBJECT(w) from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_FOR_SLA: query = "select w.id, w.statusStr, w.startTimestamp, w.endTimestamp from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_ID_FOR_EXTERNAL_ID: query = "select w.id from WorkflowJobBean w where w.externalId = :externalId");
GET_WORKFLOWS_COUNT_WITH_STATUS: query = "select count(w) from WorkflowJobBean w where w.statusStr = :status");
GET_WORKFLOWS_COUNT_WITH_STATUS_IN_LAST_N_SECS: query = "select count(w) from WorkflowJobBean w where w.statusStr = :status and w.lastModifiedTimestamp > :lastModTime");
GET_WORKFLOWS_WITH_WORKFLOW_PARENT_ID: query = "select w.id from WorkflowJobBean w where w.parentId = :parentId");
GET_WORKFLOWS_WITH_COORD_PARENT_ID: query = "select w.id from WorkflowJobBean w where w.parentId like :parentId");
GET_WORKFLOWS_BASIC_INFO_BY_PARENT_ID: query = "select w.id, w.statusStr, w.endTimestamp from WorkflowJobBean w where w.parentId = :parentId");
GET_WORKFLOWS_BASIC_INFO_BY_COORD_PARENT_ID: query = "select w.id, w.statusStr, w.endTimestamp from WorkflowJobBean w where w.parentId like :parentId");
GET_WORKFLOW_FOR_USER: query = "select w.user from WorkflowJobBean w where w.id = :id");
GET_WORKFLOW_STATUS: query = "select w.statusStr from WorkflowJobBean w where w.id = :id");
GET_WORKFLOWS_PARENT_COORD_RERUN: query = "select w.id, w.statusStr, w.startTimestamp, w.endTimestamp from WorkflowJobBean w where w.parentId = :parentId order by w.createdTimestamp")})
WorkflowActionBean:
mysql> desc WF_ACTIONS;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | varchar(255) | NO | PRI | NULL | |
conf | mediumblob | YES | NULL | ||
console_url | varchar(255) | YES | NULL | ||
created_time | datetime | YES | NULL | ||
cred | varchar(255) | YES | NULL | ||
data | mediumblob | YES | NULL | ||
end_time | datetime | YES | NULL | ||
error_code | varchar(255) | YES | NULL | ||
error_message | varchar(500) | YES | NULL | ||
execution_path | varchar(1024) | YES | NULL | ||
external_child_ids | mediumblob | YES | NULL | ||
external_id | varchar(255) | YES | NULL | ||
external_status | varchar(255) | YES | NULL | ||
last_check_time | datetime | YES | NULL | ||
log_token | varchar(255) | YES | NULL | ||
name | varchar(255) | YES | NULL | ||
pending | int(11) | YES | NULL | ||
pending_age | datetime | YES | MUL | NULL | |
retries | int(11) | YES | NULL | ||
signal_value | varchar(255) | YES | NULL | ||
sla_xml | mediumblob | YES | NULL | ||
start_time | datetime | YES | NULL | ||
stats | mediumblob | YES | NULL | ||
status | varchar(255) | YES | MUL | NULL | |
tracker_uri | varchar(255) | YES | NULL | ||
transition | varchar(255) | YES | NULL | ||
type | varchar(255) | YES | NULL | ||
user_retry_count | int(11) | YES | NULL | ||
user_retry_interval | int(11) | YES | NULL | ||
user_retry_max | int(11) | YES | NULL | ||
wf_id | varchar(255) | YES | MUL | NULL |
Java Entity-Mapper:
@Table(name = "WF_ACTIONS")
public class WorkflowActionBean implements Writable, WorkflowAction, JsonBean {
@Id
private String id;
@Basic
@Index
@Column(name = "wf_id")
private String wfId = null;
@Basic
@Column(name = "created_time")
private Timestamp createdTimeTS = null;
@Basic
@Index
@Column(name = "status")
private String statusStr = WorkflowAction.Status.PREP.toString();
@Basic
@Column(name = "last_check_time")
private Timestamp lastCheckTimestamp;
@Basic
@Column(name = "end_time")
private Timestamp endTimestamp = null;
@Basic
@Column(name = "start_time")
private Timestamp startTimestamp = null;
@Basic
@Column(name = "execution_path", length = 1024)
private String executionPath = null;
@Basic
@Column(name = "pending")
private int pending = 0;
@Basic
@Index
@Column(name = "pending_age")
private Timestamp pendingAgeTimestamp = null;
@Basic
@Column(name = "signal_value")
private String signalValue = null;
@Basic
@Column(name = "log_token")
private String logToken = null;
@Basic
@Column(name = "sla_xml")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob slaXml;
@Basic
@Column(name = "name")
private String name = null;
@Basic
@Column(name = "cred")
private String cred = null;
@Basic
@Column(name = "type")
private String type = null;
@Basic
@Column(name = "conf")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob conf;
@Basic
@Column(name = "retries")
private int retries;
@Basic
@Column(name = "user_retry_count")
private int userRetryCount;
@Basic
@Column(name = "user_retry_max")
private int userRetryMax;
@Basic
@Column(name = "user_retry_interval")
private int userRetryInterval;
@Basic
@Column(name = "transition")
private String transition = null;
@Basic
@Column(name = "data")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob data;
@Basic
@Column(name = "stats")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob stats;
@Basic
@Column(name = "external_child_ids")
@Lob
@Strategy("org.apache.oozie.executor.jpa.StringBlobValueHandler")
private StringBlob externalChildIDs;
@Basic
@Column(name = "external_id")
private String externalId = null;
@Basic
@Column(name = "external_status")
private String externalStatus = null;
@Basic
@Column(name = "tracker_uri")
private String trackerUri = null;
@Basic
@Column(name = "console_url")
private String consoleUrl = null;
@Basic
@Column(name = "error_code")
private String errorCode = null;
@Column(name = "error_message", length = 500)
private String errorMessage = null;
================================================================================
UPDATE_ACTION: query = "update WorkflowActionBean a set a.conf = :conf, a.consoleUrl = :consoleUrl, a.data = :data, a.stats = :stats, a.externalChildIDs = :externalChildIDs, a.errorCode = :errorCode, a.errorMessage = :errorMessage, a.externalId = :externalId, a.externalStatus = :externalStatus, a.name = :name, a.cred = :cred , a.retries = :retries, a.trackerUri = :trackerUri, a.transition = :transition, a.type = :type, a.endTimestamp = :endTime, a.executionPath = :executionPath, a.lastCheckTimestamp = :lastCheckTime, a.logToken = :logToken, a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.signalValue = :signalValue, a.slaXml = :slaXml, a.startTimestamp = :startTime, a.statusStr = :status, a.wfId=:wfId where a.id = :id");
UPDATE_ACTION_FOR_LAST_CHECKED_TIME: query = "update WorkflowActionBean a set a.lastCheckTimestamp = :lastCheckTime where a.id = :id");
UPDATE_ACTION_START: query = "update WorkflowActionBean a set a.startTimestamp = :startTime, a.externalChildIDs = :externalChildIDs, a.conf = :conf, a.errorCode = :errorCode, a.errorMessage = :errorMessage, a.startTimestamp = :startTime, a.externalId = :externalId, a.trackerUri = :trackerUri, a.consoleUrl = :consoleUrl, a.lastCheckTimestamp = :lastCheckTime, a.statusStr = :status, a.externalStatus = :externalStatus, a.data = :data, a.retries = :retries, a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.userRetryCount = :userRetryCount where a.id = :id");
UPDATE_ACTION_CHECK: query = "update WorkflowActionBean a set a.userRetryCount = :userRetryCount, a.stats = :stats, a.externalChildIDs = :externalChildIDs, a.externalStatus = :externalStatus, a.statusStr = :status, a.data = :data, a.pending = :pending, a.errorCode = :errorCode, a.errorMessage = :errorMessage, a.lastCheckTimestamp = :lastCheckTime, a.retries = :retries, a.pendingAgeTimestamp = :pendingAge, a.startTimestamp = :startTime where a.id = :id");
UPDATE_ACTION_END: query = "update WorkflowActionBean a set a.stats = :stats, a.errorCode = :errorCode, a.errorMessage = :errorMessage, a.retries = :retries, a.endTimestamp = :endTime, a.statusStr = :status, a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.signalValue = :signalValue, a.userRetryCount = :userRetryCount, a.externalStatus = :externalStatus where a.id = :id");
UPDATE_ACTION_PENDING: query = "update WorkflowActionBean a set a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.executionPath = :executionPath where a.id = :id");
UPDATE_ACTION_STATUS_PENDING: query = "update WorkflowActionBean a set a.statusStr = :status, a.pending = :pending, a.pendingAgeTimestamp = :pendingAge where a.id = :id");
UPDATE_ACTION_PENDING_TRANS: query = "update WorkflowActionBean a set a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.transition = :transition where a.id = :id");
UPDATE_ACTION_PENDING_TRANS_ERROR: query = "update WorkflowActionBean a set a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.transition = :transition, a.errorCode = :errorCode, a.errorMessage = :errorMessage where a.id = :id");
DELETE_ACTION: query = "delete from WorkflowActionBean a where a.id IN (:id)");
DELETE_ACTIONS_FOR_WORKFLOW: query = "delete from WorkflowActionBean a where a.wfId IN (:wfId)");
GET_ACTIONS: query = "select OBJECT(a) from WorkflowActionBean a");
GET_ACTION: query = "select OBJECT(a) from WorkflowActionBean a where a.id = :id");
GET_ACTION_ID_TYPE_LASTCHECK: query = "select a.id, a.type, a.lastCheckTimestamp from WorkflowActionBean a where a.id = :id");
GET_ACTION_FAIL: query = "select a.id, a.wfId, a.name, a.statusStr, a.pending, a.type, a.logToken, a.transition, a.errorCode, a.errorMessage from WorkflowActionBean a where a.id = :id");
GET_ACTION_SIGNAL: query = "select a.id, a.wfId, a.name, a.statusStr, a.pending, a.pendingAgeTimestamp, a.type, a.logToken, a.transition, a.errorCode, a.errorMessage, a.executionPath, a.signalValue, a.slaXml, a.externalId from WorkflowActionBean a where a.id = :id");
GET_ACTION_CHECK: query = "select a.id, a.wfId, a.name, a.statusStr, a.pending, a.pendingAgeTimestamp, a.type, a.logToken, a.transition, a.retries, a.userRetryCount, a.userRetryMax, a.userRetryInterval, a.trackerUri, a.startTimestamp, a.endTimestamp, a.lastCheckTimestamp, a.errorCode, a.errorMessage, a.externalId, a.externalStatus, a.externalChildIDs, a.conf from WorkflowActionBean a where a.id = :id");
GET_ACTION_END: query = "select a.id, a.wfId, a.name, a.statusStr, a.pending, a.pendingAgeTimestamp, a.type, a.logToken, a.transition, a.retries, a.trackerUri, a.userRetryCount, a.userRetryMax, a.userRetryInterval, a.startTimestamp, a.endTimestamp, a.errorCode, a.errorMessage, a.externalId, a.externalStatus, a.externalChildIDs, a.conf, a.data, a.stats from WorkflowActionBean a where a.id = :id");
GET_ACTION_COMPLETED: query = "select a.id, a.wfId, a.statusStr, a.type, a.logToken from WorkflowActionBean a where a.id = :id");
GET_ACTION_FOR_UPDATE: query = "select OBJECT(a) from WorkflowActionBean a where a.id = :id");
GET_ACTION_FOR_SLA: query = "select a.id, a.statusStr, a.startTimestamp, a.endTimestamp from WorkflowActionBean a where a.id = :id");
GET_ACTIONS_FOR_WORKFLOW: query = "select OBJECT(a) from WorkflowActionBean a where a.wfId = :wfId order by a.startTimestamp");
GET_ACTIONS_OF_WORKFLOW_FOR_UPDATE: query = "select OBJECT(a) from WorkflowActionBean a where a.wfId = :wfId order by a.startTimestamp");
GET_PENDING_ACTIONS: query = "select a.id, a.wfId, a.statusStr, a.type, a.pendingAgeTimestamp from WorkflowActionBean a where a.pending = 1 AND a.pendingAgeTimestamp < :pendingAge AND a.statusStr <> 'RUNNING' AND a.createdTimeTS >= :createdTime");
GET_RUNNING_ACTIONS: query = "select a.id from WorkflowActionBean a where a.pending = 1 AND a.statusStr = 'RUNNING' AND a.lastCheckTimestamp < :lastCheckTime");
GET_RETRY_MANUAL_ACTIONS: query = "select OBJECT(a) from WorkflowActionBean a where a.wfId = :wfId AND (a.statusStr = 'START_RETRY' OR a.statusStr = 'START_MANUAL' OR a.statusStr = 'END_RETRY' OR a.statusStr = 'END_MANUAL')");
GET_ACTIONS_FOR_WORKFLOW_RERUN: query = "select a.id, a.name, a.statusStr, a.endTimestamp, a.type from WorkflowActionBean a where a.wfId = :wfId order by a.startTimestamp") });
SLASummaryBean:
mysql> desc SLA_SUMMARY;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
job_id | varchar(255) | NO | PRI | NULL | |
actual_duration | bigint(20) | YES | NULL | ||
actual_end | datetime | YES | NULL | ||
actual_start | datetime | YES | NULL | ||
app_name | varchar(255) | YES | MUL | NULL | |
app_type | varchar(255) | YES | NULL | ||
created_time | datetime | YES | NULL | ||
event_processed | tinyint(4) | YES | MUL | NULL | |
event_status | varchar(255) | YES | NULL | ||
expected_duration | bigint(20) | YES | NULL | ||
expected_end | datetime | YES | NULL | ||
expected_start | datetime | YES | NULL | ||
job_status | varchar(255) | YES | NULL | ||
last_modified | datetime | YES | MUL | NULL | |
nominal_time | datetime | YES | MUL | NULL | |
parent_id | varchar(255) | YES | MUL | NULL | |
sla_status | varchar(255) | YES | NULL | ||
user_name | varchar(255) | YES | NULL |
Java Entity-Mapper:
/**
* Class to store all the SLA related details (summary) per job
*/
public class SLASummaryBean implements JsonBean {
@Id
@Basic
@Column(name = "job_id")
private String jobId;
@Basic
@Index
@Column(name = "parent_id")
private String parentId;
@Basic
@Index
@Column(name = "app_name")
private String appName;
@Basic
@Column(name = "app_type")
private String appType;
@Basic
@Column(name = "user_name")
private String user;
@Basic
@Column(name = "created_time")
private Timestamp createdTimeTS = null;
@Basic
@Index
@Column(name = "nominal_time")
private Timestamp nominalTimeTS = null;
@Basic
@Column(name = "expected_start")
private Timestamp expectedStartTS = null;
@Basic
@Column(name = "expected_end")
private Timestamp expectedEndTS = null;
@Basic
@Column(name = "expected_duration")
private long expectedDuration = -1;
@Basic
@Column(name = "actual_start")
private Timestamp actualStartTS = null;
@Basic
@Column(name = "actual_end")
private Timestamp actualEndTS = null;
@Basic
@Column(name = "actual_duration")
private long actualDuration = -1;
@Basic
@Column(name = "job_status")
private String jobStatus;
@Basic
@Column(name = "event_status")
private String eventStatus;
@Basic
@Column(name = "sla_status")
private String slaStatus;
@Basic
@Index
@Column(name = "event_processed")
private byte eventProcessed = 0;
@Basic
@Index
@Column(name = "last_modified")
private Timestamp lastModifiedTS = null;
===============================================================================
UPDATE_SLA_SUMMARY_FOR_SLA_STATUS: query = "update SLASummaryBean w set w.slaStatus = :slaStatus, w.eventStatus = :eventStatus, w.eventProcessed = :eventProcessed, w.lastModifiedTS = :lastModifiedTS where w.jobId = :jobId"),
UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES: query = "update SLASummaryBean w set w.slaStatus = :slaStatus, w.eventStatus = :eventStatus, w.eventProcessed = :eventProcessed, w.jobStatus = :jobStatus, w.lastModifiedTS = :lastModifiedTS, w.actualStartTS = :actualStartTS, w.actualEndTS = :actualEndTS, w.actualDuration = :actualDuration where w.jobId = :jobId"),
UPDATE_SLA_SUMMARY_FOR_ACTUAL_TIMES: query = "update SLASummaryBean w set w.eventProcessed = :eventProcessed, w.actualStartTS = :actualStartTS, w.actualEndTS = :actualEndTS, w.actualEndTS = :actualEndTS, w.actualDuration = :actualDuration, w.lastModifiedTS = :lastModifiedTS where w.jobId = :jobId"),
UPDATE_SLA_SUMMARY_FOR_EXPECTED_TIMES: query = "update SLASummaryBean w set w.nominalTimeTS = :nominalTime, w.expectedStartTS = :expectedStartTime, w.expectedEndTS = :expectedEndTime, w.expectedDuration = :expectedDuration , w.lastModifiedTS = :lastModTime where w.jobId = :jobId"),
UPDATE_SLA_SUMMARY_EVENTPROCESSED: query = "update SLASummaryBean w set w.eventProcessed = :eventProcessed where w.jobId = :jobId"),
UPDATE_SLA_SUMMARY_LAST_MODIFIED_TIME: query = "update SLASummaryBean w set w.lastModifiedTS = :lastModifiedTS where w.jobId = :jobId"),
UPDATE_SLA_SUMMARY_ALL: query = "update SLASummaryBean w set w.jobId = :jobId, w.appName = :appName, w.appType = :appType, w.nominalTimeTS = :nominalTime, w.expectedStartTS = :expectedStartTime, w.expectedEndTS = :expectedEndTime, w.expectedDuration = :expectedDuration, w.jobStatus = :jobStatus, w.slaStatus = :slaStatus, w.eventStatus = :eventStatus, w.lastModifiedTS = :lastModTime, w.user = :user, w.parentId = :parentId, w.eventProcessed = :eventProcessed, w.actualDuration = :actualDuration, w.actualEndTS = :actualEndTS, w.actualStartTS = :actualStartTS where w.jobId = :jobId"),
GET_SLA_SUMMARY: query = "select OBJECT(w) from SLASummaryBean w where w.jobId = :id"),
GET_SLA_SUMMARY_RECORDS_RESTART: query = "select OBJECT(w) from SLASummaryBean w where w.eventProcessed <= 7 AND w.lastModifiedTS >= :lastModifiedTime"),
GET_SLA_SUMMARY_EVENTPROCESSED: query = "select w.eventProcessed from SLASummaryBean w where w.jobId = :id"),
GET_SLA_SUMMARY_EVENTPROCESSED_LAST_MODIFIED: query = "select w.eventProcessed, w.lastModifiedTS from SLASummaryBean w where w.jobId = :id")
SLARegistrationBean:
mysql> desc SLA_REGISTRATION;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
job_id | varchar(255) | NO | PRI | NULL | |
app_name | varchar(255) | YES | NULL | ||
app_type | varchar(255) | YES | NULL | ||
created_time | datetime | YES | NULL | ||
expected_duration | bigint(20) | YES | NULL | ||
expected_end | datetime | YES | NULL | ||
expected_start | datetime | YES | NULL | ||
job_data | varchar(255) | YES | NULL | ||
nominal_time | datetime | YES | MUL | NULL | |
notification_msg | varchar(255) | YES | NULL | ||
parent_id | varchar(255) | YES | NULL | ||
sla_config | varchar(255) | YES | NULL | ||
upstream_apps | varchar(255) | YES | NULL | ||
user_name | varchar(255) | YES | NULL |
Java Entity-Mapper:
public class SLARegistrationBean implements JsonBean {
@Id
@Basic
@Column(name = "job_id")
private String jobId;
@Basic
@Column(name = "parent_id")
private String parentId = null;
@Basic
@Column(name = "app_name")
private String appName = null;
@Basic
@Column(name = "app_type")
private String appType = null;
@Basic
@Column(name = "created_time")
private Timestamp createdTimeTS = null;
@Basic
@Index
@Column(name = "nominal_time")
private Timestamp nominalTimeTS = null;
@Basic
@Column(name = "expected_start")
private Timestamp expectedStartTS = null;
@Basic
@Column(name = "expected_end")
private Timestamp expectedEndTS = null;
@Basic
@Column(name = "expected_duration")
private long expectedDuration = -1;
@Basic
@Column(name = "user_name")
private String user = null;
@Basic
@Column(name = "upstream_apps")
private String upstreamApps = null;
@Basic
@Column(name = "job_data")
private String jobData = null;
@Basic
@Column(name = "sla_config")
private String slaConfig = null;
@Basic
@Column(name = "notification_msg")
private String notificationMsg = null;
@Transient
private Map slaConfigMap;
@Transient
private MessageType msgType;
================================================================================
UPDATE_SLA_REG_ALL: query = "update SLARegistrationBean w set w.jobId = :jobId, w.nominalTimeTS = :nominalTime, w.expectedStartTS = :expectedStartTime, w.expectedEndTS = :expectedEndTime, w.expectedDuration = :expectedDuration, w.slaConfig = :slaConfig, w.notificationMsg = :notificationMsg, w.upstreamApps = :upstreamApps, w.appType = :appType, w.appName = :appName, w.user = :user, w.parentId = :parentId, w.jobData = :jobData where w.jobId = :jobId"),
UPDATE_SLA_CONFIG: query = "update SLARegistrationBean w set w.slaConfig = :slaConfig where w.jobId = :jobId"),
UPDATE_SLA_EXPECTED_VALUE: query = "update SLARegistrationBean w set w.expectedStartTS = :expectedStartTime, w.expectedEndTS = :expectedEndTime , w.expectedDuration = :expectedDuration where w.jobId = :jobId"),
GET_SLA_REG_ON_RESTART: query = "select w.notificationMsg, w.upstreamApps, w.slaConfig, w.jobData from SLARegistrationBean w where w.jobId = :id"),
GET_SLA_REG_ALL: query = "select OBJECT(w) from SLARegistrationBean w where w.jobId = :id"),
GET_SLA_CONFIGS: query = "select w.jobId, w.slaConfig from SLARegistrationBean w where w.jobId IN (:ids)"),
GET_SLA_EXPECTED_VALUE_CONFIG: query = "select w.jobId, w.slaConfig, w.expectedStartTS, w.expectedEndTS, w.expectedDuration, w.nominalTimeTS from SLARegistrationBean w where w.jobId = :id"),
GET_SLA_REG_FOR_PARENT_ID: query = "select w.jobId, w.slaConfig from SLARegistrationBean w where w.parentId = :parentId")
SLAEventBean:
mysql> desc SLA_EVENTS;
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
event_id | bigint(20) | NO | PRI | NULL | auto_increment |
alert_contact | varchar(255) | YES | NULL | ||
alert_frequency | varchar(255) | YES | NULL | ||
alert_percentage | varchar(255) | YES | NULL | ||
app_name | varchar(255) | YES | NULL | ||
dev_contact | varchar(255) | YES | NULL | ||
group_name | varchar(255) | YES | NULL | ||
job_data | text | YES | NULL | ||
notification_msg | text | YES | NULL | ||
parent_client_id | varchar(255) | YES | NULL | ||
parent_sla_id | varchar(255) | YES | NULL | ||
qa_contact | varchar(255) | YES | NULL | ||
se_contact | varchar(255) | YES | NULL | ||
sla_id | varchar(255) | YES | NULL | ||
upstream_apps | text | YES | NULL | ||
user_name | varchar(255) | YES | NULL | ||
bean_type | varchar(31) | YES | MUL | NULL | |
app_type | varchar(255) | YES | NULL | ||
event_type | varchar(255) | YES | NULL | ||
expected_end | datetime | YES | NULL | ||
expected_start | datetime | YES | NULL | ||
job_status | varchar(255) | YES | NULL | ||
status_timestamp | datetime | YES | NULL |