inoki-giskard commited on
Commit
affded7
1 Parent(s): 58c39e0

Display current job

Browse files
Files changed (4) hide show
  1. app_debug.py +4 -2
  2. io_utils.py +3 -2
  3. pipe.py +3 -3
  4. text_classification_ui_helpers.py +1 -1
app_debug.py CHANGED
@@ -39,8 +39,10 @@ def get_accordions_of_config_files():
39
  def get_demo(demo):
40
  with gr.Row():
41
  # check if jobs is an attribute of pipe
42
- if hasattr(pipe, "jobs"):
43
- gr.Markdown(f"current jobs in queue: {len(pipe.jobs)}")
 
 
44
  with gr.Accordion(label="Config Files", open=False):
45
  config_accordion = get_accordions_of_config_files()
46
  demo.load(get_accordions_of_config_files, outputs=config_accordion, every=1)
 
39
  def get_demo(demo):
40
  with gr.Row():
41
  # check if jobs is an attribute of pipe
42
+ if hasattr(pipe, "jobs") and len(pipe.jobs) > 0:
43
+ gr.Markdown(f"Current job: {pipe.current} Jobs in queue: {len(pipe.jobs)}")
44
+ else:
45
+ gr.Markdown("No jobs in queue, please submit an evaluation task.")
46
  with gr.Accordion(label="Config Files", open=False):
47
  config_accordion = get_accordions_of_config_files()
48
  demo.load(get_accordions_of_config_files, outputs=config_accordion, every=1)
io_utils.py CHANGED
@@ -125,15 +125,16 @@ def write_log_to_user_file(id, log):
125
  f.close()
126
 
127
 
128
- def save_job_to_pipe(id, job, lock):
129
  with lock:
130
- pipe.jobs.append((id, job))
131
 
132
 
133
  def pop_job_from_pipe():
134
  if len(pipe.jobs) == 0:
135
  return
136
  job_info = pipe.jobs.pop()
 
137
  write_log_to_user_file(job_info[0], f"Running job id {job_info[0]}\n")
138
  command = job_info[1]
139
 
 
125
  f.close()
126
 
127
 
128
+ def save_job_to_pipe(id, job, description="", lock):
129
  with lock:
130
+ pipe.jobs.append((id, job, description))
131
 
132
 
133
  def pop_job_from_pipe():
134
  if len(pipe.jobs) == 0:
135
  return
136
  job_info = pipe.jobs.pop()
137
+ pipe.current = job_info[2]
138
  write_log_to_user_file(job_info[0], f"Running job id {job_info[0]}\n")
139
  command = job_info[1]
140
 
pipe.py CHANGED
@@ -1,3 +1,3 @@
1
- def init():
2
- global jobs
3
- jobs = list()
 
1
+
2
+ jobs = list()
3
+ current = None
text_classification_ui_helpers.py CHANGED
@@ -247,7 +247,7 @@ def try_submit(m_id, d_id, config, split, local, uid):
247
 
248
  eval_str = f"[{m_id}]<{d_id}({config}, {split} set)>"
249
  logging.info(f"Start local evaluation on {eval_str}")
250
- save_job_to_pipe(uid, command, threading.Lock())
251
  write_log_to_user_file(
252
  uid,
253
  f"Start local evaluation on {eval_str}. Please wait for your job to start...\n",
 
247
 
248
  eval_str = f"[{m_id}]<{d_id}({config}, {split} set)>"
249
  logging.info(f"Start local evaluation on {eval_str}")
250
+ save_job_to_pipe(uid, command, eval_str, threading.Lock())
251
  write_log_to_user_file(
252
  uid,
253
  f"Start local evaluation on {eval_str}. Please wait for your job to start...\n",