Sandbox Module

The Sandbox module creates a tar archive of the scripts to be distributed to the worker nodes at the launch of a PiCaS job. The location of the sandbox is stored in the PiCaS token and upon launch, it is downloaded and extracted. The sandbox is created from a configuration file which defines its name, location scrts repository and any additional processing scripts, such as prefactor.

GRID_LRT.sandbox

Sandbox building and uploading module

class GRID_LRT.sandbox.Sandbox(cfgfile=None, **kwargs)[source]

Bases: object

A set of functions to create a sandbox from a configuration file. Uploads to grid storage and ssh-copies to a remote ftp server as a fallback location.

Usage with a .cfg file:

>>> from GRID_LRT import sandbox
>>> s=sandbox.Sandbox()
>>> s.build_sandbox('GRID_LRT/data/config/bash_file.cfg')
>>> s.upload_sandbox()

This will build the sandbox according to the recipe in bash_file.cfg and upload it to grid storage

__init__(cfgfile=None, **kwargs)[source]

Creates a ‘sandbox’ object which builds and uploads the sanbox. An optional argument is the configuration file which is a yaml file specifying the repositories to include, the type of the sanbox, and its name.

Example configuration files are included in GRID_LRT/data/config.

Parameters:cfgfile (str) – The name of the configuration file to build a sandbox from
build_sandbox(sbx_config)[source]

A comprehensive function that builds a Sandbox from a configuration file and creates a sandbox tarfile.

check_token()[source]

This function does the necessary linkage between the sandbox and token most importantly it saves the tokvar.cfg file in the sbx, but also checks if the token variables are all existing. If so, tokvar is created and put inside the SBX

cleanup()[source]
copy_base_scripts(basetype=None)[source]

Backwards compatible

copy_git_scripts()[source]

Reads the location of the sandbox base scripts repository and clones in the current directory. Checks out the appropriate branch

create_sbx_folder()[source]

Makes an empty sandbox folder or removes previous one

delete_gsi_sandbox(sbxfile)[source]
delete_sbx_folder()[source]

Removes the sandbox folder and subfolders

enter_sbx_folder(directory=None)[source]

Changes directory to the (temporary) sandbox folder)

get_result_loc()[source]
load_git_scripts()[source]

Loads the git scripts into the sandbox folder. Top dir names are defined in the yaml, not by the git name

make_tokvar_dict()[source]
parseconfig(yamlfile)[source]

Helper function to parse the sandbox configuration options from the yaml .cfg file. Loads the options in a dictionary stored in an internal variable

Parameters:yamlfile (str) – The name of the sandbox configuration file
sandbox_exists(sbxfile)[source]
upload_gsi_sbx(loc=None, upload_name=None)[source]

Uploads the sandbox to the relative folders

upload_sandbox(upload_name=None)[source]
upload_sbx(loc=None, upload_name=None)[source]

Uploads sandbox to all possible locations

upload_ssh_sandbox(upload_name=None)[source]
zip_sbx(zipname=None)[source]
class GRID_LRT.sandbox.UnauthorizedSandbox(*args, **kw)[source]

Bases: GRID_LRT.sandbox.Sandbox

__init__(*args, **kw)[source]

Creates a ‘sandbox’ object which builds and uploads the sanbox. An optional argument is the configuration file which is a yaml file specifying the repositories to include, the type of the sanbox, and its name.

Example configuration files are included in GRID_LRT/data/config.

Parameters:cfgfile (str) – The name of the configuration file to build a sandbox from
build_sandbox(sbx_config)

A comprehensive function that builds a Sandbox from a configuration file and creates a sandbox tarfile.

check_token()

This function does the necessary linkage between the sandbox and token most importantly it saves the tokvar.cfg file in the sbx, but also checks if the token variables are all existing. If so, tokvar is created and put inside the SBX

cleanup()
copy_base_scripts(basetype=None)

Backwards compatible

copy_git_scripts()

Reads the location of the sandbox base scripts repository and clones in the current directory. Checks out the appropriate branch

create_sbx_folder()

Makes an empty sandbox folder or removes previous one

delete_gsi_sandbox(sbxfile)
delete_sbx_folder()

Removes the sandbox folder and subfolders

enter_sbx_folder(directory=None)

Changes directory to the (temporary) sandbox folder)

get_result_loc()
load_git_scripts()

Loads the git scripts into the sandbox folder. Top dir names are defined in the yaml, not by the git name

make_tokvar_dict()
parseconfig(yamlfile)

Helper function to parse the sandbox configuration options from the yaml .cfg file. Loads the options in a dictionary stored in an internal variable

Parameters:yamlfile (str) – The name of the sandbox configuration file
sandbox_exists(sbxfile)
upload_gsi_sbx(loc=None, upload_name=None)

Uploads the sandbox to the relative folders

upload_sandbox(upload_name=None)
upload_sbx(loc=None, upload_name=None)

Uploads sandbox to all possible locations

upload_ssh_sandbox(upload_name=None)
zip_sbx(zipname=None)