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.
-
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
-
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
isTrue
, 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 toFormat.PDF
.force (bool) – If True, compilation will be forced even if it has been attempted with these parameters previously. Default is
False
.
- Return type
- 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 toFormat.PDF
.
- Return type
- 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 toFormat.PDF
.
- Return type
- Returns
CompilationProduct
– The compilation product itself.
-
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 toFormat.PDF
.
- Return type
- Returns
Compilation
– The current state of the compilation.
-
-
class
arxiv.submission.services.compiler.compiler.
Download
(response)[source]¶ Bases:
object
Wrapper around response content.