Skip to content

Commit

Permalink
GRAD2-2505: task is complete.
Browse files Browse the repository at this point in the history
GRAD2-2505: task is complete.
  • Loading branch information
infstar committed Feb 6, 2024
1 parent e4d6b67 commit f771516
Show file tree
Hide file tree
Showing 14 changed files with 215 additions and 382 deletions.

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.ZoneId;
import java.util.Date;
import java.util.List;

public abstract class BaseDistributionRunCompletionNotificationListener extends JobExecutionListenerSupport {
public abstract class BaseDistributionRunCompletionNotificationListener implements JobExecutionListener {

private static final Logger LOGGER = LoggerFactory.getLogger(BaseDistributionRunCompletionNotificationListener.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.*;

public abstract class BaseRunCompletionNotificationListener extends JobExecutionListenerSupport {
public abstract class BaseRunCompletionNotificationListener implements JobExecutionListener {

private static final Logger LOGGER = LoggerFactory.getLogger(BaseRunCompletionNotificationListener.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand All @@ -18,7 +18,7 @@
import java.util.Date;

@Component
public class EdwSnapshotCompletionNotificationListener extends JobExecutionListenerSupport {
public class EdwSnapshotCompletionNotificationListener implements JobExecutionListener {

private static final Logger LOGGER = LoggerFactory.getLogger(EdwSnapshotCompletionNotificationListener.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand All @@ -17,7 +17,7 @@
import java.util.Date;

@Component
public class RegenCertRunCompletionNotificationListener extends JobExecutionListenerSupport {
public class RegenCertRunCompletionNotificationListener implements JobExecutionListener {

private static final Logger LOGGER = LoggerFactory.getLogger(RegenCertRunCompletionNotificationListener.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,33 @@
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.stereotype.Component;

import java.time.ZoneId;
import java.util.Date;

@Component
public class UserScheduledCompletionNotificationListener extends JobExecutionListenerSupport {
public class UserScheduledCompletionNotificationListener implements JobExecutionListener {

private static final Logger LOGGER = LoggerFactory.getLogger(UserScheduledCompletionNotificationListener.class);
private static final String LOG_SEPARATION = "=======================================================================================";

@Autowired
// @Autowired
private GradBatchHistoryService gradBatchHistoryService;
@Autowired
// @Autowired
private TaskSchedulingService taskSchedulingService;

@Autowired RestUtils restUtils;
// @Autowired
private RestUtils restUtils;

public UserScheduledCompletionNotificationListener(GradBatchHistoryService gradBatchHistoryService,
TaskSchedulingService taskSchedulingService,
RestUtils restUtils) {
this.gradBatchHistoryService = gradBatchHistoryService;
this.taskSchedulingService = taskSchedulingService;
this.restUtils = restUtils;
}

@Override
public void afterJob(JobExecution jobExecution) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class RunRegularGradAlgorithmProcessor extends BaseProcessor {
@Override
public GraduationStudentRecord process(UUID key) throws Exception {
GraduationStudentRecord item = getItem(key);
// Thread.sleep(60000);
if (item != null) {
LOGGER.info("Processing partitionData = {}", item.getProgram());
summaryDTO.setBatchId(batchId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public class EducGradBatchGraduationApiConstants {
@Value("${batch.partitions.number}")
private int numberOfPartitions;

// Spring Batch Transaction Chunk Size
@Value("${batch.transaction.chunk-size}")
private int transactionChunkSize;

// Token expiry offset (seconds)
@Value("${batch.token-expiry.offset}")
private int tokenExpiryOffset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public class RegGradAlgBatchPerformanceWriter extends BaseWriter {
@Override
public void write(Chunk<? extends GraduationStudentRecord> list) {
if(!list.isEmpty()) {
GraduationStudentRecord gradStatus = list.getItems().get(0);
saveBatchStatus(gradStatus);
list.forEach(this::saveBatchStatus);
LOGGER.debug("Left:{}\n",summaryDTO.getReadCount()-summaryDTO.getProcessedCount());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public class TvrRunBatchPerformanceWriter extends BaseWriter {
@Override
public void write(Chunk<? extends GraduationStudentRecord> list) throws Exception {
if(!list.isEmpty()) {
GraduationStudentRecord gradStatus = list.getItems().get(0);
saveBatchStatus(gradStatus);
list.forEach(this::saveBatchStatus);
LOGGER.debug("Left:{}\n",summaryDTO.getReadCount()-summaryDTO.getProcessedCount());
}
}
Expand Down
11 changes: 6 additions & 5 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
spring:
jmx:
enabled: false
db-connection:
datasource:
hikari:
pool-name: educ-grad-batch-graduation-api-cp
maximum-pool-size: ${MAXIMUM_POOL_SIZE}
connection-timeout: ${CONNECTION_TIMEOUT}
max-lifetime: ${MAX_LIFETIME}
minimum-idle: ${MIN_IDLE}
keepalive-time: ${KEEP_ALIVE_TIME}
idle-timeout: ${IDLE_TIMEOUT}
url: ${CONNECTION_STRING}
username: ${USERNAME}
password: ${PASSWORD}
driver-class: oracle.jdbc.driver.OracleDriver
driver-class-name: oracle.jdbc.driver.OracleDriver
jpa:
show-sql: true
database-platform: org.hibernate.dialect.OracleDialect
Expand Down Expand Up @@ -138,6 +137,8 @@ authorization:
password: ${GRAD_CLIENT_SECRET}

batch:
transaction:
chunk-size: ${TRANSACTION_CHUNK_SIZE}
partitions:
number: ${NUMBER_OF_PARTITIONS}
regalg:
Expand Down Expand Up @@ -167,9 +168,9 @@ endpoint:
keycloak:
getToken: ${KEYCLOAK_TOKEN_URL}auth/realms/master/protocol/openid-connect/token
grad-graduation-api:
graduatestudent:
graduatestudent:
url: ${GRAD_GRADUATION_API}api/v1/graduate/studentid/%s/run/GS?batchId=%s
reportonlyrun:
reportonlyrun:
url: ${GRAD_GRADUATION_API}api/v1/graduate/studentid/%s/run/FMR?batchId=%s
tvrrun:
url: ${GRAD_GRADUATION_API}api/v1/graduate/studentid/%s/run/REGFM?batchId=%s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@Configuration
Expand Down
4 changes: 2 additions & 2 deletions tools/config/update-configmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ echo Creating config map "$APP_NAME"-config-map
oc create -n "$OPENSHIFT_NAMESPACE"-"$envValue" configmap "$APP_NAME"-config-map \
--from-literal=CONNECTION_TIMEOUT="60000" \
--from-literal=GRAD_TRAX_API="http://educ-grad-trax-api.$OPENSHIFT_NAMESPACE-$envValue.svc.cluster.local:8080/" \
--from-literal=MAX_LIFETIME="600000" \
--from-literal=MAX_LIFETIME="590000" \
--from-literal=GRAD_STUDENT_API="http://educ-grad-student-api.$OPENSHIFT_NAMESPACE-$envValue.svc.cluster.local:8080/" \
--from-literal=MAXIMUM_POOL_SIZE="25" \
--from-literal=APP_LOG_LEVEL="$APP_LOG_LEVEL" \
Expand All @@ -64,10 +64,10 @@ oc create -n "$OPENSHIFT_NAMESPACE"-"$envValue" configmap "$APP_NAME"-config-map
--from-literal=IDLE_TIMEOUT="300000" \
--from-literal=MAX_RETRY_ATTEMPTS="5" \
--from-literal=ENABLE_FLYWAY="true" \
--from-literal=KEEP_ALIVE_TIME="150000" \
--from-literal=TOKEN_EXPIRY_OFFSET="30" \
--from-literal=GRAD_GRADUATION_API="http://educ-grad-graduation-api.$OPENSHIFT_NAMESPACE-$envValue.svc.cluster.local:8080/" \
--from-literal=DIST_RUN_CRON="0 0 02 1 * *" \
--from-literal=TRANSACTION_CHUNK_SIZE="1" \
--from-literal=NUMBER_OF_PARTITIONS="10" \
--from-literal=KEYCLOAK_TOKEN_URL="https://soam-$envValue.apps.silver.devops.gov.bc.ca/" \
--from-literal=REG_ALG_CRON="0 30 18 * * *" \
Expand Down

0 comments on commit f771516

Please sign in to comment.