Skip to content

Commit

Permalink
add start.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ZihengSun committed Apr 3, 2023
1 parent 25703cc commit 0bebfe8
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 4 deletions.
6 changes: 6 additions & 0 deletions pygeoweaver/detail_workflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@



def detail_workflow():
print("Show details of a workflow")
pass
1 change: 1 addition & 0 deletions pygeoweaver/geoweaver.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Error: Unable to access jarfile geoweaver.jar
5 changes: 5 additions & 0 deletions pygeoweaver/list_hosts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


def list_hosts():
print("List all hosts")
pass
5 changes: 5 additions & 0 deletions pygeoweaver/list_processes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


def list_processes():
print("all the geoweaver cli")
pass
2 changes: 2 additions & 0 deletions pygeoweaver/list_workflows.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@


def list_workflows():

pass

6 changes: 6 additions & 0 deletions pygeoweaver/run_workflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@



def run_workflow():
print("Run workflow: ")
pass
9 changes: 7 additions & 2 deletions pygeoweaver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
"""

def download_geoweaver():
"""
Download Geoweaver to user home directory
"""


def start():
print("start Geoweaver instance..")
result = subprocess.run(['java', '-jar', 'geoweaver.jar'], capture_output=True, text=True)
result = subprocess.run(['start.sh'], capture_output=True, text=True)
print(result.stdout)
print(result.stderr)


def stop():
print("stop Geoweaver instance..")
result = subprocess.run(['java', '-jar', 'geoweaver.jar'], capture_output=True, text=True)
result = subprocess.run(['stop.sh'], capture_output=True, text=True)
print(result.stdout)
print(result.stderr)

Expand Down
31 changes: 29 additions & 2 deletions pygeoweaver/start.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
#!/bin/bash

wget https://github.com/ESIPFed/Geoweaver/releases/download/latest/geoweaver.jar -O ~/
FILE=~/geoweaver.jar
if [ -f "$FILE" ]; then
echo "$FILE exists. Skip downloading.."
else
echo "Downloading the latest geoweaver.jar to user home directory"
cd ~ && curl -OL https://github.com/ESIPFed/Geoweaver/releases/download/latest/geoweaver.jar
fi

java -jar ~/geoweaver.jar
echo "Stop running Geoweaver if any.."
kill $(ps aux | grep 'geoweaver.jar' | awk '{print $2}')

echo "Start Geoweaver.."
nohup java -jar ~/geoweaver.jar > ~/geoweaver.log &

STATUS=0
counter=0
until [ $STATUS == 302 ] || [ $counter == 20 ]
do
sleep 2
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "http://localhost:8070/Geoweaver")
((counter++))
done

if [ $counter == 20 ] ; then
echo "Error: Geoweaver is not up"
exit 1
else
echo "Success: Geoweaver is up"
exit 0
fi
Empty file modified pygeoweaver/stop.sh
100644 → 100755
Empty file.
Empty file added test/test_all.py
Empty file.

0 comments on commit 0bebfe8

Please sign in to comment.