Skip to content

Commit

Permalink
[th2-4504] migrate event healer to th2-processor-core base and book p…
Browse files Browse the repository at this point in the history
…age concept (#6)

* [th2-4262] Migrated to processor-core and book&page
* [th2-4262] added logic to update unsubmitted interval
* [th2-4262] added retry success for unsubmitted event
* [ TH2-4504] Reuse scheduler from ProcessorContext
  • Loading branch information
Nikita-Smirnov-Exactpro authored Nov 15, 2024
1 parent c89c2b1 commit f90f6de
Show file tree
Hide file tree
Showing 22 changed files with 936 additions and 829 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-unwelcome-words.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Checkout tool
Expand Down
32 changes: 18 additions & 14 deletions .github/workflows/dev-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,47 @@ on:
branches-ignore:
- master
- version-*
# paths:
# - gradle.properties
# - package_info.json

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Prepare custom build version
- name: Get branch name
id: branch
run: echo ::set-output name=branch_name::${GITHUB_REF#refs/*/}
run: echo "branch_name=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Get SHA of the commit
id: sha
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get release_version
id: ver
uses: christian-draeger/read-properties@1.0.1
uses: christian-draeger/read-properties@1.1.1
with:
path: gradle.properties
property: release_version
properties: release_version
- name: Build custom release version
id: release_ver
run: echo ::set-output name=value::"${{ steps.ver.outputs.value }}-${{ steps.branch.outputs.branch_name }}-${{ github.run_id }}"
run: echo value="${{ steps.ver.outputs.release_version }}-${{ steps.branch.outputs.branch_name }}-${{ github.run_id }}-${{ steps.sha.outputs.sha_short }}" >> $GITHUB_OUTPUT
- name: Show custom release version
run: echo ${{ steps.release_ver.outputs.value }}
# Build and publish image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- run: echo "::set-output name=REPOSITORY_NAME::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
id: meta
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ steps.release_ver.outputs.value }}
labels: com.exactpro.th2.${{ steps.meta.outputs.REPOSITORY_NAME }}=${{ steps.ver.outputs.value }}
build-args: |
release_version=${{ steps.release_ver.outputs.value }}
labels: com.exactpro.th2.${{ steps.meta.outputs.REPOSITORY_NAME }}=${{ steps.ver.outputs.value }}
24 changes: 11 additions & 13 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,26 @@ jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- run: echo "::set-output name=REPOSITORY_NAME::$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
id: meta
- name: Read version from gradle.properties
id: read_property
uses: christian-draeger/read-properties@1.0.1
uses: christian-draeger/read-properties@1.1.1
with:
path: ./gradle.properties
property: release_version
properties: release_version
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ steps.read_property.outputs.value }}
labels: com.exactpro.th2.${{ steps.meta.outputs.REPOSITORY_NAME }}=${{ steps.read_property.outputs.value }}
build-args: |
release_version=${{ steps.read_property.outputs.value }}
tags: ghcr.io/${{ github.repository }}:${{ steps.read_property.outputs.release_version }}
labels: com.exactpro.th2.${{ steps.meta.outputs.REPOSITORY_NAME }}=${{ steps.read_property.outputs.release_version }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:6.8-jdk11 AS build
FROM gradle:7.6-jdk11 AS build
ARG release_version
ARG nexus_url
ARG nexus_user
Expand Down
35 changes: 29 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ has a "success" status, the status of the parent is wrong. Healer finds the pare

## Configuration

There is an example of full configuration for the data processor
There is an example of full configuration (infra-2.0) for the data processor

```yaml
apiVersion: th2.exactpro.com/v1
Expand All @@ -17,12 +17,35 @@ spec:
image-version: <verison>
type: th2-conn
custom-config:
name: test-event-healer
version: 1.0.0
maxCacheCapacity: 1000
stateSessionAlias: my-processor-state
enableStoreState: false
from: 2021-06-16T12:00:00.00Z
to: 2021-06-17T14:00:00.00Z
intervalLength: PT10M
syncInterval: PT10M
awaitTimeout: 10
awaitUnit: SECONDS
events:
bookToScope:
book1: []
book2: []
processorSettings:
name: test-event-healer
version: 1.0.0
maxCacheCapacity: 1000
pins:
- name: server
connection-type: grpc
grpc:
client:
- name: to_data_provider
service-class: com.exactpro.th2.dataprovider.lw.grpc.DataProviderService
linkTo:
- box: lw-data-provider
pin: server
- name: to_data_provider_stream
service-class: com.exactpro.th2.dataprovider.lw.grpc.QueueDataProviderService
linkTo:
- box: lw-data-provider
pin: server
extended-settings:
service:
enabled: true
Expand Down
38 changes: 17 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
plugins {
id 'com.palantir.docker' version '0.25.0'
id 'org.jetbrains.kotlin.jvm' version '1.6.21'
id 'org.jetbrains.kotlin.kapt' version "1.6.21"
id 'java'
id 'java-library'
id 'application'
}

ext {
sharedDir = file("${project.rootDir}/shared")
}

group 'com.exactpro.th2'
version release_version

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

repositories {
maven {
name 'MavenLocal'
url sharedDir
}
mavenLocal()
mavenCentral()
maven {
Expand Down Expand Up @@ -52,31 +45,34 @@ jar {
}

dependencies {
api platform('com.exactpro.th2:bom:3.0.0')
api platform('com.exactpro.th2:bom:4.0.2')

compileOnly 'com.google.auto.service:auto-service:1.0.1'
kapt 'com.google.auto.service:auto-service:1.0.1'

implementation 'com.exactpro.th2:common:3.18.2'
implementation "com.exactpro.th2:grpc-crawler-data-processor:0.0.1"
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.2'

implementation "com.exactpro.th2:cradle-cassandra:2.14.0"
implementation 'com.exactpro.th2:common:4.0.0-TH2-4262-reduce-load-book-and-page-3574992387-SNAPSHOT'
implementation "com.exactpro.th2:common-utils:0.0.1-book-and-page-3572891451-SNAPSHOT"
implementation "com.exactpro.th2:processor-core:0.0.1-TH2-4262-reduce-load-book-and-page-3739179455-7524a15-SNAPSHOT"

implementation "org.slf4j:slf4j-log4j12"
implementation "org.slf4j:slf4j-api"
implementation 'junit:junit:4.13.1'
implementation "com.exactpro.th2:cradle-cassandra:4.0.0-dev-version-4-2548754188-SNAPSHOT"

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit5"
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.1.0'

testImplementation group: 'io.grpc', name: 'grpc-testing', version: '1.32.1'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.0"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.0"
testRuntimeOnly("org.junit.jupiter:junit-jupiter:5.9.0")

testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.11.2'
}

test {
useJUnitPlatform()
}

application {
mainClassName 'com.exactpro.th2.healer.BoxMain'
mainClass.set('com.exactpro.th2.processor.MainKt')
}

applicationName = 'service'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
125 changes: 0 additions & 125 deletions src/main/java/com/exactpro/th2/dataservice/healer/BoxMain.java

This file was deleted.

Loading

0 comments on commit f90f6de

Please sign in to comment.