-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e test for a ranklens tutorial (#311)
* normalize url usage in cmdline args * add e2e to CI * make e2e test not hang
- Loading branch information
Showing
14 changed files
with
180 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
|
||
JAR=$1 | ||
TMPDIR=`mktemp -d /tmp/ranklens-XXXXXX` | ||
|
||
java -jar $JAR bootstrap \ | ||
--events src/test/resources/ranklens/events/ \ | ||
--out $TMPDIR \ | ||
--config src/test/resources/ranklens/config.yml | ||
|
||
echo "Boostrap done into dir $TMPDIR" | ||
|
||
java -jar $JAR train \ | ||
--input $TMPDIR/dataset \ | ||
--config src/test/resources/ranklens/config.yml \ | ||
--model-type lambdamart-lightgbm \ | ||
--model-file $TMPDIR/metarank.model | ||
|
||
echo "Training done" | ||
|
||
java -jar $JAR inference \ | ||
--config src/test/resources/ranklens/config.yml \ | ||
--model $TMPDIR/metarank.model \ | ||
--embedded-redis-features-dir $TMPDIR/features \ | ||
--format json \ | ||
--savepoint-dir $TMPDIR/savepoint & echo $! > $TMPDIR/inference.pid | ||
|
||
PID=`cat $TMPDIR/inference.pid` | ||
|
||
echo "Waiting for http server with pid=$PID to come online..." | ||
|
||
while ! nc -z localhost 8080; do | ||
sleep 5 | ||
echo "Trying to connect to :8080" | ||
done | ||
|
||
curl -v http://localhost:8080/health | ||
|
||
kill -TERM $PID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ai.metarank.mode | ||
|
||
import ai.metarank.mode.inference.FeedbackFlow.logger | ||
import ai.metarank.mode.inference.FlinkMinicluster | ||
import ai.metarank.util.Logging | ||
import cats.effect.IO | ||
import cats.effect.kernel.Resource | ||
import org.apache.flink.runtime.jobgraph.SavepointRestoreSettings | ||
import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment | ||
import org.apache.flink.streaming.util.TestStreamEnvironment | ||
|
||
object AsyncFlinkJob extends Logging { | ||
import ai.metarank.flow.DataStreamOps._ | ||
def execute(cluster: FlinkMinicluster, savepoint: Option[String] = None)(job: (StreamExecutionEnvironment) => Unit) = | ||
Resource.make(IO.fromCompletableFuture { | ||
IO { | ||
val env = new StreamExecutionEnvironment(new TestStreamEnvironment(cluster.cluster.getMiniCluster, 1)) | ||
job(env) | ||
val graph = env.getStreamGraph.getJobGraph | ||
savepoint.foreach(s => graph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(s, false))) | ||
logger.info(s"submitted job ${graph} to local cluster") | ||
cluster.client.submitJob(graph) | ||
} | ||
})(job => IO.fromCompletableFuture(IO { cluster.client.cancel(job) }).map(_ => Unit)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.