Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging the latest changes into optimzier branch #94

Open
wants to merge 161 commits into
base: jg/optimizer_refactor
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
b94769d
removing the map as with virtual threads it causes heap space issues …
jgoldverg Jan 2, 2024
5baa892
changed to file to have dynamic spring profiles
jgoldverg Jan 2, 2024
c6fa787
Found a few small bugs that were odd, also made the entityInfo give o…
jgoldverg Jan 3, 2024
5cfcf3b
Merge branch 'jg/optimizer_refactor' into master
jgoldverg Jan 3, 2024
7834d4c
Forgot to remove timestamps in the basewriter minimal change
jgoldverg Jan 3, 2024
5b439da
Aright im making sure the parallelism change is reflected correctly
jgoldverg Jan 18, 2024
fdfba04
Using many pools just to try
jgoldverg Jan 18, 2024
2a5776d
Aright this should be ideal now
jgoldverg Jan 18, 2024
859907c
Aright this should be it
jgoldverg Jan 18, 2024
4d1e175
Aright made virtual and platform threads into spring profiles and ful…
jgoldverg Jan 18, 2024
0c2fbb0
Added carbon score concept which is on pmeter version 1.0.11
jgoldverg Jan 19, 2024
f627292
created a separate executor this way there is no overlap and it doesn…
jgoldverg Jan 19, 2024
1a94e4b
visual changes
jgoldverg Jan 19, 2024
af4268f
updated pmeter version
jgoldverg Jan 19, 2024
69778bd
latest alpine isnt working with py3-pi for some reason
jgoldverg Jan 19, 2024
05fec56
Aright making carbon reporting into a toggle where if its off the sco…
jgoldverg Jan 19, 2024
23d7d45
Little mistake with reporting parallelism
jgoldverg Jan 20, 2024
f710805
Whoops wrong key being used in the map
jgoldverg Jan 20, 2024
1ef8a7e
Aright this should have fixed the other issue with the key being wrong
jgoldverg Jan 20, 2024
28da793
Alright pushing the status to influx so the optimizer doesnt need to …
jgoldverg Jan 20, 2024
c01eb1d
Merge pull request #95 from didclab/jg/pushingIsRunningToInflux
jgoldverg Jan 20, 2024
1c7dd14
wrong key here accidentally
jgoldverg Jan 22, 2024
d2bd488
Merge remote-tracking branch 'refs/remotes/origin/master'
jgoldverg Jan 22, 2024
dd04151
patching to do one chunk download if the file size == chunkSize
jgoldverg Feb 6, 2024
d383072
not sure why those two got included
jgoldverg Feb 6, 2024
d38d66b
Few things: created a factory for readers, writers, and 2 expanders. …
jgoldverg Feb 8, 2024
6c6d43e
Publish to ECR
vgottipa Feb 9, 2024
87aae39
Add quotes to the tag
vgottipa Feb 12, 2024
8674adb
Tag change
vgottipa Feb 14, 2024
9aab0fe
Tag referencing
vgottipa Feb 14, 2024
0d7eee0
ECR AWS push
vgottipa Feb 16, 2024
a5c930f
ECR AWS push
vgottipa Feb 16, 2024
da2aad3
ECR AWS push
vgottipa Feb 16, 2024
70c1611
ECR AWS push
vgottipa Feb 16, 2024
368143b
ECR AWS push
vgottipa Feb 16, 2024
ad5216b
ECR AWS push
vgottipa Feb 16, 2024
dbefd5b
Publish to ECR
vgottipa Feb 18, 2024
ba09aa0
Publish to ECR
vgottipa Feb 18, 2024
dd12daf
Publish to ECR
vgottipa Feb 18, 2024
d3fb65b
Publish to ECR
vgottipa Feb 18, 2024
d40f478
Publish to ECR
vgottipa Feb 18, 2024
147fa86
Publish to ECR
vgottipa Feb 18, 2024
9bec797
Publish to ECR
vgottipa Feb 18, 2024
cce0c67
Publish to ECR
vgottipa Feb 18, 2024
124084f
Publish to ECR
vgottipa Feb 18, 2024
d870595
Publish to ECR
vgottipa Feb 18, 2024
c32ec9b
Publish to ECR
vgottipa Feb 18, 2024
a145fab
Publish to ECR
vgottipa Feb 18, 2024
6d43072
Publish to ECR
vgottipa Feb 18, 2024
ba7b140
Publish to ECR
vgottipa Feb 18, 2024
e7ac7b0
Publish to ECR
vgottipa Feb 19, 2024
96782a2
Publish to ECR
vgottipa Feb 19, 2024
809ceb8
Publish to ECR
vgottipa Feb 19, 2024
b9434ce
Publish to ECR
vgottipa Feb 19, 2024
d4e66c8
Publish to ECR
vgottipa Feb 19, 2024
97fe44b
Publish to ECR
vgottipa Feb 19, 2024
f727e6d
Publish to ECR
vgottipa Feb 19, 2024
6505527
Publish to ECR
vgottipa Feb 19, 2024
d887210
Publish to ECR
vgottipa Feb 19, 2024
9ff47aa
Publish to ECR
vgottipa Feb 19, 2024
5a835d9
Publish to ECR
vgottipa Feb 19, 2024
243e337
fixed routing key issue
jgoldverg Feb 19, 2024
5d2c284
ECR AWS push
vgottipa Feb 20, 2024
0f16c5d
ECR AWS push
vgottipa Feb 20, 2024
1ad85a2
ECR AWS push
vgottipa Feb 20, 2024
26632bd
ECR AWS push
vgottipa Feb 20, 2024
a965c90
ECR AWS push
vgottipa Feb 20, 2024
c07a759
ECR AWS push
vgottipa Feb 20, 2024
d91c08d
ECR AWS push
vgottipa Feb 20, 2024
7c500e8
ECR AWS push
vgottipa Feb 20, 2024
fa65e3b
Publish to ECR
vgottipa Feb 23, 2024
e415058
Publish to ECR
vgottipa Feb 23, 2024
264306a
Publish to ECR
vgottipa Feb 23, 2024
58b918e
Publish to ECR
vgottipa Feb 23, 2024
78c6cfd
Publish to ECR
vgottipa Feb 23, 2024
854f8eb
Publish to ECR
vgottipa Feb 23, 2024
7a5a54d
Merge branch 'master' into ecrchanges
vgottipa Mar 11, 2024
c5978af
Publish to ECR
vgottipa Mar 11, 2024
5878af0
Publish to ECR
vgottipa Mar 11, 2024
f270df8
Publish to ECR
vgottipa Mar 11, 2024
8bee73f
Publish to ECR
vgottipa Mar 11, 2024
23940ab
Publish to ECR
vgottipa Mar 11, 2024
5685da0
Publish to ECR
vgottipa Mar 11, 2024
35cc684
Publish to ECR
vgottipa Mar 11, 2024
6e4cb9f
Publish to ECR
vgottipa Mar 11, 2024
896da9e
Publish to ECR
vgottipa Mar 11, 2024
ac2077f
Publish to ECR
vgottipa Mar 11, 2024
b7a376c
Publish to ECR
vgottipa Mar 11, 2024
d810c49
Publish to ECR
vgottipa Mar 11, 2024
00ed90c
Publish to ECR
vgottipa Mar 11, 2024
4aedb97
Publish to ECR
vgottipa Mar 11, 2024
dd92ac2
New changes
vgottipa Mar 11, 2024
670ccd5
New changes
vgottipa Mar 11, 2024
e972a97
New changes
vgottipa Mar 11, 2024
9dc2223
New changes
vgottipa Mar 11, 2024
bb5ec6a
New changes
vgottipa Mar 11, 2024
4972002
New changes
vgottipa Mar 11, 2024
05cedf3
New changes
vgottipa Mar 11, 2024
143e112
Publish to ECR
vgottipa Mar 18, 2024
2cb184d
Merge pull request #96 from didclab/ecrchanges
jgoldverg Mar 18, 2024
00bfe1a
carbon rpc for pmeter is working
jgoldverg Apr 2, 2024
3eaccb3
fairly large refactor of job control, and implemented a clean approac…
jgoldverg Apr 4, 2024
a009fdd
removed the nasty map so ip's stayed ordered formally, first entry is…
jgoldverg Apr 4, 2024
d897c48
should be more or less done need to test on chameleon
jgoldverg Apr 8, 2024
9c8aaed
Merge pull request #97 from didclab/jg/CarbonRPC
jgoldverg Apr 8, 2024
8c4e4d1
Fixed the binding key to be correct now
jgoldverg Apr 9, 2024
c6a3515
Added breaks so messages dont cascade forgot
jgoldverg Apr 9, 2024
a8f27c1
Small changes
jgoldverg Apr 9, 2024
e9d4767
Less print lines
jgoldverg Apr 9, 2024
fe71e5f
yup
jgoldverg Apr 9, 2024
7863728
Changed the job launcher to support multiple jobs, and removed some c…
jgoldverg Apr 10, 2024
10dc188
Added DropBoxWriterSmallFile
likhithakotla May 15, 2024
c782c99
Delete parallel.txt
likhithakotla May 16, 2024
a85554d
Delete src/main/java/org/onedatashare/transferservice/odstransferserv…
likhithakotla May 16, 2024
a88ba95
Refactored classes that were duplicate for small file upload
jgoldverg May 24, 2024
5704c8b
changing the import
jgoldverg May 24, 2024
a0ef77a
fixing the config name
jgoldverg May 24, 2024
2f1dcee
Merge pull request #98 from didclab/likhitha-dev
jgoldverg May 24, 2024
7bbd1f1
Now using Vault to fully discover configuration from Vault, need to t…
jgoldverg Jun 5, 2024
66347fe
forgot to include the aws java sdk
jgoldverg Jun 5, 2024
196429e
corrected the maven dependency for aws
jgoldverg Jun 5, 2024
2cc0424
including region
jgoldverg Jun 5, 2024
de2cbc7
using the wrong aws java sdk, using v2 now.
jgoldverg Jun 7, 2024
ee20f11
hopefully this works, vault login via cli works but not via spring yet
jgoldverg Jun 9, 2024
b7c4b6b
approle authentication is fully working
jgoldverg Jun 10, 2024
cb258fc
testing aws auth now that I got that working
jgoldverg Jun 10, 2024
178d2f2
slight updates
jgoldverg Jun 17, 2024
97a3e34
Ok fixed the dev situation
jgoldverg Jun 21, 2024
1d42b95
instead of IAM role chaining just gonna use two separate profiles, on…
jgoldverg Jun 21, 2024
4e99dc3
fixed the connection pooling issue
jgoldverg Aug 12, 2024
1f17e36
controlling sizing
jgoldverg Aug 12, 2024
2870120
Added in hazelcast registration and de-registration for now. I hate t…
jgoldverg Sep 12, 2024
859df4e
Removing rabbitmq in faver of hazelcast
jgoldverg Sep 14, 2024
4c2f3fa
initial impl of auction driven design for transfer nodes recieving jobs
jgoldverg Sep 15, 2024
1ea8223
Aright everything is all set for rabbitmq work which ill deprecate in…
jgoldverg Sep 24, 2024
35e43f8
fully removed rabbitmq and now using hazelcast, more changes coming
jgoldverg Oct 28, 2024
94be8a9
removing the unnessary sslContext
jgoldverg Oct 28, 2024
9a317be
updated a few things out
jgoldverg Oct 28, 2024
862a550
Fully incorporated hazelcast
jgoldverg Oct 31, 2024
74c35da
merged conflicts
jgoldverg Oct 31, 2024
44d846f
Merge pull request #99 from didclab/jg/hazelcast_discovery
jgoldverg Oct 31, 2024
ac8afed
Hazelcast consumer and carbon monitoring is fully working
jgoldverg Nov 12, 2024
b63ed87
Carbon monitoring happens every 10min not 10sec
jgoldverg Nov 12, 2024
2bd7f1a
Forgot that we dont yet have a load balancer infront of the hz cluste…
jgoldverg Nov 12, 2024
4fd3a6b
pmeter nic now supports giving defaults
jgoldverg Nov 12, 2024
a4615a6
changing timing
jgoldverg Nov 12, 2024
d0b45e7
pinning ods nodes correctly
jgoldverg Nov 12, 2024
43d0129
including more logging
jgoldverg Nov 12, 2024
2f77f4b
Made hazelcast consumer fully async
jgoldverg Nov 21, 2024
cb5c113
forgot to remove fixedDelay
jgoldverg Nov 21, 2024
7fa6be0
Making hz consumer have unlimited threads
jgoldverg Nov 25, 2024
f7a738f
Should have made pools fully scaleable
jgoldverg Nov 25, 2024
bcf183f
use any available node connected to ODS
jgoldverg Nov 27, 2024
986ab60
Fixed querying jobs for connectors and ods based nodes
jgoldverg Nov 27, 2024
544258a
adjust
jgoldverg Nov 27, 2024
07222c0
logging
jgoldverg Nov 27, 2024
a8a2664
removing extra logging statements
jgoldverg Nov 27, 2024
345b332
ensured proper discovery of NIC in a much quicker way
jgoldverg Dec 2, 2024
4960207
ODS Connectors can compete for any job a user submits
jgoldverg Dec 2, 2024
2a2106b
included latest job execution for cli direct monitoring
jgoldverg Dec 5, 2024
2e281ad
Merge remote-tracking branch 'refs/remotes/origin/master'
jgoldverg Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 46 additions & 11 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: Docker Image CI
name: Docker Image Publish CI ( Dockerhub and ECR )

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
release:
types: [created]

jobs:

build:

runs-on: ubuntu-latest

outputs:
id: git_tag_output
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine tag type
id: tag_type
run: echo "::set-output name=is_release_tag::$(echo ${GITHUB_REF#refs/tags/} | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || echo 'false')"
- name: Set version
id: version
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -25,11 +29,42 @@ jobs:
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run:
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build and push
uses: docker/build-push-action@v5
- name: Build and push dockerhub
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: onedatashare/transfer_service:latest
tags: onedatashare/transfer_service:${{ env.VERSION }}

push-to-ecr:
needs: build
runs-on: ubuntu-latest
steps:
- name: Determine tag type
id: tag_type
run: echo "::set-output name=is_release_tag::$(echo ${GITHUB_REF#refs/tags/} | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || echo 'false')"
- name: Set version
id: version
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Setup AWS ECR Details
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-pf-aws-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push the tagged docker image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-pf-aws-ecr.outputs.registry }}
ECR_REPOSITORY: onedatashare/transfer_service
IMAGE_TAG: ${{ env.VERSION }}
run: |
docker pull onedatashare/transfer_service:$IMAGE_TAG
docker tag onedatashare/transfer_service:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
41 changes: 7 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,59 +1,32 @@
FROM maven:3.9.5-amazoncorretto-21 AS build
FROM maven:3.9.7-amazoncorretto-21 AS build

COPY src /home/app/src
COPY pom.xml /home/app
RUN mvn -f /home/app/pom.xml clean package -DskipTests

# Final Image
FROM amazoncorretto:21-alpine-jdk
FROM amazoncorretto:21-alpine3.18-jdk

RUN apk update
RUN apk --no-cache add python3-dev py3-pip build-base gcc linux-headers
RUN pip3 install pmeter-ods==1.0.8

RUN pip install pmeter-ods

COPY --from=build /home/app/target/ods-transfer-service-0.0.1-SNAPSHOT.jar /usr/local/lib/ods-transfer-service-0.0.1-SNAPSHOT.jar

ENV PIP_ROOT_USER_ACTION=ignore
ENV NODE_NAME="${NODE_NAME}"
ENV USER_NAME="${USER_NAME}"
ENV APP_NAME="${USER_NAME}"-"${NODE_NAME}"

ENV CONNECTOR_QUEUE="${APP_NAME}"
ENV ODS_GDRIVE_CLIENT_ID="${ODS_GDRIVE_CLIENT_ID}"
ENV ODS_GDRIVE_CLIENT_SECRET="${ODS_GDRIVE_CLIENT_SECRET}"
ENV ODS_GDRIVE_PROJECT_ID="onedatashare-dev"
ENV EUREKA_URI="${EUREKA_URI}"
ENV EUREKA_PASS="${EUREKA_PASS}"
ENV EUREKA_USER="${EUREKA_USER}"
ENV FOLDER_WITH_CERTS="${FOLDER_WITH_CERTS}"
COPY ${FOLDER_WITH_CERTS} /certs/
ENV COCKROACH_URI="${COCKROACH_URI}"
ENV COCKROACH_USER="${COCKROACH_USER}"
ENV COCKROACH_PASS="${COCKROACH_PASS}"
ENV RMQ_ADDRESS="amqps://b-0e720b16-3ea7-4227-ad65-6cce3704121c.mq.us-east-2.amazonaws.com:5671"

#use ODS user for your private queue.
#create creds through aws console
ENV AMPQ_USER="${AMPQ_USER}"
ENV AMPQ_PWD="${AMPQ_PWD}"

#change to monitor the active NIC
ENV PMETER_CLI_OPTIONS="-NS"
ENV PMETER_NIC_INTERFACE="${PMETER_NIC_INTERFACE:-eth0}"
ENV INFLUX_ORG="${INFLUX_ORG}"
ENV INFLUX_BUCKET="${USER_NAME}"
ENV INFLUX_TOKEN="${INFLUX_TOKEN}"
ENV INFLUX_URI="https://influxdb.onedatashare.org"
ENV ENABLE_PMETER="true"
ENV PMETER_CRON_EXP="*/15 * * * * *"

ENV OPTIMIZER_URL="${OPTIMIZER_URL}"
ENV OPTIMIZER_ENABLE="${OPTIMIZER_ENABLE}"
ENV SPRING_PROFILE="${SPRING_PROFILE:-hsql}"
ENV SPRING_PROFILES_ACTIVE=aws,virtual,cockroach

ENV PATH "/home/ods/.local/bin:${PATH}"

RUN mkdir -p $HOME/.pmeter/
RUN touch $HOME/.pmeter/transfer_service_pmeter_measure.txt

EXPOSE 8092
ENTRYPOINT ["java", "-Dspring.profiles.active=hsql","-jar", "/usr/local/lib/ods-transfer-service-0.0.1-SNAPSHOT.jar"]
ENTRYPOINT ["java","-jar", "/usr/local/lib/ods-transfer-service-0.0.1-SNAPSHOT.jar"]
74 changes: 58 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<properties>
<java.version>21</java.version>
<spring-cloud.version>2023.0.0-RC1</spring-cloud.version>
<spring-cloud.version>2023.0.2</spring-cloud.version>
</properties>

<repositories>
Expand All @@ -36,12 +36,43 @@
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>private-repository</id>
<name>Hazelcast Private Repository</name>
<url>https://repository.hazelcast.com/release/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-enterprise</artifactId>
<version>5.5.1</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-vault-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.vault</groupId>
<artifactId>spring-vault-core</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>influxdb-client-java</artifactId>
Expand All @@ -52,10 +83,6 @@
<artifactId>commons-pool2</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>com.box</groupId>
<artifactId>box-java-sdk</artifactId>
Expand Down Expand Up @@ -130,20 +157,25 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-jetty</artifactId>-->
<!-- </dependency>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-jetty</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
Expand All @@ -157,6 +189,16 @@
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>auth</artifactId>
<version>2.25.67</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sts</artifactId>
<version>2.25.67</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.onedatashare.transferservice.odstransferservice.Enum;

public enum MessageType {
CARBON_AVG_REQUEST, TRANSFER_JOB_REQUEST, APPLICATION_PARAM_CHANGE, STOP_JOB_REQUEST, CARBON_IP_REQUEST
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.onedatashare.transferservice.odstransferservice;

import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,40 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.retry.backoff.BackOffPolicy;
import org.springframework.retry.backoff.ExponentialBackOffPolicy;
import org.springframework.transaction.PlatformTransactionManager;

import javax.sql.DataSource;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;

@Configuration
public class BatchConfig {

// @Bean
// public JobLauncher jobLauncher(JobRepository jobRepository) {
// TaskExecutorJobLauncher taskExecutorJobLauncher = new TaskExecutorJobLauncher();
// taskExecutorJobLauncher.setJobRepository(jobRepository);
// return taskExecutorJobLauncher;
// }

@Bean
public Set<Long> jobIds() {
return new HashSet<>();
}

@Bean
public PlatformTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}

@Bean
public JobLauncher asyncJobLauncher(JobRepository jobRepository) {
public JobLauncher jobLauncher(JobRepository jobRepository) {
TaskExecutorJobLauncher jobLauncher = new TaskExecutorJobLauncher();
jobLauncher.setJobRepository(jobRepository);
jobLauncher.setTaskExecutor(new SimpleAsyncTaskExecutor());
SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
taskExecutor.setConcurrencyLimit(4);
jobLauncher.setTaskExecutor(taskExecutor);
return jobLauncher;
}


@Bean
public BackOffPolicy backOffPolicy() {
ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
backOffPolicy.setInitialInterval(TimeUnit.SECONDS.toMillis(5));
backOffPolicy.setMultiplier(2.0);
backOffPolicy.setMaxInterval(TimeUnit.DAYS.toMillis(1));
return backOffPolicy;
}

}

Loading