use of com.evolveum.midpoint.task.api.RunningTask in project midpoint by Evolveum.
the class IterativeActivityRun method getRootTask.
@NotNull
protected final Task getRootTask(OperationResult result) throws SchemaException {
String rootTaskOid = getRootTaskOid();
RunningTask task = getRunningTask();
if (task.getOid().equals(rootTaskOid)) {
return task;
} else {
try {
return beans.taskManager.getTaskPlain(rootTaskOid, result);
} catch (ObjectNotFoundException e) {
// This is quite unexpected so it can be rethrown as SystemException
throw new SystemException("The root task was not found", e);
}
}
}
use of com.evolveum.midpoint.task.api.RunningTask in project midpoint by Evolveum.
the class IterativeActivityRun method getWorkBucket.
private WorkBucketType getWorkBucket(boolean initialRun, OperationResult result) throws ActivityRunException {
RunningTask task = taskRun.getRunningTask();
Holder<BucketProgressOverviewType> bucketProgressHolder = new Holder<>();
WorkBucketType bucket;
try {
GetBucketOperationOptions options = GetBucketOperationOptionsBuilder.anOptions().withDistributionDefinition(activity.getDefinition().getDistributionDefinition()).withFreeBucketWaitTime(FREE_BUCKET_WAIT_TIME).withCanRun(task::canRun).withExecuteInitialWait(initialRun).withImplicitSegmentationResolver(this).withIsScavenger(isScavenger(task)).withBucketProgressConsumer(bucketProgressHolder).build();
bucket = beans.bucketingManager.getWorkBucket(bucketingSituation.coordinatorTaskOid, bucketingSituation.workerTaskOid, activity.getPath(), options, getLiveBucketManagementStatistics(), result);
// We want to have the most current state of the running task.
task.refresh(result);
} catch (InterruptedException e) {
LOGGER.trace("InterruptedExecution in getWorkBucket for {}", task);
if (!task.canRun()) {
return null;
} else {
LoggingUtils.logUnexpectedException(LOGGER, "Unexpected InterruptedException in {}", e, task);
throw new SystemException("Unexpected InterruptedException: " + e.getMessage(), e);
}
} catch (Throwable t) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't allocate a work bucket for task {}", t, task);
throw new SystemException("Couldn't allocate a work bucket for task: " + t.getMessage(), t);
}
announceNumberOfBuckets(bucketProgressHolder.getValue(), result);
return bucket;
}
use of com.evolveum.midpoint.task.api.RunningTask in project midpoint by Evolveum.
the class AsyncUpdateActivityRun method iterateOverItemsInBucket.
@Override
public void iterateOverItemsInBucket(OperationResult opResult) throws CommunicationException, ObjectNotFoundException, SchemaException, ConfigurationException, ExpressionEvaluationException {
AsyncUpdateEventHandler handler = (event, hResult) -> {
SyncItemProcessingRequest<AsyncUpdateEvent> request = new SyncItemProcessingRequest<>(event, this);
return coordinator.submit(request, hResult);
};
RunningTask runningTask = getRunningTask();
ModelImplUtils.clearRequestee(runningTask);
getModelBeans().provisioningService.processAsynchronousUpdates(resourceObjectClass.getCoords(), handler, runningTask, opResult);
}
use of com.evolveum.midpoint.task.api.RunningTask in project midpoint by Evolveum.
the class AsyncUpdateActivityRun method beforeRun.
@Override
public void beforeRun(OperationResult result) throws ActivityRunException, CommonException {
RunningTask runningTask = getRunningTask();
ResourceObjectSetType resourceObjectSet = getResourceObjectSet();
resourceObjectClass = getModelBeans().syncTaskHelper.getResourceObjectClassCheckingMaintenance(resourceObjectSet, runningTask, result);
}
use of com.evolveum.midpoint.task.api.RunningTask in project midpoint by Evolveum.
the class LiveSyncActivityRun method beforeRun.
@Override
public void beforeRun(OperationResult result) throws ActivityRunException, CommonException {
RunningTask runningTask = getRunningTask();
ResourceObjectSetType resourceObjectSet = getResourceObjectSet();
resourceObjectClass = getModelBeans().syncTaskHelper.getResourceObjectClassCheckingMaintenance(resourceObjectSet, runningTask, result);
}
Aggregations