Skip to content

Commit 2697765

Browse files
committed
remove delete from docker
1 parent 4d4a70c commit 2697765

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

commit0/harness/docker_utils.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -116,30 +116,6 @@ def safe_extract(
116116
extracted_file_path.rename(dst)
117117

118118

119-
def delete_file_from_container(container: Container, file_path: str) -> None:
120-
"""Delete a file from a docker container.
121-
122-
Args:
123-
----
124-
container (Container): Docker container to delete the file from
125-
file_path (str): Path to the file in the container to be deleted
126-
127-
Raises:
128-
------
129-
docker.errors.APIError: If there is an error calling the Docker API.
130-
Exception: If the file deletion command fails with a non-zero exit code.
131-
132-
"""
133-
try:
134-
exit_code, output = container.exec_run(f"rm -f {file_path}")
135-
if exit_code != 0:
136-
raise Exception(f"Error deleting file: {output.decode('utf-8').strip()}")
137-
except docker.errors.APIError as e:
138-
raise docker.errors.APIError(f"Docker API Error: {str(e)}")
139-
except Exception as e:
140-
raise Exception(f"General Error: {str(e)}")
141-
142-
143119
def write_to_container(container: Container, data: str, dst: Path) -> None:
144120
"""Write a string to a file in a docker container"""
145121
# echo with heredoc to file

commit0/harness/execution_context.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
create_container,
2929
copy_from_container,
3030
copy_to_container,
31-
delete_file_from_container,
3231
exec_run_with_timeout,
3332
)
3433

@@ -138,7 +137,6 @@ def exec_run_with_timeout(self, command: str) -> tuple[str, bool, float]:
138137
copy_from_container(
139138
self.container, report_file, self.log_dir / "report.json"
140139
)
141-
delete_file_from_container(self.container, str(report_file))
142140
return output
143141

144142
def __exit__(

0 commit comments

Comments
 (0)