Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
])
.create_tags(Tags=master_tags))
slave_tags = [
{'Key': 'flintrock-role', 'Value': 'slave'},
{'Key': 'Name', 'Value': '{c}-slave'.format(c=cluster_name)}]
slave_tags += tags
(ec2.instances
.filter(
Filters=[
{'Name': 'instance-id', 'Values': [i.id for i in slave_instances]}
])
.create_tags(Tags=slave_tags))
cluster = EC2Cluster(
name=cluster_name,
region=region,
vpc_id=vpc_id,
ssh_key_pair=generate_ssh_key_pair(),
master_instance=master_instance,
slave_instances=slave_instances)
cluster.wait_for_state('running')
provision_cluster(
cluster=cluster,
services=services,
user=user,
identity_file=identity_file)
return cluster
def _compose_cluster(*, name: str, region: str, vpc_id: str, instances: list) -> EC2Cluster:
"""
Compose an EC2Cluster object from a set of raw EC2 instances representing
a Flintrock cluster.
"""
(master_instance, slave_instances) = _get_cluster_master_slaves(instances)
cluster = EC2Cluster(
name=name,
region=region,
vpc_id=vpc_id,
master_instance=master_instance,
slave_instances=slave_instances)
return cluster