arxiv.submission.services.compiler.compiler module

Integration with the compiler service API.

The compiler is responsible for building PDF, DVI, and other goodies from LaTeX sources. In the submission UI, we specifically want to build a PDF so that the user can preview their submission. Additionally, we want to show the submitter the TeX log so that they can identify any potential problems with their sources.

exception arxiv.submission.services.compiler.compiler.CompilationFailed[source]

Bases: RuntimeError

The compilation service failed to compile the source package.

class arxiv.submission.services.compiler.compiler.Compiler(verify=True, headers={})[source]

Bases: arxiv.integration.api.service.HTTPIntegration

Encapsulates a connection with the compiler service.

class Meta[source]

Bases: object

Configuration for Classifier.

service_name = 'compiler'
NAME = 'arxiv-compiler'

Name of the compiler service with which we are integrating.

VERSION = '0.1'

Verison of the compiler service with which we are integrating.

compilation_is_complete(checksum, token, output_format)[source]

Check whether compilation has completed successfully.

Return type

bool

compile(checksum, token, stamp_label, stamp_link, compiler=None, output_format=<Format.PDF: 'pdf'>, force=False)[source]

Request compilation for an upload workspace.

Unless force is True, the compiler service will only attempt to compile a source ID + checksum + format combo once. If there is already a compilation underway or complete for the parameters in this request, the service will redirect to the corresponding status URI. Hence the data returned by this function may be from the response to the initial POST request, or from the status endpoint after being redirected.

Parameters
  • source_id (int) – Unique identifier for the upload workspace.

  • checksum (str) – State up of the upload workspace.

  • token (str) – The original (encrypted) auth token on the request. Used to perform subrequests to the file management service.

  • stamp_label (str) –

    Label to use in PS/PDF stamp/watermark. Form is

    ’Identifier [Category Date]’

    Category and Date are optional. By default Date will be added by compiler.

  • stamp_link (str) – Link (URI) to use in PS/PDF stamp/watermark.

  • compiler (Compiler or None) – Name of the preferred compiler.

  • output_format (Format) – Defaults to Format.PDF.

  • force (bool) – If True, compilation will be forced even if it has been attempted with these parameters previously. Default is False.

Return type

Compilation

Returns

Compilation – The current state of the compilation.

get_log(checksum, token, output_format=<Format.PDF: 'pdf'>)[source]

Get the compilation log for an upload workspace, if it exists.

Parameters
  • source_id (int) – Unique identifier for the upload workspace.

  • checksum (str) – State up of the upload workspace.

  • output_format (Format) – Defaults to Format.PDF.

Return type

CompilationLog

Returns

CompilationProduct – The compilation product itself.

get_product(checksum, token, output_format=<Format.PDF: 'pdf'>)[source]

Get the compilation product for an upload workspace, if it exists.

Parameters
  • source_id (int) – Unique identifier for the upload workspace.

  • checksum (str) – State up of the upload workspace.

  • output_format (Format) – Defaults to Format.PDF.

Return type

CompilationProduct

Returns

CompilationProduct – The compilation product itself.

get_service_status()[source]

Get the status of the compiler service.

Return type

dict

get_status(checksum, token, output_format=<Format.PDF: 'pdf'>)[source]

Get the status of a compilation.

Parameters
  • source_id (int) – Unique identifier for the upload workspace.

  • checksum (str) – State up of the upload workspace.

  • output_format (Format) – Defaults to Format.PDF.

Return type

Compilation

Returns

Compilation – The current state of the compilation.

is_available()[source]

Check our connection to the compiler service.

Return type

bool

class arxiv.submission.services.compiler.compiler.Download(response)[source]

Bases: object

Wrapper around response content.

read(*args, **kwargs)[source]

Read response content.

Return type

bytes

arxiv.submission.services.compiler.compiler.get_task_id(source_id, checksum, output_format)[source]

Generate a key for a /checksum/format combination.

Return type

str

arxiv.submission.services.compiler.compiler.split_task_id(task_id)[source]
Return type

Tuple[str, str, Format]