Skip to content

fix docker running error exit #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commit0/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main() -> None:
)
# type check config values
cs = ConfigStore.instance()
cs.store(name="user", node=Commit0Config)
cs.store(name="user", group="Commit0Config", node=Commit0Config)
# have hydra to ignore all command-line arguments
sys_argv = copy.deepcopy(sys.argv)
sys.argv = [sys.argv[0]]
Expand Down
10 changes: 8 additions & 2 deletions commit0/harness/run_pytest_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def run_docker(
timeout: int,
log_dir: Path,
stdout: bool,
) -> None:
) -> str:
client = docker.from_env()
container = None
try:
Expand Down Expand Up @@ -91,18 +91,21 @@ def run_docker(
if exit_code == 0:
copy_from_container(container, report_file, Path(log_dir / "report.json"))
delete_file_from_container(container, str(report_file))
return test_output

except EvaluationError as e:
error_msg = traceback.format_exc()
logger.info(error_msg)
print(e)
return error_msg
except Exception as e:
error_msg = (
f"Error in running pytest for {spec.repo}: {e}\n"
f"{traceback.format_exc()}\n"
# f"Check ({logger.log_file}) for more information."
)
logger.error(error_msg)
return error_msg
finally:
# Remove repo container + image, close logger
assert container is not None
Expand Down Expand Up @@ -253,10 +256,13 @@ def main(
eval_file = Path(log_dir / "eval.sh")
eval_file.write_text(eval_script)

error_message = None
if ExecutionBackend(backend) == ExecutionBackend.LOCAL:
run_docker(spec, logger, eval_file, timeout, log_dir, stdout)
error_message = run_docker(spec, logger, eval_file, timeout, log_dir, stdout)
elif ExecutionBackend(backend) == ExecutionBackend.MODAL:
run_modal(spec, logger, eval_file, timeout, log_dir, stdout)
if error_message:
return error_message
return str(log_dir)


Expand Down
Loading