diff --git a/dmoj/executors/base_executor.py b/dmoj/executors/base_executor.py index b7eeeecef..f099bcb38 100644 --- a/dmoj/executors/base_executor.py +++ b/dmoj/executors/base_executor.py @@ -135,6 +135,7 @@ class BaseExecutor(metaclass=ExecutorMeta): def __init__( self, problem_id: str, + storage_namespace: Optional[str], source_code: bytes, dest_dir: Optional[str] = None, hints: Optional[List[str]] = None, @@ -144,6 +145,7 @@ def __init__( self._tempdir = dest_dir or env.tempdir self._dir = None self.problem = problem_id + self.storage_namespace = '' if storage_namespace is None else storage_namespace self.source = source_code self._hints = hints or [] self.unbuffered = unbuffered diff --git a/dmoj/executors/c_like_executor.py b/dmoj/executors/c_like_executor.py index 48b984514..02dcb5b12 100644 --- a/dmoj/executors/c_like_executor.py +++ b/dmoj/executors/c_like_executor.py @@ -51,7 +51,10 @@ def get_binary_cache_key(self) -> bytes: command = self.get_command() assert command is not None key_components = ( - [self.problem, command, self.get_march_flag()] + self.get_defines() + self.get_flags() + self.get_ldflags() + [self.storage_namespace, self.problem, command, self.get_march_flag()] + + self.get_defines() + + self.get_flags() + + self.get_ldflags() ) return utf8bytes(''.join(key_components)) + b''.join(self.source_dict.values()) diff --git a/dmoj/executors/compiled_executor.py b/dmoj/executors/compiled_executor.py index b5bf61d75..9babe04bf 100644 --- a/dmoj/executors/compiled_executor.py +++ b/dmoj/executors/compiled_executor.py @@ -213,7 +213,7 @@ def handle_compile_error(self, output: bytes) -> None: raise CompileError(output) def get_binary_cache_key(self) -> bytes: - return utf8bytes(self.problem) + self.source + return utf8bytes(self.storage_namespace) + utf8bytes(self.problem) + self.source def compile(self) -> str: process = self.create_compile_process(self.get_compile_args()) diff --git a/dmoj/graders/communication.py b/dmoj/graders/communication.py index 360640a84..7f820dffa 100644 --- a/dmoj/graders/communication.py +++ b/dmoj/graders/communication.py @@ -203,7 +203,11 @@ def _generate_binary(self) -> BaseExecutor: aux_sources[signature_data['header']] = header entry = entry_point return executors[self.language].Executor( - self.problem.id, entry, aux_sources=aux_sources, defines=['-DSIGNATURE_GRADER'] + self.problem.id, + self.problem.storage_namespace, + entry, + aux_sources=aux_sources, + defines=['-DSIGNATURE_GRADER'], ) elif self.language in java_siggraders: aux_sources = {} @@ -218,7 +222,9 @@ def _generate_binary(self) -> BaseExecutor: entry = self.source aux_sources[self.problem.id + '_lib'] = entry_point - return executors[self.language].Executor(self.problem.id, entry, aux_sources=aux_sources) + return executors[self.language].Executor( + self.problem.id, self.problem.storage_namespace, entry, aux_sources=aux_sources + ) else: raise InternalError('no valid runtime for signature grading %s found' % self.language) diff --git a/dmoj/graders/signature.py b/dmoj/graders/signature.py index 8584f244b..b36f67746 100644 --- a/dmoj/graders/signature.py +++ b/dmoj/graders/signature.py @@ -28,7 +28,11 @@ def _generate_binary(self) -> BaseExecutor: aux_sources[handler_data['header']] = header entry = entry_point return executors[self.language].Executor( - self.problem.id, entry, aux_sources=aux_sources, defines=['-DSIGNATURE_GRADER'] + self.problem.id, + self.problem.storage_namespace, + entry, + aux_sources=aux_sources, + defines=['-DSIGNATURE_GRADER'], ) elif self.language in java_siggraders: aux_sources = {} @@ -43,6 +47,8 @@ def _generate_binary(self) -> BaseExecutor: entry = self.source aux_sources[self.problem.id + '_lib'] = entry_point - return executors[self.language].Executor(self.problem.id, entry, aux_sources=aux_sources) + return executors[self.language].Executor( + self.problem.id, self.problem.storage_namespace, entry, aux_sources=aux_sources + ) else: raise InternalError('no valid runtime for signature grading %s found' % self.language) diff --git a/dmoj/graders/standard.py b/dmoj/graders/standard.py index 42cd560aa..d088b5d58 100644 --- a/dmoj/graders/standard.py +++ b/dmoj/graders/standard.py @@ -109,6 +109,7 @@ def _interact_with_process(self, case: TestCase, result: Result, input: bytes) - def _generate_binary(self) -> BaseExecutor: return executors[self.language].Executor( self.problem.id, + self.problem.storage_namespace, self.source, hints=self.problem.config.hints or [], unbuffered=self.problem.config.unbuffered,