TSK-629: review findings incorporated.
This commit is contained in:
parent
b7be70d09c
commit
30f3682c51
|
@ -44,8 +44,8 @@ public class TaskanaEngineConfiguration {
|
|||
private static final String H2_DRIVER = "org.h2.Driver";
|
||||
private static final String TASKANA_PROPERTIES = "/taskana.properties";
|
||||
private static final String TASKANA_ROLES_SEPARATOR = "|";
|
||||
private static final String TASKANA_JOB_TASK_UPDATES_PER_TRANSACTION = "taskana.jobs.batchSize";
|
||||
private static final String TASKANA_JOB_RETRIES_FOR_FAILED_TASK_UPDATES = "taskana.jobs.maxRetries";
|
||||
private static final String TASKANA_JOB_BATCHSIZE = "taskana.jobs.batchSize";
|
||||
private static final String TASKANA_JOB_RETRIES = "taskana.jobs.maxRetries";
|
||||
|
||||
private static final String TASKANA_DOMAINS_PROPERTY = "taskana.domains";
|
||||
private static final String TASKANA_CLASSIFICATION_TYPES_PROPERTY = "taskana.classification.types";
|
||||
|
@ -74,8 +74,8 @@ public class TaskanaEngineConfiguration {
|
|||
private List<LocalDate> customHolidays;
|
||||
|
||||
// Properties for task-update Job execution on classification change
|
||||
private int maxNumberOfTaskUpdatesPerTransaction;
|
||||
private int maxNumberOfJobRetries;
|
||||
private int jobBatchSize = 100;
|
||||
private int maxNumberOfJobRetries = 3;
|
||||
|
||||
// List of configured domain names
|
||||
protected List<String> domains = new ArrayList<String>();
|
||||
|
@ -138,23 +138,19 @@ public class TaskanaEngineConfiguration {
|
|||
}
|
||||
|
||||
private void initJobParameters(Properties props) {
|
||||
String taskUpdates = props.getProperty(TASKANA_JOB_TASK_UPDATES_PER_TRANSACTION);
|
||||
if (taskUpdates == null || taskUpdates.isEmpty()) {
|
||||
maxNumberOfTaskUpdatesPerTransaction = 50;
|
||||
} else {
|
||||
maxNumberOfTaskUpdatesPerTransaction = Integer.parseInt(taskUpdates);
|
||||
String jobBatchSizeProperty = props.getProperty(TASKANA_JOB_BATCHSIZE);
|
||||
if (jobBatchSizeProperty != null && !jobBatchSizeProperty.isEmpty()) {
|
||||
jobBatchSize = Integer.parseInt(jobBatchSizeProperty);
|
||||
}
|
||||
|
||||
String retries = props.getProperty(TASKANA_JOB_RETRIES_FOR_FAILED_TASK_UPDATES);
|
||||
if (retries == null || retries.isEmpty()) {
|
||||
maxNumberOfJobRetries = 3;
|
||||
} else {
|
||||
maxNumberOfJobRetries = Integer.parseInt(retries);
|
||||
String maxNumberOfJobRetriesProperty = props.getProperty(TASKANA_JOB_RETRIES);
|
||||
if (maxNumberOfJobRetriesProperty != null && !maxNumberOfJobRetriesProperty.isEmpty()) {
|
||||
maxNumberOfJobRetries = Integer.parseInt(maxNumberOfJobRetriesProperty);
|
||||
}
|
||||
|
||||
LOGGER.debug(
|
||||
"Configured number of task updates per transaction: {}, number of retries of failed task updates: {}",
|
||||
maxNumberOfTaskUpdatesPerTransaction, maxNumberOfJobRetries);
|
||||
jobBatchSize, maxNumberOfJobRetries);
|
||||
}
|
||||
|
||||
private void initDomains(Properties props) {
|
||||
|
@ -309,7 +305,7 @@ public class TaskanaEngineConfiguration {
|
|||
}
|
||||
|
||||
public int getMaxNumberOfTaskUpdatesPerTransaction() {
|
||||
return maxNumberOfTaskUpdatesPerTransaction;
|
||||
return jobBatchSize;
|
||||
}
|
||||
|
||||
public int getMaxNumberOfJobRetries() {
|
||||
|
|
|
@ -15,14 +15,12 @@ public class JobRunner {
|
|||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskServiceImpl.class);
|
||||
private TaskanaEngine taskanaEngine;
|
||||
private TaskanaTransactionProvider<Object> txProvider;
|
||||
private int batchSize = 50;
|
||||
private int maxRetryCount;
|
||||
private int attempt = 0;
|
||||
|
||||
public JobRunner(TaskanaEngine taskanaEngine) {
|
||||
this.taskanaEngine = taskanaEngine;
|
||||
maxRetryCount = taskanaEngine.getConfiguration().getMaxNumberOfJobRetries();
|
||||
batchSize = taskanaEngine.getConfiguration().getMaxNumberOfTaskUpdatesPerTransaction();
|
||||
}
|
||||
|
||||
public void registerTransactionProvider(
|
||||
|
|
|
@ -8,5 +8,5 @@ taskana.domains= Domain_A , DOMAIN_B
|
|||
taskana.classification.types= TASK , document
|
||||
taskana.classification.categories= EXTERNAL , manual, autoMAtic ,Process
|
||||
|
||||
taskana.jobs.taskupdate.maxRetries=3
|
||||
taskana.jobs.taskupdate.batchSize=50
|
||||
taskana.jobs.maxRetries=3
|
||||
taskana.jobs.batchSize=50
|
||||
|
|
|
@ -92,7 +92,7 @@ public class TaskCleanupJobIntTest {
|
|||
new ParameterizedTypeReference<PagedResources<TaskSummaryResource>>() {
|
||||
});
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertEquals(71, response.getBody().getContent().size());
|
||||
assertEquals(73, response.getBody().getContent().size());
|
||||
|
||||
// wait until the next trigger time + 2 seconds to give JobScheduler a chance to run
|
||||
String cron = env.getProperty("taskana.jobscheduler.async.cron");
|
||||
|
@ -122,7 +122,7 @@ public class TaskCleanupJobIntTest {
|
|||
Thread.sleep(delay);
|
||||
LOGGER.info("Sleeping ended. Continuing .... ");
|
||||
|
||||
// verify the 25 completed tasks have been deleted.
|
||||
// verify the 6 completed tasks have been deleted.
|
||||
template = getRestTemplate();
|
||||
headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Basic YWRtaW46YWRtaW4="); // Role Admin
|
||||
|
@ -133,7 +133,7 @@ public class TaskCleanupJobIntTest {
|
|||
});
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
// TODO
|
||||
assertEquals(66, response.getBody().getContent().size());
|
||||
assertEquals(67, response.getBody().getContent().size());
|
||||
}
|
||||
|
||||
private void verifyTaskIsModifiedAfter(String taskId, Instant before) throws InvalidArgumentException {
|
||||
|
|
Loading…
Reference in New Issue