Commit 9d001ba0 authored by Daniel Eggert's avatar Daniel Eggert
Browse files

revised analysis trigger

parent 07974c05
......@@ -1623,6 +1623,23 @@ public class SceneDatabase {
return null;
}
public Integer[] getJobStatistics(long jobid) {
try {
PreparedStatement pst = con.prepareStatement(SqlStatements.GET_JOB_STATISTICS_QUERY);
pst.setLong(1, jobid);
ResultSet rs = pst.executeQuery();
if (rs.next()) {
return (Integer[]) rs.getArray(1).getArray();
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private ProcessingJob compileJob(ResultSet rs) throws SQLException {
ProcessingJob job = new ProcessingJob();
......
......@@ -66,9 +66,10 @@ public interface SqlStatements {
public static final String UPDATE_JOB_COMMENT_QUERY = "UPDATE jobs SET comment=? WHERE id=?;";
public static final String UPDATE_JOB_PROGRESS_QUERY = "UPDATE jobs SET progress=? WHERE id=?;";
public static final String UPDATE_INC_JOB_DOWNLOAD_STATS = "UPDATE jobs SET statistics[?] = statistics[?]+1 WHERE id=? AND statistics is not NULL RETURNING statistics;";
public static final String UPDATE_JOB_STATS = "UPDATE jobs SET statistics = ? WHERE id=?;";
public static final String UPDATE_JOB_STATS = "UPDATE jobs SET statistics = ? WHERE id=?;";
public static final String UPDATE_FINISHED_JOB_QUERY = "UPDATE jobs SET finishtime=CURRENT_TIMESTAMP, status=?::job_status, comment=?, statistics=?, failed_sceneids=? WHERE id=? RETURNING finishtime;";
public static final String JOB_COMMENT_QUERY = "SELECT comment FROM jobs WHERE id=?;";
public static final String GET_JOB_STATISTICS_QUERY = "SELECT statistics from jobs WHERE id=?;";
/**
* measures the area, width and height of the given region of interest
......
......@@ -245,7 +245,7 @@ public class ProcessingJob {
return procJob;
}
public ProcessingJob initAnalysisJobInstance() {
public ProcessingJob initAnalysisJobInstance(String scriptPath, String scriptParameter) {
if (isSubJob()) {
throw new UnsupportedOperationException("Unable to init processing subjob field, since this instance is already a subjob");
}
......@@ -291,8 +291,8 @@ public class ProcessingJob {
analysisJob.status = job_status.pending;
analysisJob.mode = job_mode.analysis_only;
analysisJob.statistics = null;
analysisJob.analysisParameter = this.analysisParameter;
analysisJob.pathAnalysisScript = this.pathAnalysisScript;
analysisJob.analysisParameter = scriptParameter;
analysisJob.pathAnalysisScript = scriptPath;
// set refjob id, if we have a valid one
if (isValidID(id)) {
......
......@@ -59,7 +59,7 @@ public class MetadatacrawlerModule {
// DatasetMetadata aster_l1t = new DatasetMetadata();
// aster_l1t.id = 189;
// aster_l1t.name = "ASTER_L1T";
crawlerTasks.put(usgs, Arrays.asList(landsat8c1));
// crawlerTasks.put(usgs, Arrays.asList(landsat8c1));
// crawlerTasks.put(usgs, Arrays.asList(aster_l1t, landsat7, landsat8));
// crawl sentinel2 from esa' scientific data hub
......@@ -67,7 +67,7 @@ public class MetadatacrawlerModule {
DatasetMetadata s2 = new DatasetMetadata();
s2.id = 249;
s2.name = "Sentinel-2";
// crawlerTasks.put(scihub, Arrays.asList(s2));
crawlerTasks.put(scihub, Arrays.asList(s2));
final boolean queryLatestOnly = true;
......
......@@ -32,7 +32,7 @@ public interface ControllerModuleInterface extends GmsModuleInterface {
*
*/
public void submitJob(ScenesProcessingProgressInterface progressMonitor, short virtualSensorId, short refDatasetId, long startTimestamp, long endTimestamp, double[] polygon,
Long[] sceneids, Short[] nonRefDatasetids, double maxCloudCover, int seasonCode, String jobMode, String pathAnalysisScript, String analysisScriptParameter);
Long[] sceneids, Short[] nonRefDatasetids, double maxCloudCover, int seasonCode, String jobMode, String[] pathAnalysisScript, String[] analysisScriptParameter);
public void addProgressMonitor(ScenesProcessingProgressInterface progressMonitor, long processid);
......
......@@ -23,6 +23,8 @@ public interface ScenesProcessingProgressInterface extends BatchDownloadProgress
public void downloadUpdateBatchFinished(long id, int numScenesToDownload, int numScenesSuccessfullyDownloaded, int numScenesFailedToDownload);
public void analysisProgressUpdate(long id, int[] statistics);
public void jobFinished(long id, boolean downloadsCanceled, boolean processingCanceled, boolean analysisCanceled, boolean success);
}
......@@ -27,7 +27,7 @@ public interface SceneProcessorModuleInterface extends GmsModuleInterface {
* @param jobid
* - id to reference the processing job
*/
public void executeProcessingScript(SceneProcessProgressInterface progressMonitor, String pathToScript, long jobid);
public void executeProcessingScript(SceneProcessProgressInterface progressMonitor, String[] envExports, String pathToScript, long jobid);
/**
* Executes the given script with the given parameters
......@@ -37,7 +37,7 @@ public interface SceneProcessorModuleInterface extends GmsModuleInterface {
* @param pathToScript
* @param scriptParameter
*/
public void executeProcessingScript(SceneProcessProgressInterface progressMonitor, long jobid, String pathToScript, String... scriptParameter);
public void executeProcessingScript(SceneProcessProgressInterface progressMonitor, String[] envExports, long jobid, String pathToScript, String... scriptParameter);
/**
* Cancels the processing for the given jobid
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment