tmdeploy package¶
Submodules¶
tmdeploy.config module¶
-
class
tmdeploy.config.AnsibleGroupSection(description)¶ Bases:
tmdeploy.config._SetupSection-
name¶ str: name of the Ansible group
-
vars¶ dict: mapping of Ansible variable key-value pairs that should be only set for the group
-
-
class
tmdeploy.config.AnsibleHostVariableSection(description)¶ Bases:
tmdeploy.config._SetupSectionClass for the section of the TissueMAPS setup description that provides variables that determine how virtual machine instances belonging to the given cluster node type are created.
-
assign_public_ip¶ bool: whether a public IP address should be assigned to the virtual machine (default:
True)
-
db_user¶ str: database system user (default:
"postgres")
-
disk_size¶ int: size of the boot disk of the virtual machine in GB (optional)
-
flavor¶ str: name or ID of the flavor (machine type) which the virtual machine should have
-
image¶ str: name or ID of the image from which the virtual machine should be booted
-
ssh_user¶ str: user for establishing SSH connection to remote host (default:
"ubuntu")
List[str]: tags that should be added to instances (options:
{"web", "compute", "storage"})
-
tm_user¶ str: TissueMAPS system user (default:
"tissuemaps")
-
volume_mountpoint¶ str: mountpoint of an additional storage volume (default:
"storage")
-
volume_size¶ int: size of an additional storage volume in GB (optional)
-
web_user¶ str: database system user (default:
"nginx")
-
-
class
tmdeploy.config.ArchitectureSection(description)¶ Bases:
tmdeploy.config._SetupSectionClass for the section of the TissueMAPS setup description that provides information about the cluster architecture, i.e. the layout of computational resources.
-
clusters¶ List[tmdeploy.config.ClusterSection]: clusters that should be set up
-
name¶ str: name of the grid
-
-
class
tmdeploy.config.CloudSection(description)¶ Bases:
tmdeploy.config._SetupSectionClass for the section of the TissueMAPS setup description that provides information about the cloud infrastructure where the application should be deployed.
-
ip_range¶ str: range of allowed IPv4 addresses for the private network in Classless Inter-Domain Routing (CIDR) notation (default:
"10.65.4.0/24"")
-
key_file_private¶ str: path to the private key used by Ansible to connect to virtual machines (by default looks for a file with name
key_namein~/.sshdirectory)
-
key_file_public¶ str: path to the public key that will be uploaded to the cloud provider (by default looks for a
.pubfile with namekey_namein~/.sshdirectory)
-
key_name¶ str: name of the key-pair used to connect to virtual machines (default:
"tmaps")
-
network¶ str: name of the network that should be used (default:
"tmaps")
-
provider¶ str: name of the cloud provider (options:
{"os", "ec2", "gce"})
-
proxy¶ str: URI and port of a HTTP(S) proxy
-
region¶ str: cloud region (zone)
-
subnetwork¶ str: name or the subnetwork that should be used (defaults to
"{network}-subnet")
-
-
class
tmdeploy.config.ClusterNodeTypeSection(description)¶ Bases:
tmdeploy.config._SetupSection-
count¶ int: number of virtual machines
-
groups¶ List[tmdeploy.config.AnsibleGroupSection]: Ansible host groups that should be used for deployment of virtual machines beloning to the cluster node types
-
instance¶ AnsibleHostVariableSection: variables required for managing the virtual machine instances via Ansible (optional)
-
name¶ str: name of the cluster node type
-
-
class
tmdeploy.config.ClusterSection(description)¶ Bases:
tmdeploy.config._SetupSectionClass for the section of the TissueMAPS setup description that provides information about an individual cluster of virtual machine instances.
-
name¶ str: name of the cluster
-
node_types¶ List[tmdeploy.config.ClusterNodeTypeSection]: different types of virtual machines the cluster is comprised of
-
tmdeploy.errors module¶
-
exception
tmdeploy.errors.CloudError¶ Bases:
exceptions.ExceptionError class for interactions with cloud clients.
-
exception
tmdeploy.errors.MultipleInstancesFoundError¶ Bases:
tmdeploy.errors.CloudErrorError class for situations where multiple matching instances are found.
-
exception
tmdeploy.errors.NoInstanceFoundError¶ Bases:
tmdeploy.errors.CloudErrorError class for situations where no matching instance is found.
-
exception
tmdeploy.errors.SetupDescriptionError¶ Bases:
exceptions.ExceptionException class for erronous setup description.
-
exception
tmdeploy.errors.SetupEnvironmentError¶ Bases:
exceptions.ExceptionException class for missing environment variables required for setup.
tmdeploy.inventory module¶
-
tmdeploy.inventory.build_inventory(setup)¶ Builds an inventory for use as part of an dynamic Ansible inventory according to the script conventions:
{ "_meta" : { "hostvars" : { "host1": {}, "host2": {}, "host3": {}, ... }, "all": { "vars": {} }, "group1": { "hosts": ["host1", "host2"], "vars": {} }, "group2": { "hosts": ["host3"], "vars": {} }, ... }
Parameters: setup: tmdeploy.config.Setup
setup configuration
Returns: dict
mapping of groups to hosts
-
tmdeploy.inventory.load_inventory(hosts_file='/home/diego/.tmaps/setup/hosts')¶ Loads Ansible inventory from file.
Parameters: hosts_file: str, optional
path to Ansible hosts file
Returns: ConfigParser.SafeConfigParser
content of hosts_file
-
tmdeploy.inventory.save_inventory(inventory, hosts_file='/home/diego/.tmaps/setup/hosts')¶ Saves Ansible inventory to file.
Parameters: inventory: ConfigParser.SafeConfigParser
content of the hosts_file
hosts_file: str, optional
path to Ansible hosts file
tmdeploy.log module¶
-
class
tmdeploy.log.InfoFilter(name='')¶ Bases:
logging.FilterInitialize a filter.
Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.
-
filter(rec)¶
-
-
tmdeploy.log.LEVELS_TO_VERBOSITY= {0: 0, 40: 1, 10: 3, 50: 1, 20: 2, 30: 1}¶ dict[int, int]: Mapping of logging level to logging verbosity
-
tmdeploy.log.VERBOSITY_TO_LEVELS= {0: 0, 1: 30, 2: 20, 3: 10}¶ dict[int, int]: Mapping of logging verbosity to logging level
-
tmdeploy.log.configure_logging()¶ Configures the root logger for command line applications.
Two stream handlers will be added to the logger:
- “out” that will direct INFO & DEBUG messages to the standard output stream
- “err” that will direct WARN, WARNING, ERROR, & CRITICAL messages to the standard error stream
-
tmdeploy.log.map_logging_verbosity(verbosity)¶ Maps logging verbosity to level expected by logging module.
Parameters: verbosity: int
logging verbosity
Returns: int
logging level
Raises: TypeError
when verbosity doesn’t have type int
ValueError
when verbosity is negative
tmdeploy.utils module¶
-
tmdeploy.utils.from_json(description)¶
-
tmdeploy.utils.from_yaml(description)¶
-
tmdeploy.utils.read_json_file(filename)¶
-
tmdeploy.utils.read_yaml_file(filename)¶
-
tmdeploy.utils.to_json(description)¶
-
tmdeploy.utils.to_yaml(description)¶
-
tmdeploy.utils.write_yaml_file(filename, content)¶