Skip to main content

priint:cloud Library

Class: PriintCloud​

PriintCloud()​

This class retrieves multiple environment-variables from the systemthat are relevant to the priint:cloud-processes and might help for logging and debugging purposes.

Returns:The initialized PriintCloud-instance.
Return Type:PriintCloud

get_cloud_variables()​

Reads all environment-variables (accessible via os.environ) that begin with GRID_. Removes the GRID-prefix and returns them as a dictionary.
Additionally the comet-global "comet.gTemplateMapping" is checked and added.

Returns:A dictionary of all environment-variables with keys starting with "GRID_".
Return Type:dict

get_cloud_environment()​

Returns a dictionary with all environment-variables and additional details retrieved upon object-initialization (this includes values retrieved by function get_cloud_variables).

Returns:A dictionary with all environment-variables.
Return Type:dict

get_profiles()​

Read profiles given in priint-cloud request (environment-variable PROFILES). Alternatively at custom comet-attribute pyProfiles (for local testing).

Returns:List of strings of the attribute's-value, split at ,.
Return Type:list[str]

is_redeliver()​

Find out whether or not the rendering job's current redeliver-index is above 0.

Returns:Whether or not the rendering job's current redeliver-index is above 0.
Return Type:bool

is_trace_mode()​

Find out whether or not the rendering job was started with the profile trace.

Returns:Whether or not the rendering job was started with the profile trace
Return Type:bool

is_demo_mode()​

Find out whether or not the project's name ends in "_acc" (project deployed on staging-environment) and thus is in "demo mode".

Returns:Whether or not the project's name ends in "_acc".
Return Type:bool

write_export_variables(...)​

( data = None, merge = True )​

Writes data to the json-file located at the path given by the environment-variable EXPORT_FILE. priint:cloud evaluates this file when the renderpdf-worker is finished, so they can be used in config.ion-files of subsequent workers (callback, error, upload).

Parameters:data (dict)
A dictionary to be converted to JSON and written to the file at EXPORT_FILE. Keys will end up as the variable-names available in the config.ion-files.
merge (bool)
Should the given data be added to the existing data of the file (True) or should it overwrite the existing data of the file (False)?
Returns:The given data. If parameter merge is activated, also the current data from the JSON-file.
Return Type:dict

save_w2ml()​

Saves a w2ml-file of the current document next to the path in environment-variable EXPORT_FILE given by priint:cloud. For local testing / development only, as this file is not delivered by priint:cloud when downloading ticket-files.

Returns:No return value

Enums​

SystemType​

|Name|Value (str | int)| |----------|-------| |OTHER| 0 |LINUX| Linux |DARWIN| Darwin |WINDOWS| Windows

Class: System​

get_system_type()​

Return an enumerator of the current system's / OS' name.

Returns:Enumerator of the current system's / OS' name
Return Type:SystemType

get_all_process_memory_usage_linux()​

Retrieve information on how much memory each process is using. Method is only working on Linux-systems.

Returns:A list of all current processes with their pid, name and memory-usage (in KB) as tuples.
Return Type:list[tuple[str,str,int]]

log_current_memory_usage()​

Write information to the log-file on how much memory each process is using. Method is currently only implemented for Linux-systems.

Returns:None
Return Type:None