nateraw commited on
Commit
7f94c54
1 Parent(s): 008449a

Update status_checker.py

Browse files
Files changed (1) hide show
  1. status_checker.py +7 -7
status_checker.py CHANGED
@@ -18,7 +18,7 @@ output_dataset_id = "nateraw/asdf123"
18
  outputs_dir = Path('outputs')
19
 
20
  process_pid = os.getenv('USER_SCRIPT_PID', None)
21
- logger.info(f"USER SCRIPT PID? - {process_pid} - type {type(process_pid)}")
22
 
23
 
24
  def process_is_complete():
@@ -33,22 +33,22 @@ def process_is_complete():
33
  output_file = Path('done.txt')
34
 
35
  def status_checker():
36
- logger.info("Waiting to find output_file to check if script is done running")
37
  while True:
38
- logger.info(f"Process is complete? {process_is_complete()}")
39
  if output_file.exists():
40
- logger.info("Found the output file - Uploading the outputs from the script")
41
  upload_folder(repo_id=output_dataset_id, folder_path=str(outputs_dir), path_in_repo='.', repo_type='dataset')
42
- logger.info("Finished uploading outputs from script. Done now!")
43
  return
44
- logger.info("Didn't find it...sleeping for 5 seconds.")
45
  time.sleep(5)
46
 
47
  with gr.Blocks() as demo:
48
  gr.Markdown(Path('about.md').read_text())
49
 
50
  if not output_file.exists():
51
- logger.info("Didnt find output file on init, so starting thread to watch for it!")
52
  thread = Thread(target=status_checker, daemon=True)
53
  thread.start()
54
 
 
18
  outputs_dir = Path('outputs')
19
 
20
  process_pid = os.getenv('USER_SCRIPT_PID', None)
21
+ logger.debug(f"USER SCRIPT PID? - {process_pid} - type {type(process_pid)}")
22
 
23
 
24
  def process_is_complete():
 
33
  output_file = Path('done.txt')
34
 
35
  def status_checker():
36
+ logger.debug("Waiting to find output_file to check if script is done running")
37
  while True:
38
+ logger.debug(f"Process is complete? {process_is_complete()}")
39
  if output_file.exists():
40
+ logger.debug("Found the output file - Uploading the outputs from the script")
41
  upload_folder(repo_id=output_dataset_id, folder_path=str(outputs_dir), path_in_repo='.', repo_type='dataset')
42
+ logger.debug("Finished uploading outputs from script. Done now!")
43
  return
44
+ logger.debug("Didn't find it...sleeping for 5 seconds.")
45
  time.sleep(5)
46
 
47
  with gr.Blocks() as demo:
48
  gr.Markdown(Path('about.md').read_text())
49
 
50
  if not output_file.exists():
51
+ logger.debug("Didnt find output file on init, so starting thread to watch for it!")
52
  thread = Thread(target=status_checker, daemon=True)
53
  thread.start()
54