minhopark-neubla commited on
Commit
a39938f
1 Parent(s): 9614796

Change restart interval

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  import pandas as pd
3
  from apscheduler.schedulers.background import BackgroundScheduler
@@ -45,19 +46,20 @@ def restart_space():
45
 
46
  def init_space():
47
 
48
- # try:
49
- print(EVAL_RESULTS_PATH)
50
- snapshot_download(
51
- repo_id=RESULTS_REPO,
52
- local_dir=EVAL_RESULTS_PATH,
53
- repo_type="dataset",
54
- tqdm_class=None,
55
- etag_timeout=60,
56
- resume_download=True,
57
- )
58
- # except Exception as e:
59
- # print(e)
60
- # restart_space()
 
61
 
62
  raw_data, original_df = get_leaderboard_df(
63
  results_path=EVAL_RESULTS_PATH, cols=COLS, benchmark_cols=BENCHMARK_COLS
@@ -369,7 +371,7 @@ with demo:
369
  )
370
 
371
  scheduler = BackgroundScheduler()
372
- scheduler.add_job(restart_space, "interval", seconds=10800) # restarted every 3h
373
  scheduler.start()
374
 
375
  demo.queue(default_concurrency_limit=40).launch()
 
1
+ from time import sleep
2
  import gradio as gr
3
  import pandas as pd
4
  from apscheduler.schedulers.background import BackgroundScheduler
 
46
 
47
  def init_space():
48
 
49
+ try:
50
+ print(EVAL_RESULTS_PATH)
51
+ snapshot_download(
52
+ repo_id=RESULTS_REPO,
53
+ local_dir=EVAL_RESULTS_PATH,
54
+ repo_type="dataset",
55
+ tqdm_class=None,
56
+ etag_timeout=30,
57
+ resume_download=True,
58
+ )
59
+ except Exception as e:
60
+ print(e)
61
+ sleep(180) # sleep 3 min
62
+ restart_space()
63
 
64
  raw_data, original_df = get_leaderboard_df(
65
  results_path=EVAL_RESULTS_PATH, cols=COLS, benchmark_cols=BENCHMARK_COLS
 
371
  )
372
 
373
  scheduler = BackgroundScheduler()
374
+ scheduler.add_job(restart_space, "interval", seconds=1800) # restarted every 3h
375
  scheduler.start()
376
 
377
  demo.queue(default_concurrency_limit=40).launch()