Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working GCP in gateway #58

Merged
merged 1 commit into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skylark/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def replicate_random(
gcp_project: str = "skylark-333700",
gateway_docker_image: str = os.environ.get("SKYLARK_DOCKER_IMAGE", "ghcr.io/parasj/skylark:main"),
aws_instance_class: str = "m5.8xlarge",
gcp_instance_class: Optional[str] = None,
gcp_instance_class: Optional[str] = "n2-highmem-4",
gcp_use_premium_network: bool = False,
key_prefix: str = "/test/replicate_random",
time_limit_seconds: Optional[int] = None,
Expand Down
5 changes: 3 additions & 2 deletions skylark/compute/gcp/gcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import googleapiclient.discovery
import paramiko
from loguru import logger

from skylark import key_root
from skylark.compute.server import Server, ServerState
Expand All @@ -28,7 +29,7 @@ def __init__(
key_root = Path(key_root)
key_root.mkdir(parents=True, exist_ok=True)
if ssh_private_key is None:
self.ssh_private_key = key_root / f"gcp.pem"
self.ssh_private_key = key_root / f"gcp-cert.pem"
else:
self.ssh_private_key = ssh_private_key

Expand Down Expand Up @@ -88,7 +89,7 @@ def __repr__(self):

def terminate_instance_impl(self):
compute = self.get_gcp_client()
compute.instances().delete(project=self.gcp_project, zone=self.gcp_region, instance=self.instance_name).execute()
compute.instances().delete(project=self.gcp_project, zone=self.gcp_region, instance=self.instance_name()).execute()

def get_ssh_client_impl(self, uname=os.environ.get("USER"), ssh_key_password="skylark"):
"""Return paramiko client that connects to this instance."""
Expand Down
4 changes: 2 additions & 2 deletions skylark/replicate/replicator_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def run_replication_plan(self, job: ReplicationJob):
# assert all(len(path) == 2 for path in self.bound_paths), f"Only two-hop replication is supported"

# todo support GCP
assert job.source_region.split(":")[0] == "aws", f"Only AWS is supported for now, got {job.source_region}"
assert job.dest_region.split(":")[0] == "aws", f"Only AWS is supported for now, got {job.dest_region}"
assert job.source_region.split(":")[0] in ["aws", "gcp"], f"Only AWS and GCP is supported for now, got {job.source_region}"
assert job.dest_region.split(":")[0] in ["aws", "gcp"], f"Only AWS and GCP is supported for now, got {job.dest_region}"

# make list of chunks
chunks = []
Expand Down