Skip to content

Commit

Permalink
Merge pull request #8 from openml/aws_vpc_subnet
Browse files Browse the repository at this point in the history
Adding support for subnet_id in AWS script & config
  • Loading branch information
ledell authored Aug 31, 2018
2 parents f44470b + c4d5447 commit f7d0019
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions aws/AwsDockerOMLRun.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def __init__(self, aws_instance_type, docker_image, openml_id, fold,

self.setup = config["setup"]
self.token = config["token"]
if config["subnet_id"] == "":
self.subnet_id = None
else:
self.subnet_id = config["subnet_id"]

if region_name is None:
if "region_name" in config.keys() and len(config["region_name"]) > 0:
Expand All @@ -32,6 +36,7 @@ def __init__(self, aws_instance_type, docker_image, openml_id, fold,
self.region_name = boto3.session.Session().region_name
self.ec2_resource = boto3.resource("ec2", region_name=region_name)


with open("resources/ami.json") as file:
amis = json.load(file)

Expand All @@ -55,6 +60,7 @@ def createInstanceRun(self):
MinCount=1,
MaxCount=1,
InstanceType=self.aws_instance_type,
SubnetId=self.subnet_id,
UserData=setup)[0]

def terminateInstance(self):
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"overhead_time":600,
"query_frequency":10,
"max_parallel_jobs":5,
"region_name":"eu-west-1"
"region_name":"us-east-1",
"subnet_id":""
}

0 comments on commit f7d0019

Please sign in to comment.