Skip to content

Commit c811161

Browse files
committed
delete last remains of writable_files
1 parent 3ad4ba4 commit c811161

File tree

5 files changed

+4
-27
lines changed

5 files changed

+4
-27
lines changed

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
@@ -281,18 +281,13 @@ def _execution_step(self, job, file_cacher):
281281
self._actual_input: job.input
282282
}
283283

284-
# Check which redirect we need to perform, and in case we don't
285-
# manage the output via redirect, the submission needs to be able
286-
# to write on it.
287-
files_allowing_write = []
284+
# Check which redirect we need to perform
288285
stdin_redirect = None
289286
stdout_redirect = None
290287
if len(self.input_filename) == 0:
291288
stdin_redirect = self._actual_input
292289
if len(self.output_filename) == 0:
293290
stdout_redirect = self._actual_output
294-
else:
295-
files_allowing_write.append(self._actual_output)
296291

297292
# Create the sandbox
298293
sandbox = create_sandbox(file_cacher, name="evaluate")
@@ -310,7 +305,6 @@ def _execution_step(self, job, file_cacher):
310305
commands,
311306
job.time_limit,
312307
job.memory_limit,
313-
writable_files=files_allowing_write,
314308
stdin_redirect=stdin_redirect,
315309
stdout_redirect=stdout_redirect,
316310
multiprocess=job.multithreaded_sandbox)

cms/grading/tasktypes/Communication.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ def evaluate(self, job, file_cacher):
323323
manager_time_limit,
324324
config.sandbox.trusted_sandbox_max_memory_kib * 1024,
325325
dirs_map=dict((fifo_dir[i], (sandbox_fifo_dir[i], "rw")) for i in indices),
326-
writable_files=[self.OUTPUT_FILENAME],
327326
stdin_redirect=self.INPUT_FILENAME,
328327
multiprocess=job.multithreaded_sandbox,
329328
)

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
@@ -390,7 +390,6 @@ def test_single_process_success(self):
390390
self.evaluation_step_before_run.assert_has_calls([
391391
call(sandbox_mgr, cmdline_mgr, 4321, 1234 * 1024 * 1024,
392392
dirs_map={os.path.join(self.base_dir, "0"): ("/fifo0", "rw")},
393-
writable_files=["output.txt"],
394393
stdin_redirect="input.txt", multiprocess=True),
395394
call(sandbox_usr, cmdline_usr, 2.5, 123 * 1024 * 1024,
396395
dirs_map={os.path.join(self.base_dir, "0"): ("/fifo0", "rw")},
@@ -419,7 +418,7 @@ def test_single_process_success_long_time_limit(self):
419418

420419
self.evaluation_step_before_run.assert_has_calls([
421420
call(sandbox_mgr, ANY, 2.5 + 1, ANY, dirs_map=ANY,
422-
writable_files=ANY, stdin_redirect=ANY, multiprocess=ANY)])
421+
stdin_redirect=ANY, multiprocess=ANY)])
423422

424423
def test_single_process_missing_manager(self):
425424
# Manager is missing, should terminate without creating sandboxes.
@@ -644,7 +643,6 @@ def test_many_processes_success(self):
644643
os.path.join(self.base_dir, "0"): ("/fifo0", "rw"),
645644
os.path.join(self.base_dir, "1"): ("/fifo1", "rw"),
646645
},
647-
writable_files=["output.txt"],
648646
stdin_redirect="input.txt", multiprocess=True),
649647
call(sandbox_usr0, cmdline_usr0, 2.5, 123 * 1024 * 1024,
650648
dirs_map={os.path.join(self.base_dir, "0"): ("/fifo0", "rw")},
@@ -681,7 +679,7 @@ def test_many_processes_success_long_time_limit(self):
681679

682680
self.evaluation_step_before_run.assert_has_calls([
683681
call(sandbox_mgr, ANY, 2 * (2.5 + 1), ANY, dirs_map=ANY,
684-
writable_files=ANY, stdin_redirect=ANY, multiprocess=ANY)])
682+
stdin_redirect=ANY, multiprocess=ANY)])
685683

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

0 commit comments

Comments
 (0)