File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
example-apps/chatbot-rag-app/data Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change 4141
4242
4343def install_elser ():
44+ # This script is re-entered on ctrl-c or someone just running it twice.
45+ # Hence, both steps need to be careful about being potentially redundant.
46+
4447 # Step 1: Ensure ELSER_MODEL is defined
4548 try :
4649 es .ml .get_trained_models (model_id = ELSER_MODEL )
@@ -66,14 +69,9 @@ def install_elser():
6669 )
6770 print (f'"{ ELSER_MODEL } " model is deployed' )
6871 except BadRequestError :
69- # Already started
72+ # Already started, and likely fully allocated
7073 pass
7174
72- while True :
73- if is_elser_fully_allocated ():
74- break
75- time .sleep (1 )
76-
7775 print (f'"{ ELSER_MODEL } " model is ready' )
7876
7977
@@ -127,8 +125,8 @@ def main():
127125
128126 print (f"Adding documents to index { INDEX } " )
129127
130- spinner = Halo (text = "Processing bulk operation" , spinner = "dots" )
131128 if stdout .isatty ():
129+ spinner = Halo (text = "Processing bulk operation" , spinner = "dots" )
132130 spinner .start ()
133131
134132 try :
@@ -175,10 +173,9 @@ def await_ml_tasks(max_timeout=600, interval=5):
175173 return
176174 time .sleep (interval )
177175
178- if ml_tasks :
179- raise TimeoutError (
180- f"Timeout reached. ML tasks are still running: { ', ' .join (ml_tasks )} "
181- )
176+ raise TimeoutError (
177+ f"Timeout reached. ML tasks are still running: { ', ' .join (ml_tasks )} "
178+ )
182179
183180
184181def get_ml_tasks ():
You can’t perform that action at this time.
0 commit comments