forked from chrislusf/glow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request chrislusf#74 from justicezyx/more
Add a test script to start a local test cluster.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# Starts a test glow cluster of 1 master and 3 agents. Intends to be used in | ||
# tests only. Run this script in a separate shell window under the root | ||
# directory of the git repo. Press ctrl-c to kill all started processes. | ||
|
||
declare -r MASTER_PORT=8390 | ||
declare -r MASTER_ADDRESS="localhost:${MASTER_PORT}" | ||
declare -r AGENT_PORT1=8391 | ||
declare -r AGENT_PORT2=8392 | ||
declare -r AGENT_PORT3=8393 | ||
|
||
declare -r GLOW_BASE_DIR=/tmp/glow | ||
|
||
declare -a pids | ||
|
||
# Function to be called when user press ctrl-c. | ||
function ctrl_c() { | ||
for pid in "${pids[@]}" | ||
do | ||
echo "Killing ${pid}..." | ||
kill ${pid} | ||
|
||
# This suppresses the annoying "[pid] Terminated ..." message. | ||
wait ${pid} &>/dev/null | ||
done | ||
} | ||
|
||
trap ctrl_c SIGINT | ||
echo "You may press ctrl-c to kill all started processes..." | ||
|
||
go build glow.go | ||
glow master --address="${MASTER_ADDRESS}" &>/dev/null & | ||
pids+=($!) | ||
echo "Started glow master at ${MASTER_ADDRESS}, pid: $!" | ||
|
||
glow agent --dir="${GLOW_BASE_DIR}/agent1" --max.executors=5 --memory=500 \ | ||
--master="${MASTER_ADDRESS}" --port="${AGENT_PORT1}" &>/dev/null & | ||
pids+=($!) | ||
echo "Started glow agent, pid: $!" | ||
|
||
glow agent --dir="${GLOW_BASE_DIR}/agent2" --max.executors=5 --memory=500 \ | ||
--master="${MASTER_ADDRESS}" --port="${AGENT_PORT2}" &>/dev/null & | ||
pids+=($!) | ||
echo "Started glow agent, pid: $!" | ||
|
||
glow agent --dir="${GLOW_BASE_DIR}/agent3" --max.executors=5 --memory=500 \ | ||
--master="${MASTER_ADDRESS}" --port="${AGENT_PORT3}" &>/dev/null & | ||
pids+=($!) | ||
echo "Started glow agent, pid: $!" | ||
|
||
echo | ||
echo "Sleep for 10000 seconds..." | ||
sleep 10000 |