Skip to content

QuokkaClusterManager

Create a QuokkaClusterManager object. This object is used to create Ray clusters on AWS EC2 configured with Quokka or connecting to existing Ray clusters. This requires you to have an AWS key pair for logging into instances.

Parameters:

Name Type Description Default
key_name str

The name of the key pair to use. This is a required argument if you want to call create_cluster.

None
key_location str

The location of the key pair to use. You must specify this argument.

None
security_group str

The security group to use.

None
Return

QuokkaClusterManager: A QuokkaClusterManager object.

Examples:

>>> from pyquokka.utils import *
>>> manager = QuokkaClusterManager(key_name = "my_key", key_location = "/home/ubuntu/.ssh/my_key.pem", security_group = "my_security_group")
>>> cluster = manager.create_cluster(aws_access_key, aws_access_id, num_instances = 2, instance_type = "i3.2xlarge", ami="ami-0530ca8899fac469f", requirements = ["numpy", "pandas"])
>>> cluster.to_json("my_cluster.json")

You can now close this Python session. In a new Python session you can connect to this cluster by doing:

>>> from pyquokka.utils import *
>>> manager = QuokkaClusterManager(key_name = "my_key", key_location = "/home/ubuntu/.ssh/my_key.pem", security_group = "my_security_group")
>>> cluster = manager.from_json("my_cluster.json")
Source code in pyquokka/utils.py
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
def __init__(self, key_name = None, key_location = None, security_group= None) -> None:

    """
    Create a QuokkaClusterManager object. This object is used to create Ray clusters on AWS EC2 configured with Quokka or connecting to existing Ray clusters.
    This requires you to have an AWS key pair for logging into instances. 

    Args:
        key_name (str, optional): The name of the key pair to use. This is a required argument if you want to call `create_cluster`.
        key_location (str, optional): The location of the key pair to use. You must specify this argument.
        security_group (str, optional): The security group to use. 

    Return:
        QuokkaClusterManager: A QuokkaClusterManager object.

    Examples:

        >>> from pyquokka.utils import *
        >>> manager = QuokkaClusterManager(key_name = "my_key", key_location = "/home/ubuntu/.ssh/my_key.pem", security_group = "my_security_group")
        >>> cluster = manager.create_cluster(aws_access_key, aws_access_id, num_instances = 2, instance_type = "i3.2xlarge", ami="ami-0530ca8899fac469f", requirements = ["numpy", "pandas"])
        >>> cluster.to_json("my_cluster.json")

        You can now close this Python session. In a new Python session you can connect to this cluster by doing:

        >>> from pyquokka.utils import *
        >>> manager = QuokkaClusterManager(key_name = "my_key", key_location = "/home/ubuntu/.ssh/my_key.pem", security_group = "my_security_group")
        >>> cluster = manager.from_json("my_cluster.json")
    """

    assert key_location is not None
    self.key_name = key_name
    self.key_location = key_location
    self.security_group = security_group