Skip to content

Commit

Permalink
Merge branch 'develop' into release-v0.232.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kessler-frost committed Jan 23, 2024
2 parents a928f47 + 2f46195 commit 34e8f71
Show file tree
Hide file tree
Showing 59 changed files with 1,578 additions and 131 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Updated RTD notebooks to fix their behavior
- Changed the error being shown when drawing the transport graph of a lattice to a debug message instead
- Revamped README

### Removed

- Removed unused file transfer how to guides
- Removed `pennylane` as a requirement from notebooks' requirements.txt as it comes with `covalent`
- Removed `validate_args` and `validate_region` method from `deploy_group` CLI as they were specific to AWS

### Docs

- Added voice cloning tutorial

### Fixed

- Fixed the scenario where any deploy commands would fail if the user had a non deploy compatible plugin installed
- Fixed deploy commands' default value of plugins not being propagated to the tfvars file

## [0.233.0-rc.0] - 2024-01-07

Expand Down
253 changes: 157 additions & 96 deletions README.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions covalent/cloud_resource_manager/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,17 @@ def up(self, print_callback: Callable, dry_run: bool = True) -> None:
# Setup terraform infra variables as passed by the user
tf_vars_env_dict = os.environ.copy()

# Write the default values to the terraform.tfvars file
infra_settings = self.ExecutorInfraDefaults.schema()["properties"]
with open(tfvars_file, "w", encoding="utf-8") as f:
for key, value in infra_settings.items():
if "default" in value:
tf_vars_env_dict[f"TF_VAR_{key}"] = value["default"]

if value["default"] != "":
f.write(f'{key}="{value["default"]}"\n')

# Overwrite the default values with the user passed values
if self.executor_options:
with open(tfvars_file, "w", encoding="utf-8") as f:
for key, value in self.executor_options.items():
Expand Down
54 changes: 29 additions & 25 deletions covalent_dispatcher/_cli/groups/deploy_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from pathlib import Path
from typing import Callable, Dict, Tuple

import boto3
import click
from rich.console import Console
from rich.table import Table
Expand Down Expand Up @@ -176,12 +175,20 @@ def up(executor_name: str, vars: Dict, help: bool, dry_run: bool, verbose: bool)
$ covalent deploy up awslambda --verbose --region=us-east-1 --instance-type=t2.micro
"""

cmd_options = {key[2:]: value for key, value in (var.split("=") for var in vars)}
if msg := validate_args(cmd_options):
# Message is not None, so there was an error.
click.echo(msg)

try:
crm = get_crm_object(executor_name, cmd_options)
except (KeyError, AttributeError):
click.echo(
click.style(
f"Warning: '{executor_name}' is not a valid executor for deployment.",
fg="yellow",
)
)
sys.exit(1)
crm = get_crm_object(executor_name, cmd_options)

if help:
click.echo(Console().print(get_up_help_table(crm)))
sys.exit(0)
Expand Down Expand Up @@ -212,7 +219,18 @@ def down(executor_name: str, verbose: bool) -> None:
$ covalent deploy down ecs --verbose
"""
crm = get_crm_object(executor_name)

try:
crm = get_crm_object(executor_name)
except (KeyError, AttributeError):
click.echo(
click.style(
f"Warning: '{executor_name}' is not a valid executor for deployment.",
fg="yellow",
)
)
sys.exit(1)

_command = partial(crm.down)
_run_command_and_show_output(_command, "Destroying resources...", verbose=verbose)

Expand Down Expand Up @@ -247,7 +265,7 @@ def status(executor_names: Tuple[str]) -> None:
for name in _executor_manager.executor_plugins_map
if name not in ["dask", "local", "remote_executor"]
]
click.echo(f"Executors: {', '.join(executor_names)}")
click.echo(f"Installed executors: {', '.join(executor_names)}")

table = Table()
table.add_column("Executor", justify="center")
Expand All @@ -260,31 +278,17 @@ def status(executor_names: Tuple[str]) -> None:
crm = get_crm_object(executor_name)
crm_status = crm.status()
table.add_row(executor_name, crm_status, description[crm_status])
except KeyError:
except (KeyError, AttributeError):
# Added the AttributeError here as well in case the executor does not
# have the ExecutorPluginDefaults or ExecutorInfraDefaults classes.
invalid_executor_names.append(executor_name)

click.echo(Console().print(table))

if invalid_executor_names:
click.echo(
click.style(
f"Warning: {', '.join(invalid_executor_names)} are not valid executors.",
f"Warning: Invalid executors for deployment -> '{', '.join(invalid_executor_names)}'",
fg="yellow",
)
)


def validate_args(args: dict):
message = None
if len(args) == 0:
return message
if "region" in args and args["region"] != "":
if not validate_region(args["region"]):
return f"Unable to find the provided region: {args['region']}"


def validate_region(region_name: str):
ec2_client = boto3.client("ec2")
response = ec2_client.describe_regions()
exists = region_name in [item["RegionName"] for item in response["Regions"]]
return exists
Binary file added doc/source/_static/abstract_infra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions doc/source/_static/ai.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 34e8f71

Please sign in to comment.