Revision 28213
Added by Nikon Gasparis over 10 years ago
- updated to support more error types while issuing the request to retrieve records
modules/uoa-validator/trunk/src/main/java/gr/uoa/di/validator/dao/JobSubmittedDAOImpl.java | ||
---|---|---|
213 | 213 |
} |
214 | 214 |
|
215 | 215 |
@Override |
216 |
public Date setJobFinished(String jobId, String error) { |
|
216 |
public Date setJobFinished(String jobId, String error, Boolean failed) {
|
|
217 | 217 |
Date date_ended = null; |
218 | 218 |
Connection con = null; |
219 | 219 |
PreparedStatement stmt = null, stmt1 = null, stmt2 = null; |
... | ... | |
224 | 224 |
logger.debug("Accessing DB to set Submitted Job: "+jobId+" as finished"); |
225 | 225 |
try { |
226 | 226 |
|
227 |
if (failed) |
|
228 |
error = "Server responded with error while issuing the request to retrieve the records."; |
|
227 | 229 |
con = getConnection(); |
228 | 230 |
String query="UPDATE jobs SET status=?, ended=?, duration=?, error_information=? WHERE id=?"; |
229 | 231 |
stmt = con.prepareStatement(query); |
... | ... | |
255 | 257 |
|
256 | 258 |
int res = stmt.executeUpdate(); |
257 | 259 |
stmt.close(); |
260 |
// logger.debug("statement: "+stmt ); |
|
258 | 261 |
logger.debug("job lines updated: "+res ); |
259 | 262 |
if (error == null) { |
260 | 263 |
logger.debug("Checking results per rule.."); |
... | ... | |
271 | 274 |
logger.debug("Inserting job results.."); |
272 | 275 |
query="INSERT INTO job_results(rule_id,job_id,total,successes,groupby) VALUES(?,?,?,?,?)"; |
273 | 276 |
stmt2 = con.prepareStatement(query); |
274 |
logger.debug("debug.."); |
|
277 |
// logger.debug("debug..");
|
|
275 | 278 |
while (rs.next()) { |
276 | 279 |
// logger.debug("Inserting rule_id: "+ rs.getInt(1)+",job_id: "+ Integer.parseInt(jobId)+",total: "+ rs.getInt(2)+",successes: "+ rs.getInt(3)+",groupby: "+ rs.getString(4)); |
277 | 280 |
stmt2.setInt(1, rs.getInt(1)); |
modules/uoa-validator/trunk/src/main/java/gr/uoa/di/validator/dao/JobSubmittedDAO.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
public List<JobSubmitted> getJobs(); |
11 | 11 |
|
12 |
public Date setJobFinished(String id, String error); |
|
12 |
public Date setJobFinished(String id, String error, Boolean failed);
|
|
13 | 13 |
|
14 | 14 |
public boolean getJobError(String jobId); |
15 | 15 |
|
modules/uoa-validator/trunk/src/main/java/gr/uoa/di/validator/impls/executors/ThreadExecutorSubmitter.java | ||
---|---|---|
116 | 116 |
|
117 | 117 |
} |
118 | 118 |
} catch (DataException e) { |
119 |
log.error("", e); |
|
119 |
log.error("data error", e);
|
|
120 | 120 |
for(JobListener listener : listeners){ |
121 | 121 |
listener.failed(jobId, this.jobContext, e); |
122 | 122 |
} |
modules/uoa-validator/trunk/src/main/java/gr/uoa/di/validator/impls/listeners/ValidatorJobListener.java | ||
---|---|---|
138 | 138 |
if(internalJobsFinished == internalJobsSum) { |
139 | 139 |
logger.debug("JOBID:"+jobSubmittedId+"# Set job finished"); |
140 | 140 |
// Date ended = jobSubmittedDao.setJobFinished(Integer.toString(jobSubmittedId),null); |
141 |
jobSubmittedDao.setJobFinished(Integer.toString(jobSubmittedId),null); |
|
141 |
jobSubmittedDao.setJobFinished(Integer.toString(jobSubmittedId),null,false);
|
|
142 | 142 |
score = jobSubmittedDao.setScore(Integer.toString(jobSubmittedId),null,groupBy_xpath); |
143 | 143 |
jobContext.put("score", (int) score); |
144 | 144 |
jobContext.put("jobSubmittedId", (int) jobSubmittedId); |
... | ... | |
161 | 161 |
internalJobsFinished++; |
162 | 162 |
logger.debug("JOBID:"+jobSubmittedId+"# Set job finished-failed"); |
163 | 163 |
// Date ended = jobSubmittedDao.setJobFinished(Integer.toString(jobSubmittedId),"an error occured"); |
164 |
jobSubmittedDao.setJobFinished(Integer.toString(jobSubmittedId),t.getMessage()); |
|
164 |
jobSubmittedDao.setJobFinished(Integer.toString(jobSubmittedId),t.getMessage(), true);
|
|
165 | 165 |
score = jobSubmittedDao.setScore(Integer.toString(jobSubmittedId),"0",groupBy_xpath); |
166 | 166 |
jobContext.put("score", (int) 0); |
167 | 167 |
jobContext.put("jobSubmittedId", (int) jobSubmittedId); |
Also available in: Unified diff