Submission Module

class judge0.submission.Submission(*args, **kwargs)

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.

Return type:

dict

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

process_encoded_fields()

Validate all encoded attributes.

process_language()

Validate status attribute.

process_post_execution_filesystem()

Validate post_execution_filesystem attribute.

process_status()

Validate status attribute.

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