forked from ETS-Next-Gen/writing_observer
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create a bash script for running two instances of learning observer
- Loading branch information
1 parent
b8eb482
commit 23be1c9
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
# =============================== | ||
# This a modified version RunLearningObserver.sh that automatically starts two processes, | ||
# each with a different creds.yaml ('creds-a.yaml' and 'creds-b.yaml')--this should be | ||
# used for static routing, where one creds.yaml has only dashboard routes enabled, | ||
# and the other has only extension routes enabled. Note that these creds.yaml should | ||
# specify different ports. | ||
# | ||
# This bash script provides a simple wrapper to run the | ||
# learning observer service and pipe the data to a logfile | ||
# over time this should be integrated into the systemd | ||
# service process. This uses static variables to specify | ||
# the location of the virtualenv and the command and | ||
# specifies the location for the running logfile. | ||
|
||
# System Variables | ||
# -------------------------------------- | ||
VIRTUALENV_PATH="/usr/local/share/projects/WritingObserver/VirtualENVs/WOvenv" | ||
#VIRTUALENV_PYTHON="/usr/local/share/Projects/WritingObserver/VirtualENVs/learning_observer/bin/python3.9" | ||
LEARNING_OBSERVER_LOC="/usr/local/share/projects/WritingObserver/Repositories/ArgLab_writing_observer/learning_observer" | ||
LOGFILE_DEST="/usr/local/share/projects/WritingObserver/Repositories/ArgLab_writing_observer/learning_observer/learning_observer/logs" | ||
|
||
# Make the logfile name | ||
# --------------------------------------- | ||
LOG_DATE=$(date "+%m-%d-%Y--%H-%M-%S") | ||
LOGFILE_NAME="$LOGFILE_DEST/learning_observer_service_$LOG_DATE.log" | ||
echo $LOG_NAME; | ||
|
||
|
||
# Run both processes | ||
# -------------------------------------- | ||
echo "Running Learning Observer Service..." | ||
cd $LEARNING_OBSERVER_LOC | ||
source $VIRTUALENV_PATH/bin/activate | ||
nohup python learning_observer --config-file=creds-a.yaml > $LOGFILE_NAME 2>&1 & | ||
PROCESS_ID=$! | ||
echo $PROCESS_ID > $LOGFILE_DEST/run.pid | ||
|
||
# NOTE: if this should go to separate log file location, modify here | ||
nohup python learning_observer --config-file=creds-b.yaml > $LOGFILE_NAME 2>&1 & | ||
PROCESS_ID=$! | ||
echo $PROCESS_ID > $LOGFILE_DEST/run.pid | ||
|
||
# Set the number of allowed open files to something large 8192 | ||
prlimit --pid $PROCESS_ID --nofile=8192 |