Skip to content

Commit f289d76

Browse files
updated the missing depency issue
1 parent bd2433e commit f289d76

1 file changed

Lines changed: 7 additions & 23 deletions

File tree

src/scripts/dashboard.sh

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,7 @@ export FLASK_ENV=production
7575
export FLASK_RUN_PORT="$FLASK_PORT"
7676
export FLASK_RUN_HOST="0.0.0.0"
7777

78-
# function to check missing dependencies and install them
79-
check_missing_dependencies() {
80-
chmod +x "$SCRIPT_TO_CHECK_REQUIREMENTS"
81-
MISSING_PACKAGES=$(python $SCRIPT_TO_CHECK_REQUIREMENTS "$REQUIREMENTS_FILE")
82-
echo "Missing packages: $MISSING_PACKAGES"
83-
84-
if [ "$MISSING_PACKAGES" != "All packages are installed." ]; then
85-
echo "Installing missing packages..."
86-
# Install each missing package
87-
for package in $MISSING_PACKAGES; do
88-
pip install "$package"
89-
done
90-
else
91-
echo "All packages are installed."
92-
fi
93-
}
78+
9479

9580
# Function to fetch the value of an environment variable from a file
9681
fetch_env_variable() {
@@ -226,16 +211,15 @@ fetch_latest_changes() {
226211
fi
227212
}
228213

229-
230214
# Check if Flask app is running
231215
if ! pgrep -f "flask run --host=0.0.0.0 --port=$FLASK_PORT" >/dev/null; then
232-
check_missing_dependencies
233-
log_message "Flask app is not running. Checking repository and starting it..."
234-
[ "$auto_update" = true ] &&
235-
fetch_latest_changes $PROJECT_DIR $GIT_REMOTE_URL
236-
log_message "Starting Flask app..."
216+
conda run -n "$CONDA_ENV_NAME" pip install -r "$REQUIREMENTS_FILE"
217+
log_message "INFO" "Flask app is not running. Checking repository and starting it..."
218+
[ "$auto_update" = true ] && fetch_latest_changes $PROJECT_DIR $GIT_REMOTE_URL
219+
220+
log_message "INFO" "Starting Flask app..."
237221
# Ensure environment activation and `flask` command
238222
bash -c "source $CONDA_SETUP_SCRIPT && conda activate $CONDA_ENV_NAME && flask run --host=0.0.0.0 --port=$FLASK_PORT" &>>"$LOG_FILE" &
239223
else
240-
log_message "Flask app is already running."
224+
log_message "INFO" "Flask app is already running."
241225
fi

0 commit comments

Comments
 (0)