inoki-giskard ZeroCommand commited on
Commit
e84a865
1 Parent(s): 8092547

roll-back-log-reload (#26)

Browse files

- use temp log file (5f211e525be7127b1eba5b51d3b100ed774febab)


Co-authored-by: zcy <ZeroCommand@users.noreply.huggingface.co>

Files changed (1) hide show
  1. io_utils.py +3 -3
io_utils.py CHANGED
@@ -115,14 +115,14 @@ def convert_column_mapping_to_json(df, label=""):
115
 
116
  def get_logs_file(uid):
117
  try:
118
- file = open(f"./tmp/{uid}_log", "r")
119
  return file.read()
120
  except Exception:
121
  return "Log file does not exist"
122
 
123
 
124
  def write_log_to_user_file(id, log):
125
- with open(f"./tmp/{id}_log", "a") as f:
126
  f.write(log)
127
  f.close()
128
 
@@ -139,7 +139,7 @@ def pop_job_from_pipe():
139
  write_log_to_user_file(job_info[0], f"Running job id {job_info[0]}\n")
140
  command = job_info[1]
141
 
142
- log_file = open(f"./tmp/{job_info[0]}_log", "a")
143
  subprocess.Popen(
144
  command,
145
  stdout=log_file,
 
115
 
116
  def get_logs_file(uid):
117
  try:
118
+ file = open(f"./tmp/temp_log", "r")
119
  return file.read()
120
  except Exception:
121
  return "Log file does not exist"
122
 
123
 
124
  def write_log_to_user_file(id, log):
125
+ with open(f"./tmp/temp_log", "a") as f:
126
  f.write(log)
127
  f.close()
128
 
 
139
  write_log_to_user_file(job_info[0], f"Running job id {job_info[0]}\n")
140
  command = job_info[1]
141
 
142
+ log_file = open(f"./tmp/temp_log", "a")
143
  subprocess.Popen(
144
  command,
145
  stdout=log_file,