Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 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
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ matrix:
- export PATH="$HOME/miniconda/bin:$PATH"
script:
- ./java/test.sh
- pushd java
- ./test_cluster.sh
- popd

- os: linux
dist: trusty
Expand Down
1 change: 0 additions & 1 deletion java/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ pkill -9 redis-server
pkill -9 redis
pkill -9 raylet
ps aux | grep ray | awk '{system("kill "$2);}'
rm /tmp/raylet*

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

2 changes: 1 addition & 1 deletion java/cli/src/main/java/org/ray/cli/RayCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private static void submit(CommandSubmit cmdSubmit, String configPath) throws Ex
RayLog.rapp.debug("registerApp " + appId + " for resouorce " + resourceId + " done");

// Unzip the package file.
String appDir = "/tmp/" + cmdSubmit.className;
String appDir = params.working_directory + "/" + cmdSubmit.className;
String extPath = appDir + "/" + packageName;
if (!FileUtil.createDir(extPath, false)) {
throw new RuntimeException("create dir " + extPath + " failed ");
Expand Down
2 changes: 2 additions & 0 deletions java/ray.config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ onebox_delay_seconds_before_run_app_logic = 0

use_raylet = false

raylet_port = 35567

; java class which main is served as the driver in a java worker
driver_class =

Expand Down
95 changes: 68 additions & 27 deletions java/test_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,71 @@

#############################
# build deploy file and deploy cluster
sh cleanup.sh
rm -rf local_deploy
./prepare.sh -t local_deploy
pushd local_deploy
local_ip=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
#echo "use local_ip" $local_ip
OVERWRITE="ray.java.start.redis_port=34222;ray.java.start.node_ip_address=$local_ip;ray.java.start.deploy=true;ray.java.start.run_mode=CLUSTER"
echo OVERWRITE is $OVERWRITE
./run.sh start --head --overwrite=$OVERWRITE > cli.log 2>&1 &
popd
sleep 10

# auto-pack zip for app example
pushd example
if [ ! -d "app1/" ];then
mkdir app1
fi
cp -rf target/ray-tutorial-1.0.jar app1/
zip -r app1.zip app1
popd

# run with cluster mode
pushd local_deploy
export RAY_CONFIG=ray/ray.config.ini
ARGS=" --package ../example/app1.zip --class org.ray.example.HelloWorld --args=test1,test2 --redis-address=$local_ip:34222"
../local_deploy/run.sh submit $ARGS
popd

function run_test() {
use_raylet="false"
if [ "$1" == "raylet" ]; then
sed -i 's/^use_raylet.*$/use_raylet = true/g' ray.config.ini
else
sed -i 's/^use_raylet.*$/use_raylet = false/g' ray.config.ini

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's a real problem. But I'd prefer not editing the file in place, because it makes the git state dirty.

@jovany-wang jovany-wang Aug 6, 2018

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this way is not great, I will try distinguishing raylet or non raylet mode byOVERWRITE.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using overwrite is fine, or you can create a temp config file

fi

sh cleanup.sh
rm -rf local_deploy

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will be stored in local_deploy? maybe move it to /tmp/local_deploy?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does CURR_WORK_DIR be not suitable?
@zhijunfu What do you think?

./prepare.sh -t local_deploy
pushd local_deploy
local_ips=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
local_ip=$(echo $local_ips | awk -F " " '{print $NF}')
echo "use local_ip" $local_ip

OVERWRITE="ray.java.start.redis_port=34222;ray.java.start.node_ip_address=$local_ip;ray.java.start.deploy=true;ray.java.start.run_mode=CLUSTER;ray.java.start.raylet_port=35567;"

echo OVERWRITE is $OVERWRITE
./run.sh start --head --overwrite=$OVERWRITE > cli.log 2>&1 &
popd
sleep 10

# auto-pack zip for app example
if [ ! -d "example/" ]; then
mkdir example
fi

pushd example
if [ ! -d "app1/" ]; then
mkdir app1
fi
popd

cp -rf tutorial/target/ray-tutorial-1.0.jar example/app1/
pushd example
zip -r app1.zip app1
popd

# run with cluster mode
pushd local_deploy
export RAY_CONFIG=ray/ray.config.ini
ARGS=" --package ../example/app1.zip --class org.ray.exercise.Exercise02 --args=test1,test2 --redis-address=$local_ip:34222"
../local_deploy/run.sh submit $ARGS
popd

# clean up
rm -rf example

sleep 3
# Remove raylet socket file.
if [[ -a /tmp/raylet35567 ]]; then
rm /tmp/raylet35567
fi

# Check the result
start_process_log=$(cat "./local_deploy/cli.log")
[[ ${start_process_log} =~ "Started Ray head node" ]] || exit 1
echo "Check: Ray all processes started."

execution_log=$(cat "./local_deploy/ray/run/org.ray.exercise.Exercise02/0.out.txt")
[[ ${execution_log} =~ "hello,world!" ]] || exit 1
echo "Check: The tests ran successfully."
}

run_test non-raylet
run_test raylet