Skip to content

Commit

Permalink
Remove empty spaces that were accidentally placed in some scripts (ru…
Browse files Browse the repository at this point in the history
…n_all_examples.sh & functions_build.sh)
  • Loading branch information
CSpyridakis committed Dec 31, 2024
1 parent f4a0cf6 commit 2be5a52
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 58 deletions.
44 changes: 22 additions & 22 deletions scripts/functions_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,43 @@

# ===========================================================
# Colors for logging
CLR_RED='\033[0;31m'
CLR_GREEN='\033[0;32m'
CLR_RED='\033[0;31m'
CLR_GREEN='\033[0;32m'
CLR_YELLOW='\033[0;33m'
CLR_RST='\033[0m'

# DEBUG prints
function echo_r(){ echo -e "${CLR_RED}$*${CLR_RST}"; }
function echo_g(){ echo -e "${CLR_GREEN}$*${CLR_RST}"; }
function echo_r(){ echo -e "${CLR_RED}$*${CLR_RST}"; }
function echo_g(){ echo -e "${CLR_GREEN}$*${CLR_RST}"; }
function echo_y(){ echo -e "${CLR_YELLOW}$*${CLR_RST}"; }
# ===========================================================

if [ "$CLI" == "" ] ; then
if [ "$CLI" == "" ] ; then
CLI=target/debug/edgeless_cli
fi
fi
if [ ! -x "$CLI" ] ; then
echo_r "cli not found in '$CLI', specify its path in the CLI environment variable"
exit 1
fi
echo_r "cli not found in '$CLI', specify its path in the CLI environment variable"
exit 1
fi

rm -f build_functions.log 2> /dev/null
rm -f build_functions.log 2> /dev/null
RET=0
for func in $(find functions -type f -name function.json) ; do
for func in $(find functions -type f -name function.json) ; do
name=$(basename $(dirname $func))
echo -n "$name: "

wasm_name="$(dirname $func)/$(grep "\"id\"" $func | cut -f 4 -d '"').wasm"
wasm_name="$(dirname $func)/$(grep "\"id\"" $func | cut -f 4 -d '"').wasm"
if [ -r $wasm_name ] ; then
echo_g "[OK]"
else
else
echo -n "building."
target/debug/edgeless_cli function build $func >> build_functions.log 2>&1
if [ "$?" -ne 0 ] ; then
echo_r ".[FAILED]"
RET=$(( RET + 1 ))
else
echo_g ".[OK]"
fi
fi
done
target/debug/edgeless_cli function build $func >> build_functions.log 2>&1
if [ "$?" -ne 0 ] ; then
echo_r ".[FAILED]"
RET=$(( RET + 1 ))
else
echo_g ".[OK]"
fi
fi
done
exit $RET
72 changes: 36 additions & 36 deletions scripts/run_all_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,60 @@ CLR_RED='\033[0;31m'
CLR_GREEN='\033[0;32m'
CLR_YELLOW='\033[0;33m'
CLR_RST='\033[0m'

# DEBUG prints
function echo_r(){ echo -e "${CLR_RED}$*${CLR_RST}"; }
function echo_g(){ echo -e "${CLR_GREEN}$*${CLR_RST}"; }
function echo_y(){ echo -e "${CLR_YELLOW}$*${CLR_RST}"; }
# ===========================================================

logs="build.log build_functions.log edgeless_bal.log edgeless_con.log edgeless_orc.log edgeless_node.log my-local-file.log reading-errors.log"
confs="balancer.toml controller.toml orchestrator.toml node.toml cli.toml"
specialized_workflows="container dda_demo dda_test esp32_resources redis vector_mul matrix_mul ollama kafka_egress"

echo_y "> Checking for existing files"
existing_files=""
for log in $logs ; do
for log in $logs ; do
if [ -r $log ] ; then
existing_files="$existing_files $log"
fi
existing_files="$existing_files $log"
fi
done
for conf in $confs ; do
if [ -r $conf ] ; then
existing_files="$existing_files $conf"
fi
fi
done
if [ "$existing_files" != "" ] ; then
if [ "$existing_files" != "" ] ; then
echo "The following files exist and will be overwritten if you continue: $existing_files"
read -s -n 1 -p "Hit Ctrl+C to abort or press any key to continue"
echo ""
read -s -n 1 -p "Hit Ctrl+C to abort or press any key to continue"
echo ""
rm $logs $confs 2> /dev/null
fi

echo
echo_y "> Compiling"
cargo build >& build.log
cargo build >& build.log
if [ $? -ne 0 ] ; then
echo_r "[error] compiling, bailing out"
exit 1
echo_r "[error] compiling, bailing out"
exit 1
fi

echo
echo_y "> Building the functions, if needed"
scripts/functions_build.sh
if [ $? -ne 0 ] ; then
echo_r "[error] building some functions, bailing out"
exit 1
exit 1
fi

echo
echo_y "> Creating configuration files"
echo_y "> Creating configuration files"
target/debug/edgeless_bal_d -t balancer.toml
target/debug/edgeless_con_d -t controller.toml
target/debug/edgeless_con_d -t controller.toml
target/debug/edgeless_orc_d -t orchestrator.toml
target/debug/edgeless_node_d -t node.toml
target/debug/edgeless_cli -t cli.toml
target/debug/edgeless_cli -t cli.toml

echo
echo_y "> Starting orchestrator, controller, and a node"
pids=()
Expand Down Expand Up @@ -89,42 +89,42 @@ for workflow in $(find examples -type f -name "workflow*.json") ; do
if [ "$RUN_SPECIALIZED_WORKFLOWS" != "1" ] ; then
specialized=0
for specialized_workflow in $specialized_workflows ; do
if [[ "$workflow" == *"$specialized_workflow"* ]] ; then
specialized=1
if [[ "$workflow" == *"$specialized_workflow"* ]] ; then
specialized=1
break
fi
done
if [ $specialized -eq 1 ] ; then
if [ $specialized -eq 1 ] ; then
echo "skipping specialized workflow '$workflow', use RUN_SPECIALIZED_WORKFLOWS=1 to run everything"
continue
fi
continue
fi
fi

echo -n "starting workflow $name: "
uid=$(RUST_LOG=error target/debug/edgeless_cli workflow start $workflow | grep '-')
if [ $? -eq 0 ] ; then
if [ $? -eq 0 ] ; then
echo_g "[started with ID $uid]"
else
echo_r "[error]"
fi
sleep 2
echo -n "stopping workflow $name: "
target/debug/edgeless_cli workflow stop $uid >& /dev/null
if [ $? -eq 0 ] ; then
echo_g "[done]"
target/debug/edgeless_cli workflow stop $uid >& /dev/null
if [ $? -eq 0 ] ; then
echo_g "[done]"
else
echo_r "[error]"
fi
done
done

echo
echo
echo_y "> Cleaning up"
for pid in "${pids[@]}" ; do
echo "killing $pid"
kill $pid
done
wait
echo "killing $pid"
kill $pid
done
wait

read -s -n 1 -p "press any key to remove all conf&log files (Ctrl+C if you want to keep them)"
echo ""
read -s -n 1 -p "press any key to remove all conf&log files (Ctrl+C if you want to keep them)"
echo ""
rm $logs $confs 2> /dev/null

0 comments on commit 2be5a52

Please sign in to comment.