public abstract class AbstractExperimentDAO extends Object implements ExperimentDAO
ExperimentDAO.
Note that it is strongly recommended to extend this class instead of
implementing the ExperimentDAO class directly since this class
already takes care of the synchronization problem of the
ExperimentDAO.connectCachedResultOrCreateTask(String, String, String, String, String) method.| Modifier and Type | Field and Description |
|---|---|
protected static int |
EXPERIMENT_TASK_NOT_CACHED
Sentinel value used to indicate that an experiment task with the given
preferences couldn't be found.
|
protected boolean |
initialized |
protected long |
resultDurability |
CACHED_EXPERIMENT_TASK_CAN_BE_USED, TASK_FINISHED, TASK_NOT_FOUND, TASK_STARTED_BUT_NOT_FINISHED_YET| Constructor and Description |
|---|
AbstractExperimentDAO() |
AbstractExperimentDAO(long resultDurability) |
| Modifier and Type | Method and Description |
|---|---|
int |
connectCachedResultOrCreateTask(String annotatorName,
String datasetName,
String experimentType,
String matching,
String experimentId)
This method is called with the description of an experiment task and an
experiment id.
|
protected abstract void |
connectExistingTaskWithExperiment(int experimentTaskId,
String experimentId)
This method connects an already existing experiment task with an
experiment.
|
protected abstract List<String[]> |
getAnnotatorDatasetCombinations(String experimentType,
String matching)
Deprecated.
|
protected abstract int |
getCachedExperimentTaskId(String annotatorName,
String datasetName,
String experimentType,
String matching)
The method checks whether there exists an experiment task with the given
preferences inside the database.
|
protected abstract ExperimentTaskResult |
getLatestExperimentTaskResult(String experimentType,
String matching,
String annotatorName,
String datasetName)
Deprecated.
|
List<ExperimentTaskResult> |
getLatestResultsOfExperiments(String experimentType,
String matching)
Deprecated.
|
long |
getResultDurability() |
void |
initialize()
The
AbstractExperimentDAO class makes sure that an instance is
initialized only once even if this method is called multiple times. |
void |
setResultDurability(long resultDurability)
Sets the durability of a experiment task result.
|
protected abstract void |
setRunningExperimentsToError()
Searches the database for experiment tasks that have been started but not
ended yet (their status equals
ExperimentDAO.TASK_STARTED_BUT_NOT_FINISHED_YET ) and set their status to
ErrorTypes.SERVER_STOPPED_WHILE_PROCESSING. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateTask, getAllRunningExperimentTasks, getExperimentState, getHighestExperimentId, getLatestResultsOfExperiments, getResultOfExperimentTask, getResultsOfExperiment, setExperimentState, setExperimentTaskResultprotected static final int EXPERIMENT_TASK_NOT_CACHED
protected long resultDurability
protected boolean initialized
public AbstractExperimentDAO()
public AbstractExperimentDAO(long resultDurability)
public void initialize()
AbstractExperimentDAO class makes sure that an instance is
initialized only once even if this method is called multiple times.initialize in interface ExperimentDAOprotected abstract void setRunningExperimentsToError()
ExperimentDAO.TASK_STARTED_BUT_NOT_FINISHED_YET ) and set their status to
ErrorTypes.SERVER_STOPPED_WHILE_PROCESSING. This method should
only be called directly after the initialization of the database. It
makes sure that "old" experiment tasks which have been started but never
finished are set to an error state and can't be used inside the caching
mechanism.public void setResultDurability(long resultDurability)
ExperimentDAOsetResultDurability in interface ExperimentDAOpublic long getResultDurability()
public int connectCachedResultOrCreateTask(String annotatorName, String datasetName, String experimentType, String matching, String experimentId)
ExperimentDAOExperimentDAO.CACHED_EXPERIMENT_TASK_CAN_BE_USED
= -1 is returned. Otherwise, a
new experiment task is created, set to unfinished by setting its state to
ExperimentDAO.TASK_STARTED_BUT_NOT_FINISHED_YET, connected to the given
experiment and the id of the newly created experiment task is returned.
NOTE: this method MUST be synchronized since it should only be
called by a single thread at once.connectCachedResultOrCreateTask in interface ExperimentDAOannotatorName - the name with which the annotator can be identifieddatasetName - the name of the datasetexperimentType - the name of the experiment typematching - the name of the matching usedexperimentId - the id of the experimentExperimentDAO.CACHED_EXPERIMENT_TASK_CAN_BE_USED=
-1 if there is already
an experiment task with the given preferences or the id of the
newly created experiment task.protected abstract int getCachedExperimentTaskId(String annotatorName, String datasetName, String experimentType, String matching)
EXPERIMENT_TASK_NOT_CACHED is
returned.
NOTE: this method MUST be synchronized since it should only be
called by a single thread at once.annotatorName - the name with which the annotator can be identifieddatasetName - the name of the datasetexperimentType - the name of the experiment typematching - the name of the matching usedprotected abstract void connectExistingTaskWithExperiment(int experimentTaskId,
String experimentId)
experimentTaskId - the id of the experiment taskexperimentId - the id of the experiment@Deprecated public List<ExperimentTaskResult> getLatestResultsOfExperiments(String experimentType, String matching)
ExperimentDAOgetLatestResultsOfExperiments in interface ExperimentDAOexperimentType - the name of the experiment typematching - the name of the matching used@Deprecated protected abstract List<String[]> getAnnotatorDatasetCombinations(String experimentType, String matching)
experimentType - the name of the experiment typematching - the name of the matching used@Deprecated protected abstract ExperimentTaskResult getLatestExperimentTaskResult(String experimentType, String matching, String annotatorName, String datasetName)
annotatorName - the name with which the annotator can be identifieddatasetName - the name of the datasetexperimentType - the name of the experiment typematching - the name of the matching usedCopyright © 2014–2017. All rights reserved.