Submission Module

class judge0.submission.Submission(**data)

Stores a representation of a Submission to/from Judge0.

Parameters:
  • source_code (str, optional) – The source code to be executed.

  • language (LanguageAlias or int, optional) – The programming language of the source code. Defaults to LanguageAlias.PYTHON.

  • additional_files (base64 encoded string, optional) – Additional files that should be available alongside the source code. Value of this string should represent the content of a .zip that contains additional files. This attribute is required for multi-file programs.

  • compiler_options (str, optional) – Options for the compiler (i.e. compiler flags).

  • command_line_arguments (str, optional) – Command line arguments for the program.

  • stdin (str, optional) – Input to be fed via standard input during execution.

  • expected_output (str, optional) – The expected output of the program.

  • cpu_time_limit (float, optional) – Maximum CPU time allowed for execution, in seconds. Time in which the OS assigns the processor to different tasks is not counted. Depends on configuration.

  • cpu_extra_time (float, optional) – Additional CPU time allowance in case of time extension. Depends on configuration.

  • wall_time_limit (float, optional) – Maximum wall clock time allowed for execution, in seconds. Depends on configuration.

  • memory_limit (float, optional) – Maximum memory allocation allowed for the process, in kilobytes. Depends on configuration.

  • stack_limit (int, optional) – Maximum stack size allowed, in kilobytes. Depends on configuration.

  • max_processes_and_or_threads (int, optional) – Maximum number of processes and/or threads program can create. Depends on configuration.

  • enable_per_process_and_thread_time_limit (bool, optional) – If True, enforces time limits per process/thread. Depends on configuration.

  • enable_per_process_and_thread_memory_limit (bool, optional) – If True, enforces memory limits per process/thread. Depends on configuration.

  • max_file_size (int, optional) – Maximum file size allowed for output files, in kilobytes. Depends on configuration.

  • redirect_stderr_to_stdout (bool, optional) – If True, redirects standard error output to standard output.

  • enable_network (bool, optional) – If True, enables network access during execution.

  • number_of_runs (int, optional) – Number of times the code should be executed.

  • callback_url (str, optional) – URL for a callback to report execution results or status.

as_body(client)

Prepare Submission as a dictionary while taking into account the client’s restrictions.

Raises:

ValueError – If source code is missing.

Return type:

dict[str, Any]

is_done()

Check if submission is finished processing.

Submission is considered finished if the submission status is not IN_QUEUE and not PROCESSING.

Return type:

bool

pre_execution_copy()

Create a deep copy of a submission.

Return type:

Submission

set_attributes(attributes)

Set submissions attributes while taking into account different attribute’s types.

Parameters:

attributes (dict) – Key-value pairs of Submission attributes and the corresponding value.

Return type:

None

additional_files: str | Filesystem | None
callback_url: str | None
command_line_arguments: str | None
compile_output: str | None
compiler_options: str | None
cpu_extra_time: float | None
cpu_time_limit: float | None
created_at: datetime | None
enable_network: bool | None
enable_per_process_and_thread_memory_limit: bool | None
enable_per_process_and_thread_time_limit: bool | None
exit_code: int | None
exit_signal: int | None
expected_output: str | None
finished_at: datetime | None
language: LanguageAlias | int
max_file_size: int | None
max_processes_and_or_threads: int | None
memory: float | None
memory_limit: float | None
message: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'ignore'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

number_of_runs: int | None
post_execution_filesystem: Filesystem | None
redirect_stderr_to_stdout: bool | None
source_code: str | bytes | None
stack_limit: int | None
status: Status | None
stderr: str | None
stdin: str | None
stdout: str | None
time: float | None
token: Optional[Annotated[UUID]]
wall_time: float | None
wall_time_limit: float | None