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

Issue 198: Fixes to allow running in Flink examples in SDP #199

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions flink-connector-examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ apply plugin: "scala"
apply plugin: "distribution"
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

sourceCompatibility = "1.8"
archivesBaseName = 'pravega-flink-examples'
Expand All @@ -28,13 +29,18 @@ dependencies {
compile "org.apache.flink:flink-streaming-java_$flinkScalaVersion:${flinkVersion}"
compile "org.apache.flink:flink-streaming-scala_$flinkScalaVersion:${flinkVersion}"
compile "org.slf4j:slf4j-log4j12:${slf4jLog4JVersion}"
if (includePravegaCredentials.toBoolean()) {
compile "io.pravega:pravega-keycloak-credentials:${pravegaCredentialsVersion}"
}
}

shadowJar {
dependencies {
include dependency("org.scala-lang.modules:scala-java8-compat_$flinkScalaVersion")
include dependency("io.pravega:pravega-connectors-flink_$flinkScalaVersion")
}
classifier = ""
zip64 true
}

task scriptWordCountWriter(type: CreateStartScripts) {
Expand Down Expand Up @@ -108,3 +114,21 @@ distributions {
}
}
}

publishing {
repositories {
maven {
credentials {
username username
password password
}
url projectRepoUrl
}
}

publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
}
9 changes: 8 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#
### Pravega dependencies
pravegaVersion=0.6.0-50.076afef-SNAPSHOT
includePravegaCredentials=false
pravegaCredentialsVersion=0.4.0-2030.d99411b-0.0.1-020.26736d2

### Pravega-samples output library
samplesVersion=0.6.0-SNAPSHOT
Expand All @@ -26,4 +28,9 @@ hadoopVersion=2.8.1
kryoSerializerVersion=0.45
sparkVersion=2.2.0
scalaJava8CompatVersion=0.9.0
slf4jLog4JVersion=1.7.25
slf4jLog4JVersion=1.7.25

# Below is used for publishing to the Maven repo in Nautilus.
projectRepoUrl=http://localhost:9092/maven2
username=nautilus
password=password
11 changes: 7 additions & 4 deletions hadoop-connector-examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ repositories {
}

dependencies {
compile "io.pravega:pravega-connectors-hadoop:${hadoopConnectorVersion}"
compileOnly "org.apache.hadoop:hadoop-common:${hadoopVersion}"
compileOnly "org.apache.hadoop:hadoop-mapreduce-client-core:${hadoopVersion}"
compileOnly "org.apache.spark:spark-core_2.11:${sparkVersion}"
compile "io.pravega:pravega-connectors-hadoop:${hadoopConnectorVersion}"
compile "org.apache.hadoop:hadoop-common:${hadoopVersion}"
compile "org.apache.hadoop:hadoop-mapreduce-client-core:${hadoopVersion}"
compile "org.apache.spark:spark-core_2.11:${sparkVersion}"
if (includePravegaCredentials.toBoolean()) {
compile "io.pravega:pravega-keycloak-credentials:${pravegaCredentialsVersion}"
}
}

shadowJar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.apache.hadoop.io.Text;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
Expand Down Expand Up @@ -46,7 +47,8 @@ public static void main(String[] args) throws Exception {
conf.setStrings(PravegaConfig.INPUT_STREAM_NAME, remainingArgs[2]);
conf.setStrings(PravegaConfig.INPUT_DESERIALIZER, TextSerializer.class.getName());

JavaSparkContext sc = new JavaSparkContext(new SparkConf());
SparkConf sparkConf = new SparkConf().setAppName("wordcount").setMaster("local[1]");
JavaSparkContext sc = new JavaSparkContext(SparkContext.getOrCreate(sparkConf));

JavaPairRDD<EventKey, Text> lines = sc.newAPIHadoopRDD(conf, PravegaInputFormat.class, EventKey.class, Text.class);
JavaRDD<String> words = lines.map(x -> x._2).flatMap(s -> Arrays.asList(SPACE.split(s.toString())).iterator());
Expand Down
4 changes: 4 additions & 0 deletions pravega-client-examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ dependencies {

compile "org.slf4j:slf4j-api:1.7.14"
compile "ch.qos.logback:logback-classic:1.1.7"

if (includePravegaCredentials.toBoolean()) {
compile "io.pravega:pravega-keycloak-credentials:${pravegaCredentialsVersion}"
}
}

// Build examples
Expand Down
3 changes: 3 additions & 0 deletions scenarios/anomaly-detection/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ dependencies {
compile "org.apache.flink:flink-streaming-java_$flinkScalaVersion:${flinkVersion}"
compile "org.apache.flink:flink-connector-elasticsearch5_$flinkScalaVersion:${flinkVersion}"
compile "ch.qos.logback:logback-classic:1.1.7"
if (includePravegaCredentials.toBoolean()) {
compile "io.pravega:pravega-keycloak-credentials:${pravegaCredentialsVersion}"
}
}

shadowJar {
Expand Down
4 changes: 4 additions & 0 deletions scenarios/pravega-flink-connector-sql-samples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ dependencies {

compile "joda-time:joda-time:2.7"
compile "org.projectlombok:lombok:1.16.18"

if (includePravegaCredentials.toBoolean()) {
compile "io.pravega:pravega-keycloak-credentials:${pravegaCredentialsVersion}"
}
}

task scriptConnectorTableApiSamples(type: CreateStartScripts) {
Expand Down
3 changes: 3 additions & 0 deletions scenarios/turbine-heat-processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ dependencies {
compile "org.apache.flink:flink-streaming-java_$flinkScalaVersion:${flinkVersion}"
compile "org.apache.flink:flink-streaming-scala_$flinkScalaVersion:${flinkVersion}"
compile "org.slf4j:slf4j-log4j12:1.7.14"
if (includePravegaCredentials.toBoolean()) {
compile "io.pravega:pravega-keycloak-credentials:${pravegaCredentialsVersion}"
}
}

shadowJar {
Expand Down
4 changes: 4 additions & 0 deletions scenarios/turbine-heat-sensor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ dependencies {

compile "org.slf4j:slf4j-api:1.7.14"
compile "ch.qos.logback:logback-classic:1.1.7"

if (includePravegaCredentials.toBoolean()) {
compile "io.pravega:pravega-keycloak-credentials:${pravegaCredentialsVersion}"
}
}

task scriptTurbineSensor(type: CreateStartScripts) {
Expand Down