Spaces:
Sleeping
Sleeping
Improve logging
Browse filesHopefully this will make debugging easier on HF
- run_utils.py +12 -4
run_utils.py
CHANGED
@@ -117,7 +117,11 @@ def run_cli_command(
|
|
117 |
)
|
118 |
logging.debug(f"Command output:\n{result.stdout}")
|
119 |
if result.stderr:
|
120 |
-
|
|
|
|
|
|
|
|
|
121 |
except subprocess.CalledProcessError as e:
|
122 |
logging.error(f"An error occurred while executing the command: {e}")
|
123 |
|
@@ -136,21 +140,25 @@ def run_cli_command(
|
|
136 |
pdb_path = os.path.join(example_dir, "rank1_reverseprocess_protein.pdb")
|
137 |
sdf_path = os.path.join(example_dir, "rank1.sdf")
|
138 |
|
|
|
|
|
139 |
if pdb_path and os.path.exists(pdb_path):
|
140 |
pdb_text = read_file_lines(pdb_path)
|
|
|
141 |
sdf_text = read_file_lines(sdf_path)
|
142 |
|
143 |
-
logging.debug(f"Display path: {pdb_path}")
|
144 |
-
|
145 |
# Zip the output directory
|
146 |
# Generate a unique filename using a timestamp and a UUID
|
147 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
148 |
uuid_tag = str(uuid.uuid4())[0:8]
|
149 |
unique_filename = f"diffdock_pocket_output_{timestamp}_{uuid_tag}"
|
150 |
zip_base_name = os.path.join("tmp", unique_filename)
|
|
|
|
|
|
|
151 |
full_zip_path = shutil.make_archive(zip_base_name, "zip", temp_dir)
|
152 |
|
153 |
-
logging.debug(f"Directory '{temp_dir}' zipped to
|
154 |
|
155 |
return full_zip_path, pdb_text, sdf_text
|
156 |
|
|
|
117 |
)
|
118 |
logging.debug(f"Command output:\n{result.stdout}")
|
119 |
if result.stderr:
|
120 |
+
# Skip progress bar lines
|
121 |
+
stderr_lines = result.stderr.split("\n")
|
122 |
+
stderr_lines = filter(lambda x: "%|" not in x, stderr_lines)
|
123 |
+
stderr_text = "\n".join(stderr_lines)
|
124 |
+
logging.error(f"Command error:\n{stderr_text}")
|
125 |
except subprocess.CalledProcessError as e:
|
126 |
logging.error(f"An error occurred while executing the command: {e}")
|
127 |
|
|
|
140 |
pdb_path = os.path.join(example_dir, "rank1_reverseprocess_protein.pdb")
|
141 |
sdf_path = os.path.join(example_dir, "rank1.sdf")
|
142 |
|
143 |
+
logging.debug(f"PDB path: {pdb_path}")
|
144 |
+
logging.debug(f"SDF path: {sdf_path}")
|
145 |
if pdb_path and os.path.exists(pdb_path):
|
146 |
pdb_text = read_file_lines(pdb_path)
|
147 |
+
if sdf_path and os.path.exists(sdf_path):
|
148 |
sdf_text = read_file_lines(sdf_path)
|
149 |
|
|
|
|
|
150 |
# Zip the output directory
|
151 |
# Generate a unique filename using a timestamp and a UUID
|
152 |
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
153 |
uuid_tag = str(uuid.uuid4())[0:8]
|
154 |
unique_filename = f"diffdock_pocket_output_{timestamp}_{uuid_tag}"
|
155 |
zip_base_name = os.path.join("tmp", unique_filename)
|
156 |
+
|
157 |
+
logging.debug(f"About to zip directory '{temp_dir}' to {unique_filename}")
|
158 |
+
|
159 |
full_zip_path = shutil.make_archive(zip_base_name, "zip", temp_dir)
|
160 |
|
161 |
+
logging.debug(f"Directory '{temp_dir}' zipped to {unique_filename}'")
|
162 |
|
163 |
return full_zip_path, pdb_text, sdf_text
|
164 |
|