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

Add realtime inference consumer #90

Open
wants to merge 50 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b5191c6
Merge pull request #77 from RADAR-base/release-0.3.0
yatharthranjan Jul 17, 2018
36e8ae2
Merge pull request #83 from RADAR-base/release-0.4.0
nivemaham Sep 13, 2018
d549524
Initial impl for realtime consumers
yatharthranjan Apr 20, 2021
850c0e6
Fix dependencies
yatharthranjan Oct 18, 2021
3109e31
First complete set of conditions and actions
yatharthranjan Oct 20, 2021
70f1594
better use of enums
yatharthranjan Oct 20, 2021
1d5915a
add basic javadocs
yatharthranjan Oct 20, 2021
be852c8
simplify defaults and enum
yatharthranjan Oct 21, 2021
bc8cbc8
add support for filtering conditions and actions based on projects.
yatharthranjan Nov 30, 2021
9b08b8a
remove unintended check
yatharthranjan Nov 30, 2021
57c246f
add appserver related components to docker-compose.yml file
nivemaham Jan 12, 2022
72ac511
Merge remote-tracking branch 'origin/master' into add_realtime_consumer
yatharthranjan Jan 26, 2022
03f3762
minor fixes to make build successful
yatharthranjan Jan 26, 2022
9fb26af
Merge branch 'add_realtime_consumer' into intervention-trigger
nivemaham Feb 3, 2022
2b53ffc
resolve conflicts
nivemaham Feb 3, 2022
50af14f
move monitor configs to separate package
nivemaham Feb 3, 2022
a93afd8
rename NotifyConfig.java as EmailNotifyConfig
nivemaham Feb 3, 2022
e1a3b93
restructure email server config.
nivemaham Feb 3, 2022
25435cb
new intervention config model
nivemaham Feb 7, 2022
426f4e6
Commit InterventionMonitor
nivemaham Feb 7, 2022
077837b
Commit config format and object creation
nivemaham Feb 7, 2022
fac723b
Implemented intervention monitor and updated build config
blootsvoets Feb 15, 2022
5e61dd3
Simplify docker build to remove rest proxy
blootsvoets Feb 15, 2022
a37f5a7
Fix tests
blootsvoets Feb 15, 2022
628d17a
Fix docker setup
blootsvoets Feb 15, 2022
6522391
Use sh in docker
blootsvoets Feb 16, 2022
5811215
Move email senders and simplify config
blootsvoets Feb 16, 2022
3e199ef
Tested and fixed tests
blootsvoets Feb 16, 2022
9c25663
Tested full flow
blootsvoets Feb 17, 2022
618c9e7
Rename .java to .kt
yatharthranjan Feb 21, 2022
06e5482
Initial kotlin convert of added classes
yatharthranjan Feb 21, 2022
31af146
various fixes and improvements
yatharthranjan Feb 21, 2022
2e07eb5
Final improvements and fixes
yatharthranjan Feb 22, 2022
e7a8b9b
Minor updates
yatharthranjan Feb 22, 2022
4e92616
Add localisation support for AppServerIntervention.kt
yatharthranjan Feb 23, 2022
a24adcf
fix referenceTimestamp
yatharthranjan Feb 23, 2022
ed04048
exclude clinicalProtocol if null
yatharthranjan Feb 23, 2022
77a8082
fix eval
yatharthranjan Feb 23, 2022
0a745ce
fix and test email action
yatharthranjan Feb 24, 2022
17308f3
Notify admin in case of action, condition or consumer failure
yatharthranjan Feb 24, 2022
3d808c6
Add docs on realtime inference consumers
yatharthranjan Feb 24, 2022
bfa015c
Merge pull request #92 from RADAR-base/finalise_realtime_inference
yatharthranjan Feb 24, 2022
1fc45c6
JsonPathCondition.kt: return false if record value is null
yatharthranjan Feb 28, 2022
3c5b488
Add support for sending both notification and data message simultaneo…
yatharthranjan Mar 3, 2022
76ab324
send data messages with HIGH priority
yatharthranjan Mar 3, 2022
28a5874
make jitter configurable and null by default
yatharthranjan Mar 3, 2022
0b306f3
Fix ttl
yatharthranjan Mar 21, 2022
497f1ed
add explicit "type" to protocol
yatharthranjan May 17, 2022
41f3582
Add action for adding triggered task to user's schedule on appserver
yatharthranjan Nov 7, 2022
dde1b4a
Merge branch 'dev' into add_realtime_consumer
yatharthranjan Sep 25, 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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ smtp.env
/libs/

# Distribution
/radar-backend-*
/radar-backend-*
/src/integrationTest/docker/etc/google-credentials.json

temp
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ script:
- sudo docker-compose up -d zookeeper-1 kafka-1 schema-registry-1 && sleep 30 && sudo docker-compose run --rm integration-test
- sudo docker-compose down
- cd ../../..
after_script:
- ./gradlew sendCoverageToCodacy

deploy:
provider: releases
Expand All @@ -49,6 +47,3 @@ deploy:
skip_cleanup: true
on:
tags: true

after_deploy:
- ./gradlew bintrayUpload
28 changes: 14 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,44 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gradle:6.6.1-jdk11 as builder
FROM gradle:7.4-jdk17 as builder

RUN mkdir /code
WORKDIR /code

ENV GRADLE_OPTS=-Dorg.gradle.project.profile=prod \
ENV GRADLE_OPTS="-Dorg.gradle.project.profile=prod -Djdk.lang.Process.launchMechanism=vfork" \
GRADLE_USER_HOME=/code/.gradlecache

COPY ./gradle/profile.prod.gradle /code/gradle/
COPY ./build.gradle ./gradle.properties ./settings.gradle /code/

RUN gradle downloadRuntimeDependencies
RUN gradle downloadRuntimeDependencies copyDependencies startScripts

COPY ./src/ /code/src

RUN gradle distTar && \
tar xf build/distributions/*.tar && \
rm build/distributions/*.tar
RUN gradle jar

FROM openjdk:11-jre-slim
FROM azul/zulu-openjdk-alpine:17-jre-headless

MAINTAINER Nivethika M <nivethika@thehyve.nl> , Joris Borgdorff <joris@thehyve.nl> , Yatharth Ranjan <yatharth.ranjan@kcl.ac.uk>

LABEL description="RADAR-CNS Backend streams and monitor"

RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN apk add --no-cache curl

RUN mkdir -p /var/lib/radar/data
RUN chown 101:101 /var/lib/radar/data

ENV KAFKA_REST_PROXY http://rest-proxy:8082
ENV KAFKA_SCHEMA_REGISTRY http://schema-registry:8081
ENV RADAR_BACKEND_CONFIG /etc/radar.yml

COPY --from=builder /code/radar-backend-*/bin/* /usr/bin/
COPY --from=builder /code/radar-backend-*/lib/* /usr/lib/
COPY --from=builder /code/build/third-party/* /usr/lib/
COPY --from=builder /code/build/scripts/* /usr/bin/
COPY --from=builder /code/build/libs/* /usr/lib/

# Load topics validator
COPY ./src/main/docker/radar-backend-init /usr/bin

USER 101:101

ENTRYPOINT ["radar-backend-init"]
193 changes: 159 additions & 34 deletions README.md

Large diffs are not rendered by default.

72 changes: 44 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
// Apply the java plugin to add support for Java
id 'java'
id 'application'
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
}

//---------------------------------------------------------------------------//
Expand All @@ -14,10 +15,6 @@ version = '0.4.1-SNAPSHOT'
mainClassName = 'org.radarcns.RadarBackend'
applicationDefaultJvmArgs = ["-Dlog4j.configuration=log4j.properties"]


targetCompatibility = '11.0'
sourceCompatibility = '11.0'

ext {
moduleDescription = 'Kafka backend for processing device data.'
githubRepoName = 'RADAR-Base/RADAR-Backend'
Expand All @@ -27,23 +24,23 @@ ext {
issueUrl = 'https://github.com/' + githubRepoName + '/issues'
website = 'http://radar-base.org'

codacyVersion = '4.0.2'
confluentVersion = '5.5.1'
hamcrestVersion = '1.3'
kafkaVersion = '2.5.0'
jacksonVersion = '2.11.2'
confluentVersion = '7.0.1'
hamcrestVersion = '2.2'
kafkaVersion = '3.0.0'
jacksonVersion = '2.13.1'
javaMailVersion = '1.6.2'
junitVersion = '4.12'
junitVersion = '4.13.1'
findbugVersion = '3.0.2'
commonsCliVersion = '1.4'
mockitoVersion = '3.5.11'
radarCommonsVersion = '0.13.0'
radarSchemasVersion = '0.5.14'
mockitoVersion = '4.3.1'
radarCommonsVersion = '0.14.1-SNAPSHOT'
radarSchemasVersion = '0.7.6'
subethamailVersion = '3.1.7'
jsoupVersion = '1.13.1'
slf4jVersion = '1.7.30'
log4jVersion = '1.2.17'
avroVersion = '1.9.2'
jsoupVersion = '1.14.3'
slf4jVersion = '1.7.35'
reload4jVersion = '1.2.18.5'
avroVersion = '1.11.0'
jsonPathVersion = '2.7.0'
}

//---------------------------------------------------------------------------//
Expand All @@ -53,14 +50,9 @@ ext {
// In this section you declare where to find the dependencies of your project
repositories {
mavenCentral()
// Non-jcenter radar releases
maven { url 'http://dl.bintray.com/radar-cns/org.radarcns' }
maven { url 'http://dl.bintray.com/radar-base/org.radarbase' }
// Kafka/confluent releases
maven { url 'http://packages.confluent.io/maven/' }
// For working with dev-branches
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
// Github code
maven { url 'https://packages.confluent.io/maven/' }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'https://jitpack.io' }
}

Expand All @@ -69,11 +61,14 @@ dependencies {
implementation group: 'org.radarbase', name: 'radar-commons', version: radarCommonsVersion
implementation group: 'org.apache.avro', name: 'avro', version: avroVersion
implementation group: 'org.radarbase', name: 'radar-commons-testing', version: radarCommonsVersion
implementation group: 'org.radarcns', name: 'radar-schemas-commons', version: radarSchemasVersion
implementation group: 'org.radarbase', name: 'radar-schemas-commons', version: radarSchemasVersion
implementation group: 'org.radarbase', name: 'oauth-client-util', version: '0.8.1'
implementation group: 'org.radarbase', name: 'radar-app-config-client', version: '0.4.1-SNAPSHOT'

// Kafka streaming API
implementation group: 'org.apache.kafka', name: 'kafka-streams', version: kafkaVersion
implementation group: 'io.confluent', name: 'kafka-streams-avro-serde', version: confluentVersion
implementation group: 'io.confluent', name: 'kafka-json-serializer', version: confluentVersion

// Nonnull annotation
implementation group: 'com.google.code.findbugs' , name: 'jsr305' , version: findbugVersion
Expand All @@ -84,6 +79,7 @@ dependencies {
// Configuration @JsonProperty
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: jacksonVersion

// Monitor mail sending
implementation group: 'javax.mail', name: 'javax.mail-api', version: javaMailVersion
Expand All @@ -92,14 +88,34 @@ dependencies {
// JSoup html parser
implementation group: 'org.jsoup', name: 'jsoup', version: jsoupVersion

runtimeOnly group: 'org.radarbase', name: 'radar-commons-unsafe', version: radarCommonsVersion
// JsonPath for evaluating json conditions dynamically.
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: jsonPathVersion

runtimeOnly group: 'log4j', name: 'log4j', version: log4jVersion
runtimeOnly group: 'org.slf4j', name: 'slf4j-log4j12', version: slf4jVersion
runtimeOnly group: 'ch.qos.reload4j', name: 'reload4j', version: reload4jVersion
runtimeOnly group: 'org.slf4j', name: 'slf4j-reload4j', version: slf4jVersion
}

if (!hasProperty('profile')) {
ext.profile = 'dev'
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = [
"-Xjavac-arguments='-Xlint:unchecked -Xlint:deprecation'"
]
}
}

tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}

apply from: "gradle/profile.${profile}.gradle"
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
bintrayUser=
bintrayApiKey=
32 changes: 0 additions & 32 deletions gradle/codacy.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions gradle/profile.dev.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
apply from: 'gradle/test.gradle'
apply from: 'gradle/codacy.gradle'
apply from: 'gradle/style.gradle'
apply from: 'gradle/utilities.gradle'
apply from: 'gradle/publishing.gradle'
8 changes: 8 additions & 0 deletions gradle/profile.prod.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ task downloadRuntimeDependencies {
}
}

tasks.register("copyDependencies", Copy.class) {
from(configurations.named("runtimeClasspath").map { it.files })
into("$buildDir/third-party/")
doLast {
println("Copied third-party runtime dependencies")
}
}

processResources {
expand(version: version)
}
119 changes: 0 additions & 119 deletions gradle/publishing.gradle

This file was deleted.

Loading
Loading