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
-
copy_git_scripts
()[source]¶ Reads the location of the sandbox base scripts repository and clones in the current directory. Checks out the appropriate branch
-
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
-
Bases:
GRID_LRT.sandbox.Sandbox
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
A comprehensive function that builds a Sandbox from a configuration file and creates a sandbox tarfile.
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
Backwards compatible
Reads the location of the sandbox base scripts repository and clones in the current directory. Checks out the appropriate branch
Makes an empty sandbox folder or removes previous one
Removes the sandbox folder and subfolders
Changes directory to the (temporary) sandbox folder)
Loads the git scripts into the sandbox folder. Top dir names are defined in the yaml, not by the git name
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
Uploads the sandbox to the relative folders
Uploads sandbox to all possible locations