ZeroCommand commited on
Commit
9ca668d
1 Parent(s): 58c39e0

fix debug section and use shared log for now

Browse files
Files changed (4) hide show
  1. app.py +1 -1
  2. app_debug.py +16 -14
  3. app_text_classification.py +1 -1
  4. io_utils.py +1 -1
app.py CHANGED
@@ -18,7 +18,7 @@ try:
18
 
19
  start_process_run_job()
20
 
21
- demo.queue(max_size=100)
22
  demo.launch(share=False)
23
  atexit.register(stop_thread)
24
 
 
18
 
19
  start_process_run_job()
20
 
21
+ demo.queue(max_size=1000)
22
  demo.launch(share=False)
23
  atexit.register(stop_thread)
24
 
app_debug.py CHANGED
@@ -2,21 +2,21 @@ from os import listdir
2
  from os.path import isfile, join
3
 
4
  import gradio as gr
5
-
6
  import pipe
 
7
 
8
  LOG_PATH = "./tmp"
9
- CONFIG_PATH = "./cicd/configs"
 
10
 
11
 
12
  def get_accordions_of_files(path, files):
13
- components = []
14
- for file in files:
15
- with gr.Row():
16
- with gr.Accordion(label=file, open=False):
17
- with gr.Row():
18
- with open(join(path, file), "r") as f:
19
- gr.Markdown(f.read())
20
  return components
21
 
22
 
@@ -35,15 +35,17 @@ def get_accordions_of_config_files():
35
  ]
36
  return get_accordions_of_files(CONFIG_PATH, config_files)
37
 
 
 
 
38
 
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)
47
  with gr.Accordion(label="Log Files", open=False):
48
- log_accordions = get_accordions_of_log_files()
49
- demo.load(get_accordions_of_log_files, outputs=log_accordions, every=1)
 
 
 
2
  from os.path import isfile, join
3
 
4
  import gradio as gr
 
5
  import pipe
6
+ from io_utils import get_logs_file
7
 
8
  LOG_PATH = "./tmp"
9
+ CONFIG_PATH = "./cicd/configs/"
10
+ MAX_FILES_NUM = 20
11
 
12
 
13
  def get_accordions_of_files(path, files):
14
+ components = [None for _ in range (0, MAX_FILES_NUM)]
15
+ for i in range(0, len(files)):
16
+ if i >= MAX_FILES_NUM:
17
+ break
18
+ with open(join(path, files[i]), "r") as f:
19
+ components[i] = f.read()
 
20
  return components
21
 
22
 
 
35
  ]
36
  return get_accordions_of_files(CONFIG_PATH, config_files)
37
 
38
+ def get_config_files():
39
+ config_files = [join(CONFIG_PATH, f) for f in listdir(CONFIG_PATH) if isfile(join(CONFIG_PATH, f)) and f.endswith(".yaml")]
40
+ return config_files
41
 
42
  def get_demo(demo):
43
  with gr.Row():
44
  # check if jobs is an attribute of pipe
45
  if hasattr(pipe, "jobs"):
46
  gr.Markdown(f"current jobs in queue: {len(pipe.jobs)}")
 
 
 
47
  with gr.Accordion(label="Log Files", open=False):
48
+ logs = gr.Textbox(lines=10, visible=True, label="Log File")
49
+ demo.load(get_logs_file, None, logs, every=0.5)
50
+ with gr.Accordion(label="Config Files", open=False):
51
+ gr.Files(value=get_config_files, label="Config Files", every=10)
app_text_classification.py CHANGED
@@ -103,7 +103,7 @@ def get_demo(demo):
103
 
104
  with gr.Row():
105
  logs = gr.Textbox(label="Giskard Bot Evaluation Log:", visible=False)
106
- demo.load(get_logs_file, uid_label, logs, every=0.5)
107
 
108
  dataset_id_input.change(
109
  check_dataset_and_get_config,
 
103
 
104
  with gr.Row():
105
  logs = gr.Textbox(label="Giskard Bot Evaluation Log:", visible=False)
106
+ demo.load(get_logs_file, None, logs, every=0.5)
107
 
108
  dataset_id_input.change(
109
  check_dataset_and_get_config,
io_utils.py CHANGED
@@ -111,7 +111,7 @@ def convert_column_mapping_to_json(df, label=""):
111
  return column_mapping
112
 
113
 
114
- def get_logs_file(uid):
115
  try:
116
  file = open(f"./tmp/temp_log", "r")
117
  return file.read()
 
111
  return column_mapping
112
 
113
 
114
+ def get_logs_file():
115
  try:
116
  file = open(f"./tmp/temp_log", "r")
117
  return file.read()