Skip to content

Commit

Permalink
autoupdater
Browse files Browse the repository at this point in the history
  • Loading branch information
namoray committed Apr 9, 2024
1 parent a1800c2 commit 4b72ab0
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 78 deletions.
Empty file modified autoupdate_llm.sh
100644 → 100755
Empty file.
26 changes: 0 additions & 26 deletions autoupdate_miner_image.sh

This file was deleted.

26 changes: 0 additions & 26 deletions autoupdate_steps.sh

This file was deleted.

26 changes: 0 additions & 26 deletions autoupdate_validator.sh

This file was deleted.

2 changes: 2 additions & 0 deletions local_setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# THIS IS A FILE TO USE TO RUN THE CODE LOCALLY WITHOUT THE DOCKER TEMPALTE - I DOUBT YOU NEED THIS

# Stop script on error
set -e

Expand Down
4 changes: 4 additions & 0 deletions local_setup_runpod.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash


# THIS IS A FILE TO USE TO RUN THE CODE LOCALLY WITHOUT THE DOCKER TEMPALTE ON RUNPOD - I DOUBT YOU NEED THIS


# Stop script on error
set -e

Expand Down
57 changes: 57 additions & 0 deletions run_llm_autoupdater.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
cleanup() {
echo "Stopping the llm server server..."
kill $process_pid
wait $process_pid 2>/dev/null
echo "Stopped"
}




cd llm_server
./entrypoint.sh &
process_pid=$!
cd ..


while true; do
# Get the current tag
local_tag=$(git describe --abbrev=0 --tags)
# Fetch the latest updates
git fetch
# Get the latest remote tag
remote_tag=$(git describe --tags $(git rev-list --topo-order --tags HEAD --max-count=1))

# Check if an update is required
if [[ $local_tag != $remote_tag ]]; then
echo "Local repo is not up-to-date. Updating..."
git reset --hard $remote_tag
if [ $? -eq 0 ]; then
echo "Updated local repo to latest version: $remote_tag"
echo "Running the autoupdate steps..."
# Kill the old process
kill $process_pid
wait $process_pid 2>/dev/null

# Run any steps needed to update, other than getting the new code
./autoupdate_llm.sh

# Restart the llm server
cd llm_server
./entrypoint.sh &
process_pid=$!
cd ..
echo "Finished running the autoupdate steps! Ready to go 😎"
else
echo "Error in updating"
fi
else
echo "Repo is up-to-date."
fi
# Wait for a while before checking again
sleep 10
done


cleanup()

0 comments on commit 4b72ab0

Please sign in to comment.