Skip to content

Commit

Permalink
Fix notimplementederror
Browse files Browse the repository at this point in the history
  • Loading branch information
parasj committed Mar 8, 2022
1 parent 1793523 commit 74b659c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 1 addition & 3 deletions skylark/compute/aws/aws_cloud_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ def get_transfer_cost(src_key, dst_key, premium_tier=True):
src_rows = transfer_df.loc[src]
src_rows = src_rows[src_rows.index != "internet"]
return src_rows.max()["cost"]
elif dst_provider == "gcp" or dst_provider == "azure":
return transfer_df.loc[src, "internet"]["cost"]
else:
raise NotImplementedError
return transfer_df.loc[src, "internet"]["cost"]

def get_instance_list(self, region: str) -> List[AWSServer]:
ec2 = AWSServer.get_boto3_resource("ec2", region)
Expand Down
1 change: 1 addition & 0 deletions skylark/compute/azure/azure_cloud_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def get_transfer_cost(src_key, dst_key, premium_tier=True):
dst_provider, dst_region = dst_key.split(":")
assert src_provider == "azure"
if not premium_tier:
# TODO: tracked in https://github.com/parasj/skylark/issues/59
return NotImplementedError()

src_continent = AzureCloudProvider.lookup_continent(src_region)
Expand Down
2 changes: 1 addition & 1 deletion skylark/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def load() -> "SkylarkConfig":
config = SkylarkConfig.load_from_config_file(config_path)
else:
config = SkylarkConfig()

# set environment variables
if config.gcp_enabled:
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = config.gcp_application_credentials_file
Expand Down
2 changes: 1 addition & 1 deletion skylark/obj_store/azure_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class AzureObject(ObjectStoreObject):
def full_path(self):
raise NotImplementedError()
return os.path.join(f"https://{self.bucket}.blob.core.windows.net", self.key)


class AzureInterface(ObjectStoreInterface):
Expand Down
5 changes: 3 additions & 2 deletions skylark/obj_store/gcs_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class GCSObject(ObjectStoreObject):
def full_path(self):
raise NotImplementedError()
return os.path.join(f"gs://{self.bucket}", self.key)


class GCSInterface(ObjectStoreInterface):
Expand All @@ -37,7 +37,8 @@ def _on_done_upload(self, **kwargs):
self.pending_uploads -= 1

def infer_gcs_region(self, bucket_name: str):
raise NotImplementedError()
bucket = self._gcs_client.get_bucket(bucket_name)
return bucket.location

def bucket_exists(self):
try:
Expand Down
16 changes: 8 additions & 8 deletions skylark/obj_store/object_store_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@ class ObjectStoreObject:
last_modified: str

def full_path(self):
raise NotImplementedError
raise NotImplementedError()


class ObjectStoreInterface:
def bucket_exists(self):
raise NotImplementedError
raise NotImplementedError()

def create_bucket(self):
raise NotImplementedError
raise NotImplementedError()

def delete_bucket(self):
raise NotImplementedError
raise NotImplementedError()

def list_objects(self, prefix=""):
raise NotImplementedError
raise NotImplementedError()

def get_obj_size(self, obj_name):
raise NotImplementedError
raise NotImplementedError()

def download_object(self, src_object_name, dst_file_path):
raise NotImplementedError
raise NotImplementedError()

def upload_object(self, src_file_path, dst_object_name, content_type="infer"):
raise NotImplementedError
raise NotImplementedError()

@staticmethod
def create(region_tag: str, bucket: str):
Expand Down

0 comments on commit 74b659c

Please sign in to comment.