Search in sources :

Example 1 with ClassificationSchedulingRule

use of com.b2international.snowowl.snomed.reasoner.classification.ClassificationSchedulingRule in project snow-owl by b2ihealthcare.

the class ClassificationCreateRequest method execute.

@Override
public String execute(final BranchContext context) {
    final String repositoryId = context.info().id();
    final Branch branch = context.branch();
    final ClassificationTracker tracker = context.service(ClassificationTracker.class);
    final SnomedCoreConfiguration config = context.service(SnomedCoreConfiguration.class);
    final String user = !Strings.isNullOrEmpty(userId) ? userId : context.service(User.class).getUsername();
    tracker.classificationScheduled(classificationId, reasonerId, user, branch.path());
    final AsyncRequest<Boolean> jobRequest = new ClassificationJobRequestBuilder().setReasonerId(reasonerId).setParentLockContext(parentLockContext).addAllConcepts(additionalConcepts).build(branch.path());
    final ClassificationSchedulingRule rule = ClassificationSchedulingRule.create(config.getMaxReasonerCount(), repositoryId, branch.path());
    JobRequests.prepareSchedule().setKey(classificationId).setUser(user).setRequest(jobRequest).setDescription(String.format("Classifying the ontology on %s", branch.path())).setSchedulingRule(rule).buildAsync().get(context, SCHEDULE_TIMEOUT_MILLIS);
    return classificationId;
}
Also used : Branch(com.b2international.snowowl.core.branch.Branch) SnomedCoreConfiguration(com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration) ClassificationSchedulingRule(com.b2international.snowowl.snomed.reasoner.classification.ClassificationSchedulingRule) ClassificationTracker(com.b2international.snowowl.snomed.reasoner.classification.ClassificationTracker)

Aggregations

Branch (com.b2international.snowowl.core.branch.Branch)1 SnomedCoreConfiguration (com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration)1 ClassificationSchedulingRule (com.b2international.snowowl.snomed.reasoner.classification.ClassificationSchedulingRule)1 ClassificationTracker (com.b2international.snowowl.snomed.reasoner.classification.ClassificationTracker)1