Skip to content

Commit 9b558c0

Browse files
committed
More streamlined local run script allowing scanned select
1 parent d989030 commit 9b558c0

File tree

9 files changed

+47
-13
lines changed

9 files changed

+47
-13
lines changed

API/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.ohnlp.backbone</groupId>
99
<artifactId>backbone-parent</artifactId>
10-
<version>1.0.9</version>
10+
<version>1.0.10</version>
1111
</parent>
1212

1313
<artifactId>api</artifactId>

Core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.ohnlp.backbone</groupId>
99
<artifactId>backbone-parent</artifactId>
10-
<version>1.0.9</version>
10+
<version>1.0.10</version>
1111
</parent>
1212

1313
<artifactId>core</artifactId>

Example-Backbone-Configs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.ohnlp.backbone</groupId>
99
<artifactId>backbone-parent</artifactId>
10-
<version>1.0.9</version>
10+
<version>1.0.10</version>
1111
</parent>
1212

1313
<artifactId>example-backbone-configs</artifactId>

IO/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.ohnlp.backbone</groupId>
99
<artifactId>backbone-parent</artifactId>
10-
<version>1.0.9</version>
10+
<version>1.0.10</version>
1111
</parent>
1212

1313
<groupId>org.ohnlp.backbone.io</groupId>

Plugin-Manager/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.ohnlp.backbone</groupId>
99
<artifactId>backbone-parent</artifactId>
10-
<version>1.0.9</version>
10+
<version>1.0.10</version>
1111
</parent>
1212

1313
<artifactId>plugin-manager</artifactId>

Plugin-Manager/src/main/java/org/ohnlp/backbone/pluginmanager/PluginManager.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,29 @@
55
import java.nio.file.*;
66
import java.nio.file.attribute.BasicFileAttributes;
77
import java.util.*;
8+
import java.util.stream.Collectors;
89

910
public class PluginManager {
1011

1112
public static void main(String... args) throws IOException {
13+
Set<String> builds = new HashSet<>();
14+
if (args.length > 0) {
15+
builds = Arrays.stream(args).map(String::toLowerCase).collect(Collectors.toSet());
16+
}
1217
List<File> modules = Arrays.asList(Objects.requireNonNull(new File("modules").listFiles()));
1318
List<File> configs = Arrays.asList(Objects.requireNonNull(new File("configs").listFiles()));
1419
List<File> resources = Arrays.asList(Objects.requireNonNull(new File("resources").listFiles()));
1520
for (File f : new File("bin").listFiles()) {
1621
if (!f.isDirectory()) {
1722
if (f.getName().startsWith("Backbone-Core") && !f.getName().endsWith("Packaged.jar")) {
1823
File source = f;
19-
File target = new File("bin/" + f.getName().substring(0, f.getName().length() - 4) + "-Packaged.jar");
20-
Files.copy(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING);
21-
install(target, modules, configs, resources);
22-
System.out.println("Successfully Packaged Platform-Specific JAR: " + target.getAbsolutePath());
24+
String type = f.getName().substring(14, f.getName().length() - 4);
25+
if (builds.size() == 0 || builds.contains(type.toLowerCase(Locale.ROOT))) {
26+
File target = new File("bin/Backbone-Core-" + type + "-Packaged.jar");
27+
Files.copy(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING);
28+
install(target, modules, configs, resources);
29+
System.out.println("Successfully Packaged Platform-Specific JAR: " + target.getAbsolutePath());
30+
}
2331
}
2432
}
2533
}

Transforms/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.ohnlp.backbone</groupId>
99
<artifactId>backbone-parent</artifactId>
10-
<version>1.0.9</version>
10+
<version>1.0.10</version>
1111
</parent>
1212

1313
<groupId>org.ohnlp.backbone.transforms</groupId>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.ohnlp.backbone</groupId>
88
<artifactId>backbone-parent</artifactId>
9-
<version>1.0.9</version>
9+
<version>1.0.10</version>
1010

1111

1212
<properties>

scripts/run_pipeline_local.sh

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
# Runs a backbone pipeline locally on a computer using an embedded flink cluster
44
# GCP or Spark options are recommended for production and/or large-scale use cases
55

6-
BACKBONE_CONFIG=NAME_OF_CONFIG_TO_USE.json
76

87
BACKBONEDIR=$(cd `dirname $0` && pwd)
98
cd $BACKBONEDIR
109

10+
echo "Repackaging Backbone with Current Configs, Modules, and Resources"
11+
java -cp bin/Plugin-Manager.jar org.ohnlp.backbone.pluginmanager.PluginManager Flink
12+
1113
FLINK_DIR=flink-1.14.3/bin
1214
FLINK_EXECUTABLE=$FLINK_DIR/flink
1315
if [ -f "$FLINK_EXECUTABLE" ]; then
@@ -17,12 +19,36 @@ else
1719
wget https://dlcdn.apache.org/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.11.tgz -O flink.tgz
1820
tar -xf flink.tgz
1921
echo "***Important***: Please adjust default flink settings located at flink-1.14.3/conf/flink-conf.yaml to match your hardware"
20-
echo "Particularly taskmanager.numberOfTaskSlots (generally number of cores * .8 rounded down), "
22+
echo "Particularly taskmanager.numberOfTaskSlots (generally number of cores available for use, good starting point is CPU * .8 rounded down), "
2123
echo "parallelism.default (set equal to number of task slots), "
2224
echo "and taskmanager.memory.process.size (good start is 2GB * number of task slots)"
2325
read -p "When done, press [ENTER] to continue"
2426
fi
2527

28+
if [ $# -eq 0 ]; then
29+
cd configs
30+
echo "No configuration parameter supplied, scanning for Available Configurations..."
31+
options=( $(find -mindepth 1 -maxdepth 1 -print0 -type f | xargs -0) )
32+
select opt in "${options[@]}" "Quit" ; do
33+
if (( REPLY == 1 + ${#options[@]} )) ; then
34+
exit
35+
36+
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
37+
BACKBONE_CONFIG=${opt#\./}
38+
break
39+
40+
else
41+
echo "Invalid option. Try another one."
42+
fi
43+
done
44+
cd ..
45+
else
46+
BACKBONE_CONFIG=$1
47+
fi
48+
49+
echo "Running Job with Configuration $BACKBONE_CONFIG"
50+
51+
2652
BACKBONE_PACKAGED_FILE=bin/Backbone-Core-Flink-Packaged.jar
2753
if [ -f "$BACKBONE_PACKAGED_FILE" ]; then
2854
echo "Starting Embedded Flink Cluster..."

0 commit comments

Comments
 (0)