MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / _pre_round_setup

Method _pre_round_setup

codeclash/arenas/arena.py:229–250  ·  view source on GitHub ↗

Copy agent codebases into game's container

(self, agents: list[Player])

Source from the content-addressed store, hash-verified

227 assert_zero_exit_code(environment.execute(cmd), logger=self.logger)
228 return environment
229
230 def get_metadata(self) -> dict:
231 """This is what we write to metadata.json.
232 You can subclass extend this to add more details for specific games.
233 """
234 return self._metadata
235
236 def _pre_round_setup(self, agents: list[Player]):
237 """Copy agent codebases into game's container"""
238 for agent in agents:
239 # First make sure that the folder in the game container is removed
240 # This is important for 2 reasons:
241 # 1. Subtle differences in docker cp behavior regarding to trailing slashes
242 # depending on whether the destination exists
243 # 2. If files are removed from the agent container, they should also be removed
244 # from the game container
245 self.logger.debug(f"Copying {agent.name}'s codebase")
246 assert_zero_exit_code(self.environment.execute(f"rm -rf /{agent.name}"), logger=self.logger)
247 copy_between_containers(
248 src_container=agent.environment,
249 dest_container=self.environment,
250 src_path=DIR_WORK,
251 dest_path=f"/{agent.name}",
252 )
253

Callers 1

run_roundMethod · 0.95

Calls 3

assert_zero_exit_codeFunction · 0.90
copy_between_containersFunction · 0.90
executeMethod · 0.45

Tested by

no test coverage detected