Search in sources :

Example 1 with RemoteJob

use of com.b2international.snowowl.core.jobs.RemoteJob in project snow-owl by b2ihealthcare.

the class ClassificationJobRequest method execute.

@Override
public Boolean execute(final BranchContext context) {
    final RemoteJob job = context.service(RemoteJob.class);
    final String classificationId = job.getKey();
    final Branch branch = context.branch();
    final long headTimestamp = branch.headTimestamp();
    final ClassificationTracker tracker = context.service(ClassificationTracker.class);
    tracker.classificationRunning(classificationId, headTimestamp);
    try {
        executeClassification(context, classificationId, tracker);
    } catch (final ReasonerApiException e) {
        tracker.classificationFailed(classificationId);
        throw e;
    } catch (final Exception e) {
        LOGGER.error("Unexpected error encountered while running classification job.", e);
        tracker.classificationFailed(classificationId);
        throw new ReasonerApiException("Exception caught while running classification.", e);
    }
    return Boolean.TRUE;
}
Also used : RemoteJob(com.b2international.snowowl.core.jobs.RemoteJob) Branch(com.b2international.snowowl.core.branch.Branch) ReasonerApiException(com.b2international.snowowl.snomed.reasoner.exceptions.ReasonerApiException) ClassificationTracker(com.b2international.snowowl.snomed.reasoner.classification.ClassificationTracker) OWLOntologyCreationException(org.semanticweb.owlapi.model.OWLOntologyCreationException) ReasonerInterruptedException(org.semanticweb.owlapi.reasoner.ReasonerInterruptedException) OWLReasonerRuntimeException(org.semanticweb.owlapi.reasoner.OWLReasonerRuntimeException) LockedException(com.b2international.commons.exceptions.LockedException) ReasonerApiException(com.b2international.snowowl.snomed.reasoner.exceptions.ReasonerApiException)

Aggregations

LockedException (com.b2international.commons.exceptions.LockedException)1 Branch (com.b2international.snowowl.core.branch.Branch)1 RemoteJob (com.b2international.snowowl.core.jobs.RemoteJob)1 ClassificationTracker (com.b2international.snowowl.snomed.reasoner.classification.ClassificationTracker)1 ReasonerApiException (com.b2international.snowowl.snomed.reasoner.exceptions.ReasonerApiException)1 OWLOntologyCreationException (org.semanticweb.owlapi.model.OWLOntologyCreationException)1 OWLReasonerRuntimeException (org.semanticweb.owlapi.reasoner.OWLReasonerRuntimeException)1 ReasonerInterruptedException (org.semanticweb.owlapi.reasoner.ReasonerInterruptedException)1