Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Fixing paths that were preventing artifacts from being copied to workspace #311

Merged
merged 2 commits into from
Aug 16, 2023
Merged
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
24 changes: 15 additions & 9 deletions agbenchmark/utils/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import subprocess
import sys
from abc import ABC
from pathlib import Path
from typing import Any, Dict, List

import openai
Expand Down Expand Up @@ -49,9 +50,14 @@ def dependencies(self) -> list:
async def setup_challenge(self, config: Dict[str, Any], cutoff: int) -> None:
from agbenchmark.agent_interface import copy_artifacts_into_workspace, run_agent

copy_artifacts_into_workspace(
config["workspace"], "artifacts_in", self.ARTIFACTS_LOCATION
)
artifact_paths = [
self.ARTIFACTS_LOCATION,
Path(self.CHALLENGE_LOCATION).parent,
]

for path in artifact_paths:
copy_artifacts_into_workspace(config["workspace"], "artifacts_in", path)

if not self.task:
return

Expand All @@ -62,9 +68,10 @@ async def setup_challenge(self, config: Dict[str, Any], cutoff: int) -> None:

if "--mock" in sys.argv:
print("Running mock agent")
copy_artifacts_into_workspace(
config["workspace"], "artifacts_out", self.ARTIFACTS_LOCATION
)
for path in artifact_paths:
copy_artifacts_into_workspace(
config["workspace"], "artifacts_out", path
)
elif config.get("api_mode"):
await run_api_agent(self.data, config, self.ARTIFACTS_LOCATION, cutoff)
else:
Expand All @@ -73,9 +80,8 @@ async def setup_challenge(self, config: Dict[str, Any], cutoff: int) -> None:
# hidden files are added after the agent runs. Hidden files can be python test files.
# We copy them in the workspace to make it easy to import the code produced by the agent

copy_artifacts_into_workspace(
config["workspace"], "custom_python", self.ARTIFACTS_LOCATION
)
for path in artifact_paths:
copy_artifacts_into_workspace(config["workspace"], "custom_python", path)

def test_method(self, config: Dict[str, Any]) -> None:
raise NotImplementedError
Expand Down