Skip to content

Commit

Permalink
(#3014) Improve setting of dataset status
Browse files Browse the repository at this point in the history
  • Loading branch information
squaregoldfish committed Nov 20, 2024
1 parent 1aa5eb9 commit 4af61d5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions WebApp/src/uk/ac/exeter/QuinCe/jobs/JobManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
import uk.ac.exeter.QuinCe.User.NoSuchUserException;
import uk.ac.exeter.QuinCe.User.User;
import uk.ac.exeter.QuinCe.User.UserDB;
import uk.ac.exeter.QuinCe.data.Dataset.DataSet;
import uk.ac.exeter.QuinCe.data.Dataset.DataSetDB;
import uk.ac.exeter.QuinCe.data.Dataset.InvalidDataSetStatusException;
import uk.ac.exeter.QuinCe.data.Files.DataFileDB;
import uk.ac.exeter.QuinCe.jobs.files.DataSetJob;
import uk.ac.exeter.QuinCe.jobs.files.FileJob;
import uk.ac.exeter.QuinCe.utils.DatabaseException;
import uk.ac.exeter.QuinCe.utils.DatabaseUtils;
Expand Down Expand Up @@ -194,18 +198,25 @@ public class JobManager {
* If the specified job class does not have the correct constructor
* @throws JobException
* If an unknown problem is found with the specified job class
* @throws InvalidDataSetStatusException
*/
public static long addJob(DataSource dataSource, User owner, String jobClass,
Properties properties) throws DatabaseException, MissingParamException,
NoSuchUserException, JobClassNotFoundException,
InvalidJobClassTypeException, InvalidJobConstructorException, JobException {
RecordNotFoundException, NoSuchUserException, JobClassNotFoundException,
InvalidJobClassTypeException, InvalidJobConstructorException, JobException,
InvalidDataSetStatusException {

long result = -1;
Connection conn = null;

try {
conn = dataSource.getConnection();
result = addJob(conn, owner, jobClass, properties);

if (properties.contains(DataSetJob.ID_PARAM)) {
DataSetDB.setDatasetStatus(conn,
(long) properties.get(DataSetJob.ID_PARAM), DataSet.STATUS_WAITING);
}
} catch (SQLException e) {
throw new DatabaseException("An error occurred while adding the job", e);
} catch (DatabaseException | MissingParamException | NoSuchUserException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public PlotPageData getData() {
protected void processDirtyData() {
try {
DataSetDB.setDatasetStatus(getDataSource(), datasetId,
DataSet.STATUS_SENSOR_QC);
DataSet.STATUS_WAITING);
Properties jobProperties = new Properties();
jobProperties.setProperty(DataReductionJob.ID_PARAM,
String.valueOf(datasetId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public PlotPageData getData() {
protected void processDirtyData() {
try {
DataSetDB.setDatasetStatus(getDataSource(), datasetId,
DataSet.STATUS_SENSOR_QC);
DataSet.STATUS_WAITING);
Properties jobProperties = new Properties();
jobProperties.put(DataReductionJob.ID_PARAM, String.valueOf(datasetId));
JobManager.addJob(getDataSource(), getUser(),
Expand Down

0 comments on commit 4af61d5

Please sign in to comment.