Skip to content

Commit

Permalink
add bapctools limits
Browse files Browse the repository at this point in the history
  • Loading branch information
mzuenni committed Jan 25, 2025
1 parent bdbdb21 commit 39aea9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions bin/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def _read_settings(self):
'validation_time': 60, # in seconds
'validation_memory': 2048, # in MiB
# 'validation_output': 8, # in MiB
# BAPCtools extension:
'generator_time': config.DEFAULT_TIMEOUT, # in seconds
'visualizer_time': config.DEFAULT_TIMEOUT, # in seconds
}

yaml_path = self.path / 'problem.yaml'
Expand Down Expand Up @@ -218,6 +221,8 @@ def _read_settings(self):
config.args.timeout or self.limits.time_safety_margin * self.settings.timelimit + 1
)
self.limits.validation_time = config.args.timeout or self.limits.validation_time
self.limits.generator_time = config.args.timeout or self.limits.generator_time
self.limits.visualizer_time = config.args.timeout or self.limits.visualizer_time
self.limits.memory = config.args.memory or self.limits.memory
self.limits.validation_memory = config.args.memory or self.limits.validation_memory

Expand Down
4 changes: 2 additions & 2 deletions bin/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def run(self, bar, cwd, name, args=[]):
else:
f.unlink()

timeout = config.args.timeout or config.DEFAULT_TIMEOUT
timeout = self.problem.limits.generator_time

with stdout_path.open('w') as stdout_file:
result = exec_command(
Expand Down Expand Up @@ -552,7 +552,7 @@ def run(self, cwd, args=[]):
assert self.run_command is not None
return exec_command(
self.run_command + args,
timeout=config.args.timeout or config.DEFAULT_TIMEOUT,
timeout=self.problem.limits.visualizer_time,
cwd=cwd,
memory=None,
)

0 comments on commit 39aea9a

Please sign in to comment.