From 340c31074d2f177bb6de2ce89a22ed9a28e8f1b8 Mon Sep 17 00:00:00 2001 From: engshahrad Date: Sun, 15 Oct 2023 06:46:18 +0000 Subject: [PATCH 1/4] fixed issues with the setup script: 1) install Julia 1.9.3 if not installed and 2) check if directories exist before creating them --- setup.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 80 insertions(+), 17 deletions(-) diff --git a/setup.sh b/setup.sh index 46103f4..503acf0 100755 --- a/setup.sh +++ b/setup.sh @@ -5,9 +5,42 @@ if command -v julia &> /dev/null then julia setupJulia.jl else - echo "Error: Please install Julia and then rerun this script." - exit 1 -fi + echo "Error: Julia is not installed on your system." + echo "Do you want to install Julia? (y/n)" + read installJulia + if [ $installJulia == "y" ] + then + if [ "$(uname)" == "Linux" ] && [ "$(uname -m)" == "x86_64" ] + then + echo "Downloading Julia..." + wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.3-linux-x86_64.tar.gz + echo "Extracting Julia..." + tar -xvzf julia-1.9.3-linux-x86_64.tar.gz + echo "Installing Julia..." + sudo cp -r julia-1.9.3 /opt/ + sudo ln -s /opt/julia-1.9.3/bin/julia /usr/local/bin/julia + echo "Julia has been installed." + elif [ "$(uname)" == "Linux" ] && [ "$(uname -m)" == "aarch64" ] + then + echo "Downloading Julia..." + wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.9/julia-1.9.3-linux-aarch64.tar.gz + echo "Extracting Julia..." + tar -xvzf julia-1.9.3-linux-aarch64.tar.gz + echo "Installing Julia..." + sudo cp -r julia-1.9.3 /opt/ + sudo ln -s /opt/julia-1.9.3/bin/julia /usr/local/bin/julia + echo "Julia has been installed." + else + echo "Please download Julia from https://julialang.org/downloads/, install it, and then re-run this script." + exit 1 + fi + julia setupJulia.jl + else + echo "Please install Julia and re-run this script." + exit 1 + fi +fi + pip3 install -r ./requirements.txt sudo apt install -y docker.io sudo apt-get install -y libpstreams-dev @@ -17,32 +50,62 @@ arr=("DNAVisualizationWorkflow" "ImageProcessingWorkflow" "RegressionTuningWorkf cd ./scheduler/data for dirname in "${arr[@]}" do - mkdir "$dirname" + if [ -d "$dirname" ] + then + echo "Directory $dirname exists." + else + mkdir "$dirname" + fi done cd ../ -mkdir logs +if [ -d "logs" ] +then + echo "Directory logs exists." +else + mkdir logs +fi cd ../ cd ./log-parser/get-workflow-logs/data for dirname in "${arr[@]}" do - mkdir "$dirname" + if [ -d "$dirname" ] + then + echo "Directory $dirname exists." + else + mkdir "$dirname" + fi done cd ../ -mkdir logs +if [ -d "logs" ] +then + echo "Directory logs exists." +else + mkdir logs +fi cd ../../ cd ./host-agents/execution-agent -mkdir logs -mkdir data -cd ../../ -if [ $leaderFailure -eq 1 ] +if [ -d "logs" ] then -cd ./log-parser/get-workflow-logs -if command -v python &> /dev/null + echo "Directory logs exists." +else + mkdir logs +fi +if [ -d "data" ] then - python getNewDatastoreLogs.py -elif command -v python3 &> /dev/null + echo "Directory logs exists." +else + mkdir data +fi +cd ../../ +if [ $leaderFailure -eq 1 ] then - python3 getNewDatastoreLogs.py -fi + cd ./log-parser/get-workflow-logs + if command -v python &> /dev/null + then + python getNewDatastoreLogs.py + elif command -v python3 &> /dev/null + then + python3 getNewDatastoreLogs.py + fi fi echo "Please exit your current session and relogin" From 21706d6a3890de2d425b3a0eb9f3e9ae729dbb5d Mon Sep 17 00:00:00 2001 From: engshahrad Date: Sun, 15 Oct 2023 06:54:05 +0000 Subject: [PATCH 2/4] check for pip and install it if needed before using it --- setup.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 503acf0..615ca78 100755 --- a/setup.sh +++ b/setup.sh @@ -41,7 +41,22 @@ else fi fi -pip3 install -r ./requirements.txt +if command -v pip &> /dev/null +then + echo "pip is installed" +else + echo "pip is not installed" + echo "Do you want to install pip? (y/n)" + read installPip + if [ $installPip == "y" ] + then + sudo apt install -y python3-pip + else + echo "Please install pip and re-run this script." + exit 1 + fi +fi +python3 -m pip install -r requirements.txt sudo apt install -y docker.io sudo apt-get install -y libpstreams-dev sudo apt-get install build-essential From 323285d6de0d02790ae6dd25dfb5a2a401df6519 Mon Sep 17 00:00:00 2001 From: Ghazal Sadeghian <45939148+GhazalSdn@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:22:20 -0700 Subject: [PATCH 3/4] Update setup.sh Minor modifications to the printed logs. --- setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index 615ca78..51d8305 100755 --- a/setup.sh +++ b/setup.sh @@ -75,7 +75,7 @@ done cd ../ if [ -d "logs" ] then - echo "Directory logs exists." + echo "Directory logs exists for the scheduler." else mkdir logs fi @@ -93,7 +93,7 @@ done cd ../ if [ -d "logs" ] then - echo "Directory logs exists." + echo "Directory logs exists for the log collector." else mkdir logs fi @@ -101,13 +101,13 @@ cd ../../ cd ./host-agents/execution-agent if [ -d "logs" ] then - echo "Directory logs exists." + echo "Directory logs exists for the host agents." else mkdir logs fi if [ -d "data" ] then - echo "Directory logs exists." + echo "Directory data exists for the host agents." else mkdir data fi From 09bcf7ff797721a09709b5419235862e850590de Mon Sep 17 00:00:00 2001 From: engshahrad Date: Mon, 16 Oct 2023 20:37:06 +0000 Subject: [PATCH 4/4] using python3 only --- setup.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/setup.sh b/setup.sh index 51d8305..1a46b08 100755 --- a/setup.sh +++ b/setup.sh @@ -115,12 +115,6 @@ cd ../../ if [ $leaderFailure -eq 1 ] then cd ./log-parser/get-workflow-logs - if command -v python &> /dev/null - then - python getNewDatastoreLogs.py - elif command -v python3 &> /dev/null - then - python3 getNewDatastoreLogs.py - fi + python3 getNewDatastoreLogs.py fi echo "Please exit your current session and relogin"