compiler.compiler module

Dispatching and execution of compilation tasks.

Parameters supported by autotex “converter” image:

-C cache directory [defaults to paper/format specific directory in PS_CACHE]
-D pass through for -D dvips flag
-f output format, only sensible use is -f fInm for pdf generation
-u add a psmapfile to dvips command "-u +psmapfile"
-h print usage
-k do not delete temporary directory
-P pass through for -P dvips flag
-p id of paper to process (pre 2007 archive/papernum or new numerical id
   yymm.\\d{4,5}) (required!)
-d id to use for decrytion (overrides default to -p id)
-s do not add stamp to PostScript
-t pass through for -t dvips flag (letter, legal, ledger, a4, a3, landscape)
-v verbose logging, that is, print log messages to STDOUT
   (they are always logged to auto_gen_ps.log)
-q quiet - don't send emails to tex_admin (not the inverse of verbose!)
-W working directory [defaults to paper/version specific dir in PS_GEN_TMP]
-X cache DVI file (default: no)
-Y don't copy PostScript or PDF to cache
-Z don't gzip PostScript before moving to cache
-T override the default AUTOTEX_TIMEOUT setting with user value

We’re going to use:

  • -f output format, only sensible use is -f fInm for pdf generation (fInm, dvi, ps)

  • -p id of paper to process (pre 2007 archive/papernum or new numerical id yymm.\d{4,5}) (required!)

  • -s do not add stamp to PostScript

  • -T override the default AUTOTEX_TIMEOUT setting with user value

  • -u add a psmapfile to dvips command “-u +psmapfile”

  • -P pass through for -P dvips flag

  • -t pass through for -t dvips flag (letter, legal, ledger, a4, a3, landscape)

  • -D pass through for -D dvips flag

  • -d id to use for decrytion (overrides default to -p id)

Always do this:

  • -q quiet - don’t send emails to tex_admin (not the inverse of verbose!)

  • -Y don’t copy PostScript or PDF to cache

exception compiler.compiler.AuthorizationFailed[source]

Bases: RuntimeError

The request was not authorized.

exception compiler.compiler.CorruptedSource[source]

Bases: RuntimeError

The source content is corrupted.

exception compiler.compiler.NoSuchTask[source]

Bases: RuntimeError

A request was made for a non-existant task.

exception compiler.compiler.TaskCreationFailed[source]

Bases: RuntimeError

An extraction task could not be created.

compiler.compiler.get_task(source_id, checksum, output_format=<Format.PDF: 'pdf'>)[source]

Get the status of an extraction task.

Parameters
  • source_id (str) – Unique identifier for the source being compiled.

  • checksum (str) – The checksum for the source package. This is used to differentiate compilation tasks.

  • output_format (Format) – The desired output format. Default: Format.PDF.

Returns

Return type

Task

Return type

Task

compiler.compiler.is_available()[source]

Verify that we can start compilations.

Return type

bool

compiler.compiler.run_docker(image, volumes=[], ports=[], args=[], daemon=False)[source]

Run a generic docker image.

In our uses, we wish to set the userid to that of running process (getuid) by default. Additionally, we do not expose any ports for running services making this a rather simple function.

Parameters
  • image (str) – Name of the docker image in the format ‘repository/name:tag’

  • volumes (list of tuple of str) – List of volumes to mount in the format [host_dir, container_dir].

  • args (str) – Arguments to the image’s run cmd (set by Dockerfile CMD)

  • daemon (boolean) – If True, launches the task to be run forever

Returns

  • int – Compilation exit code.

  • str – STDOUT from compilation.

  • str – STDERR from compilation.

Return type

Tuple[int, str, str]

compiler.compiler.start_compilation(source_id, checksum, stamp_label=None, stamp_link=None, output_format=<Format.PDF: 'pdf'>, preferred_compiler=None, token=None, owner=None)[source]

Create a new compilation task.

Parameters
  • source_id (str) – Unique identifier for the source being compiled.

  • checksum (str) – The checksum for the source package. This is used to differentiate compilation tasks.

  • output_format (Format) – The desired output format. Default: Format.PDF.

  • preferred_compiler (str) –

Returns

The identifier for the created compilation task.

Return type

str

Return type

str

compiler.compiler.update_sent_state(sender=None, headers=None, body=None, **kwargs)[source]

Set state to SENT, so that we can tell whether a task exists.

Return type

None