Skip to content

Commit 581321f

Browse files
committed
delete last remains of writable_files
1 parent 1e6a1c7 commit 581321f

5 files changed

Lines changed: 4 additions & 27 deletions

File tree

cms/grading/steps/evaluation.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def evaluation_step(
8686
time_limit: float | None = None,
8787
memory_limit: int | None = None,
8888
dirs_map: dict[str, tuple[str | None, str | None]] | None = None,
89-
writable_files: list[str] | None = None,
9089
stdin_redirect: str | None = None,
9190
stdout_redirect: str | None = None,
9291
multiprocess: bool = False,
@@ -109,11 +108,6 @@ def evaluation_step(
109108
from external directories to a pair of strings: the first is the path
110109
they should be mapped to inside the sandbox, the second, is
111110
isolate's options for the mapping.
112-
writable_files: a list of inner file names (relative to
113-
the inner path) on which the command is allow to write, or None to
114-
indicate that all files are read-only; if applicable, redirected
115-
output and the standard error are implicitly added to the files
116-
allowed.
117111
stdin_redirect: the name of the file that will be redirected
118112
to the standard input of each command; if None, nothing will be
119113
provided to stdin.
@@ -136,7 +130,7 @@ def evaluation_step(
136130
for command in commands:
137131
success = evaluation_step_before_run(
138132
sandbox, command, time_limit, memory_limit,
139-
dirs_map, writable_files, stdin_redirect, stdout_redirect,
133+
dirs_map, stdin_redirect, stdout_redirect,
140134
multiprocess, wait=True)
141135
if not success:
142136
logger.debug("Job failed in evaluation_step_before_run.")
@@ -155,7 +149,6 @@ def evaluation_step_before_run(
155149
time_limit: float | None = None,
156150
memory_limit: int | None = None,
157151
dirs_map: dict[str, tuple[str | None, str | None]] | None = None,
158-
writable_files: list[str] | None = None,
159152
stdin_redirect: str | None = None,
160153
stdout_redirect: str | None = None,
161154
multiprocess: bool = False,
@@ -182,8 +175,6 @@ def evaluation_step_before_run(
182175
# Default parameters handling.
183176
if dirs_map is None:
184177
dirs_map = {}
185-
if writable_files is None:
186-
writable_files = []
187178
if stdout_redirect is None:
188179
stdout_redirect = "stdout.txt"
189180

@@ -209,9 +200,6 @@ def evaluation_step_before_run(
209200

210201
for src, (dest, options) in dirs_map.items():
211202
sandbox.add_mapped_directory(src, dest=dest, options=options)
212-
for name in [sandbox.stderr_file, sandbox.stdout_file]:
213-
if name is not None:
214-
writable_files.append(name)
215203

216204
sandbox.set_multiprocess(multiprocess)
217205

cms/grading/tasktypes/Batch.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,18 +284,13 @@ def _execution_step(self, job: EvaluationJob, file_cacher: FileCacher):
284284
self._actual_input: job.input
285285
}
286286

287-
# Check which redirect we need to perform, and in case we don't
288-
# manage the output via redirect, the submission needs to be able
289-
# to write on it.
290-
files_allowing_write = []
287+
# Check which redirect we need to perform
291288
stdin_redirect = None
292289
stdout_redirect = None
293290
if len(self.input_filename) == 0:
294291
stdin_redirect = self._actual_input
295292
if len(self.output_filename) == 0:
296293
stdout_redirect = self._actual_output
297-
else:
298-
files_allowing_write.append(self._actual_output)
299294

300295
# Create the sandbox
301296
sandbox = create_sandbox(0, file_cacher, name="evaluate")
@@ -313,7 +308,6 @@ def _execution_step(self, job: EvaluationJob, file_cacher: FileCacher):
313308
commands,
314309
job.time_limit,
315310
job.memory_limit,
316-
writable_files=files_allowing_write,
317311
stdin_redirect=stdin_redirect,
318312
stdout_redirect=stdout_redirect,
319313
multiprocess=job.multithreaded_sandbox)

cms/grading/tasktypes/Communication.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ def evaluate(self, job: EvaluationJob, file_cacher: FileCacher):
327327
manager_time_limit,
328328
config.sandbox.trusted_sandbox_max_memory_kib * 1024,
329329
dirs_map=dict((fifo_dir[i], (sandbox_fifo_dir[i], "rw")) for i in indices),
330-
writable_files=[self.OUTPUT_FILENAME],
331330
stdin_redirect=self.INPUT_FILENAME,
332331
multiprocess=job.multithreaded_sandbox,
333332
)

cmstestsuite/unit_tests/grading/tasktypes/BatchTest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@ def test_stdio_diff_success(self):
355355
sandbox,
356356
fake_evaluation_commands(EVALUATION_COMMAND_1, "foo", "foo"),
357357
2.5, 123 * 1024 * 1024,
358-
writable_files=[],
359358
stdin_redirect="input.txt",
360359
stdout_redirect="output.txt",
361360
multiprocess=True)
@@ -476,7 +475,6 @@ def test_fileio_diff_success(self):
476475
sandbox,
477476
fake_evaluation_commands(EVALUATION_COMMAND_1, "foo", "foo"),
478477
2.5, 123 * 1024 * 1024,
479-
writable_files=["myout"],
480478
stdin_redirect=None,
481479
stdout_redirect=None,
482480
multiprocess=True)

cmstestsuite/unit_tests/grading/tasktypes/CommunicationTest.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ def test_single_process_success(self):
393393
self.evaluation_step_before_run.assert_has_calls([
394394
call(sandbox_mgr, cmdline_mgr, 4321, 1234 * 1024 * 1024,
395395
dirs_map={os.path.join(self.base_dir, "0"): ("/fifo0", "rw")},
396-
writable_files=["output.txt"],
397396
stdin_redirect="input.txt", multiprocess=True),
398397
call(sandbox_usr, cmdline_usr, 2.5, 123 * 1024 * 1024,
399398
dirs_map={os.path.join(self.base_dir, "0"): ("/fifo0", "rw")},
@@ -422,7 +421,7 @@ def test_single_process_success_long_time_limit(self):
422421

423422
self.evaluation_step_before_run.assert_has_calls([
424423
call(sandbox_mgr, ANY, 2.5 + 1, ANY, dirs_map=ANY,
425-
writable_files=ANY, stdin_redirect=ANY, multiprocess=ANY)])
424+
stdin_redirect=ANY, multiprocess=ANY)])
426425

427426
def test_single_process_missing_manager(self):
428427
# Manager is missing, should terminate without creating sandboxes.
@@ -647,7 +646,6 @@ def test_many_processes_success(self):
647646
os.path.join(self.base_dir, "0"): ("/fifo0", "rw"),
648647
os.path.join(self.base_dir, "1"): ("/fifo1", "rw"),
649648
},
650-
writable_files=["output.txt"],
651649
stdin_redirect="input.txt", multiprocess=True),
652650
call(sandbox_usr0, cmdline_usr0, 2.5, 123 * 1024 * 1024,
653651
dirs_map={os.path.join(self.base_dir, "0"): ("/fifo0", "rw")},
@@ -684,7 +682,7 @@ def test_many_processes_success_long_time_limit(self):
684682

685683
self.evaluation_step_before_run.assert_has_calls([
686684
call(sandbox_mgr, ANY, 2 * (2.5 + 1), ANY, dirs_map=ANY,
687-
writable_files=ANY, stdin_redirect=ANY, multiprocess=ANY)])
685+
stdin_redirect=ANY, multiprocess=ANY)])
688686

689687
def test_many_processes_first_user_failure(self):
690688
# One of the user programs had problems, it's the user's fault.

0 commit comments

Comments
 (0)