Skip to content

Commit

Permalink
fix, updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
apls777 committed May 8, 2019
1 parent e28b734 commit d2c52f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
11 changes: 0 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ Prepare a `spotty.yaml` file and put it to the root directory of your project:
- Read [this](https://medium.com/@apls/how-to-train-deep-learning-models-on-aws-spot-instances-using-spotty-8d9e0543d365){:target="_blank"}
article for a real-world example.

### __Create an AMI__

Run the following command from the root directory of your project:

```bash
$ spotty aws create-ami
```

In several minutes you will have an AMI with NVIDIA Docker that Spotty will use
for all your projects within the AWS region.

### __Start an instance__

Use the following command to launch an instance with the Docker container:
Expand Down
13 changes: 10 additions & 3 deletions spotty/providers/aws/deployment/instance_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,23 @@ def _get_template_parameters(self, instance_profile_arn: str, instance_name: str
return parameters

def _get_ami(self) -> Image:
"""Returns an AMI that should be used for deployment.
Raises:
ValueError: If an AMI not found.
"""
if self.instance_config.ami_id:
# get an AMI by ID if the "amiId" parameter is specified
image = Image.get_by_id(self._ec2, self.instance_config.ami_id)
if not image:
ValueError('AMI with ID=%s not found.' % self.instance_config.ami_id)
raise ValueError('AMI with ID=%s not found.' % self.instance_config.ami_id)
else:
# try to get an AMI by its name (if the "amiName" parameter is not specified, the default value is used)
image = Image.get_by_name(self._ec2, self.instance_config.ami_name)
if not image:
if self.instance_config.has_ami_name:
# AMI with the name specified in the configuration file was not found
ValueError('AMI with the name "%s" was not found.' % self.instance_config.ami_name)
# if an AMI name was explicitly specified in the config, but the AMI was not found, raise an error
raise ValueError('AMI with the name "%s" was not found.' % self.instance_config.ami_name)
else:
# get the latest "Deep Learning Base AMI"
res = self._ec2.describe_images(
Expand Down

0 comments on commit d2c52f1

Please sign in to comment.