stochss_compute.cloud package

Submodules

stochss_compute.cloud.ec2 module

stochss_compute.cloud.ec2

class stochss_compute.cloud.ec2.EC2Cluster(local_config=None, remote_config=None)[source]

Bases: Server

Attempts to load a StochSS-Compute cluster. Otherwise just initializes a new cluster.

Parameters:
  • local_config (EC2LocalConfig) – Optional. Allows configuration of local cluster resources.

  • remote_config (EC2RemoteConfig) – Optional. Allows configuration of remote cluster resource identifiers.

Raises:

EC2Exception – possible boto3 ClientError from AWS calls. See here.

property address: str

The server’s IP address and port.

Returns:

http://{ip}:{port}”

Return type:

str

Raises:

EC2Exception – Do not call before launching a cluster.

clean_up()[source]

Terminates and removes all cluster resources.

Raises:

EC2Exception

possible boto3 ClientError from AWS calls. See here.

launch_single_node_instance(instance_type)[source]

Launches a single node StochSS-Compute instance. Make sure to check instance_type pricing before launching.

Parameters:

instance_type (str) –

Example: ‘t3.nano’ See full list here.

Raises:

EC2Exception

possible boto3 ClientError from AWS calls. See here.

log = <Logger EC2Cluster (INFO)>
property status: str

Return the EC2 instance status.

Returns:

A status set locally, or, if connected, a status fetched from the instance.

Return type:

str

stochss_compute.cloud.ec2_config module

stochss_compute.cloud.ec2_config

class stochss_compute.cloud.ec2_config.EC2LocalConfig(key_dir='./.sssc', key_name='sssc-server-ssh-key', status_file=None, key_type='ed25519', key_format='pem')[source]

Bases: object

Configure local settings.

Parameters:
  • key_dir (str) – Path to a directory to store SSH key.

  • key_name (str) – Name for the file.

  • status_file (str) – Path to a file to write instance status. Writes status to top line of that file.

  • key_type (str) – ed25519 or rsa

  • key_format (str) – pem or ppk

class stochss_compute.cloud.ec2_config.EC2RemoteConfig(suffix=None, vpc_name='sssc-vpc', subnet_name='sssc-subnet', security_group_name='sssc-sg', server_name='sssc-server', key_name='sssc-server-ssh-key', api_port=29681, region=None, ami=None)[source]

Bases: object

Configure remote settings.

Parameters:
  • suffix (str) – Add a suffix to all AWS resource names.

  • vpc_name (str) – Identify the VPC.

  • subnet_name (str) – Identify the subnet.

  • security_group_name (str) – Identify the security group.

  • server_name (str) – Identify the server.

  • key_name (str) – Identify the AWS EC2 KeyPair.

  • api_port (int) – Port to serve from.

  • region (str) –

    Region to point to, like ‘us-east-1’ See here.

  • ami (str) –

    Custom AMI to use, like ‘ami-09d3b3274b6c5d4aa’. See here.

stochss_compute.cloud.exceptions module

stochss_compute.cloud.exceptions

exception stochss_compute.cloud.exceptions.EC2Exception(*args: object)[source]

Bases: Exception

General exception class.

exception stochss_compute.cloud.exceptions.EC2ImportException(*args: object)[source]

Bases: Exception

Some extra dependencies are required for EC2.

exception stochss_compute.cloud.exceptions.ResourceException(*args: object)[source]

Bases: Exception

Misconfigured or out-of-date resources detected in the cluster setup.

Module contents

stochss_compute.cloud