hvoss-techfak commited on
Commit
3296634
·
1 Parent(s): 26ecf5f

better visible error message

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -822,7 +822,20 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
822
  self.returncode = None
823
 
824
  def run(self):
825
- self.returncode = run_autoforge_process(self.cmd, self.log_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
826
 
827
  worker = Worker(command, log_file)
828
  worker.start()
@@ -970,4 +983,4 @@ if __name__ == "__main__":
970
  except Exception as e:
971
  print(f"Could not write default {DEFAULT_MATERIALS_CSV}: {e}")
972
  print("To run the UI, execute: python app.py") # Corrected to python app.py
973
- demo.queue(default_concurrency_limit=4).launch(share=False)
 
822
  self.returncode = None
823
 
824
  def run(self):
825
+ try:
826
+ self.returncode = run_autoforge_process(self.cmd, self.log_path)
827
+ except Exception as e:
828
+ self.exc = e
829
+ capture_exception(e) # still goes to Sentry
830
+ # make the error visible in the UI console
831
+ with open(self.log_path, "a", encoding="utf-8") as lf:
832
+ lf.write(
833
+ "\nERROR: {}. This usually means the space has no free GPU "
834
+ "minutes left right now. Please clone the docker container, run it locally or wait for a bit.\n".format(e)
835
+ )
836
+ # a non-zero code tells the outer loop something went wrong
837
+ self.returncode = -1
838
+
839
 
840
  worker = Worker(command, log_file)
841
  worker.start()
 
983
  except Exception as e:
984
  print(f"Could not write default {DEFAULT_MATERIALS_CSV}: {e}")
985
  print("To run the UI, execute: python app.py") # Corrected to python app.py
986
+ demo.queue(default_concurrency_limit=1).launch(share=False)