MVPilgrim commited on
Commit
4a3c8c8
·
1 Parent(s): 2281b34
Files changed (2) hide show
  1. app.py +10 -8
  2. startup.sh +8 -3
app.py CHANGED
@@ -51,21 +51,23 @@ try:
51
  try:
52
  subprocess.Popen(["/app/startup.sh"])
53
  # Wait for text2vec-transformers and Weaviate DB to initialize.
54
- time.sleep(180)
55
  except Exception as e:
56
  emsg = str(e)
57
  logger.ERROR(f"### subprocess.run EXCEPTION. e: {emsg}")
58
- try:
59
- with open("/app/startup.log", "r") as file:
60
- content = file.read()
61
- print(content)
62
- except Exception as e2:
63
- emsg = str(e2)
64
- logger.ERROR(f"#### Displaying startup.log EXCEPTION. e2: {emsg}")
65
  logger.info("### Running startup.sh complete")
66
  if 'runStartup' not in st.session_state:
67
  st.session_state.runStartup = True
68
  runStartup()
 
 
 
 
 
 
 
 
 
69
 
70
 
71
  #########################################
 
51
  try:
52
  subprocess.Popen(["/app/startup.sh"])
53
  # Wait for text2vec-transformers and Weaviate DB to initialize.
54
+ time.sleep(60)
55
  except Exception as e:
56
  emsg = str(e)
57
  logger.ERROR(f"### subprocess.run EXCEPTION. e: {emsg}")
 
 
 
 
 
 
 
58
  logger.info("### Running startup.sh complete")
59
  if 'runStartup' not in st.session_state:
60
  st.session_state.runStartup = True
61
  runStartup()
62
+ try:
63
+ with open("/app/startup.log", "r") as file:
64
+ line = file.readline()
65
+ while line:
66
+ logger.info(line)
67
+ line = file.readline()
68
+ except Exception as e2:
69
+ emsg = str(e2)
70
+ logger.ERROR(f"#### Displaying startup.log EXCEPTION. e2: {emsg}")
71
 
72
 
73
  #########################################
startup.sh CHANGED
@@ -8,7 +8,12 @@
8
  exec &> /app/startup.log
9
 
10
  echo "#### startup.sh entered."
11
-
 
 
 
 
 
12
 
13
  # Make sure Weaviate DB directory exists.
14
  echo "### Before mkdir -p ~/data/var/lib/weaviate"
@@ -20,7 +25,7 @@ chmod -R 777 $weaviateDir
20
  # Start tex2vec-transformers
21
  echo "#### Before /app/text2vec-transformers"
22
  cd /app/text2vec-transformers
23
- /app/text2vec-transformers/bin/uvicorn app:app --host 0.0.0.0 --port 8081 --log-level warning --timeout-keep-alive 1440 & #2>& 1 | tee /data/var/lib/weaviate/t2v.log &
24
  cd /app
25
 
26
 
@@ -34,7 +39,7 @@ export AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true \
34
  TRANSFORMERS_INFERENCE_API=http://127.0.0.1:8081 \
35
  LOG_LEVEL=warning \
36
  MODULES_CLIENT_TIMEOUT=600s
37
- /app/weaviate/weaviate --host 127.0.0.1 --port 8080 --scheme http --write-timeout 600s & #2>& 1 | tee /data/var/lib/weaviate/ws.log &
38
 
39
  echo "### Before wait."
40
  wait
 
8
  exec &> /app/startup.log
9
 
10
  echo "#### startup.sh entered."
11
+ # Is startup.sh already running?
12
+ ps -ef | grep -i startup.sh
13
+ if [ $? -eq 0 ]; then
14
+ echo "#### startup.sh already running. Exiting."
15
+ exit 0
16
+ fi
17
 
18
  # Make sure Weaviate DB directory exists.
19
  echo "### Before mkdir -p ~/data/var/lib/weaviate"
 
25
  # Start tex2vec-transformers
26
  echo "#### Before /app/text2vec-transformers"
27
  cd /app/text2vec-transformers
28
+ /app/text2vec-transformers/bin/uvicorn app:app --host 0.0.0.0 --port 8081 --log-level warning --timeout-keep-alive 1440 &
29
  cd /app
30
 
31
 
 
39
  TRANSFORMERS_INFERENCE_API=http://127.0.0.1:8081 \
40
  LOG_LEVEL=warning \
41
  MODULES_CLIENT_TIMEOUT=600s
42
+ /app/weaviate/weaviate --host 127.0.0.1 --port 8080 --scheme http --write-timeout 600s &
43
 
44
  echo "### Before wait."
45
  wait