From 93deeab02657c9ed9ede7675a5de6851e454d31c Mon Sep 17 00:00:00 2001 From: Dan King Date: Fri, 1 Sep 2023 14:46:07 -0400 Subject: [PATCH 1/2] [batch] remove redundant super class All these classes inherit from `Resource` which is an `abc.ABC`. --- batch/batch/cloud/azure/resources.py | 2 +- batch/batch/cloud/gcp/resources.py | 2 +- batch/batch/resources.py | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/batch/batch/cloud/azure/resources.py b/batch/batch/cloud/azure/resources.py index 0bf25885c53..32a7ac4a65b 100644 --- a/batch/batch/cloud/azure/resources.py +++ b/batch/batch/cloud/azure/resources.py @@ -14,7 +14,7 @@ from .resource_utils import azure_disk_from_storage_in_gib, azure_disks_by_disk_type -class AzureResource(Resource, abc.ABC): +class AzureResource(Resource): pass diff --git a/batch/batch/cloud/gcp/resources.py b/batch/batch/cloud/gcp/resources.py index 22118531091..d5106cfb559 100644 --- a/batch/batch/cloud/gcp/resources.py +++ b/batch/batch/cloud/gcp/resources.py @@ -14,7 +14,7 @@ ) -class GCPResource(Resource, abc.ABC): +class GCPResource(Resource): pass diff --git a/batch/batch/resources.py b/batch/batch/resources.py index d77589f0256..aa5dc778f11 100644 --- a/batch/batch/resources.py +++ b/batch/batch/resources.py @@ -33,7 +33,7 @@ def to_dict(self) -> dict: raise NotImplementedError -class StaticSizedDiskResourceMixin(Resource, abc.ABC): +class StaticSizedDiskResourceMixin(Resource): storage_in_gib: int def to_quantified_resource( @@ -44,7 +44,7 @@ def to_quantified_resource( return {'name': self.name, 'quantity': self.storage_in_gib * worker_fraction_in_1024ths} -class DynamicSizedDiskResourceMixin(Resource, abc.ABC): +class DynamicSizedDiskResourceMixin(Resource): @abc.abstractmethod def to_quantified_resource( self, cpu_in_mcpu: int, memory_in_bytes: int, worker_fraction_in_1024ths: int, external_storage_in_gib: int @@ -52,7 +52,7 @@ def to_quantified_resource( raise NotImplementedError -class ComputeResourceMixin(Resource, abc.ABC): +class ComputeResourceMixin(Resource): def to_quantified_resource( self, cpu_in_mcpu: int, memory_in_bytes: int, worker_fraction_in_1024ths: int, external_storage_in_gib: int ) -> Optional[QuantifiedResource]: # pylint: disable=unused-argument @@ -60,7 +60,7 @@ def to_quantified_resource( return {'name': self.name, 'quantity': cpu_in_mcpu} -class VMResourceMixin(Resource, abc.ABC): +class VMResourceMixin(Resource): def to_quantified_resource( self, cpu_in_mcpu: int, memory_in_bytes: int, worker_fraction_in_1024ths: int, external_storage_in_gib: int ) -> Optional[QuantifiedResource]: # pylint: disable=unused-argument @@ -68,7 +68,7 @@ def to_quantified_resource( return {'name': self.name, 'quantity': worker_fraction_in_1024ths} -class MemoryResourceMixin(Resource, abc.ABC): +class MemoryResourceMixin(Resource): def to_quantified_resource( self, cpu_in_mcpu: int, memory_in_bytes: int, worker_fraction_in_1024ths: int, external_storage_in_gib: int ) -> Optional[QuantifiedResource]: # pylint: disable=unused-argument @@ -76,7 +76,7 @@ def to_quantified_resource( return {'name': self.name, 'quantity': memory_in_bytes // 1024 // 1024} -class IPFeeResourceMixin(Resource, abc.ABC): +class IPFeeResourceMixin(Resource): def to_quantified_resource( self, cpu_in_mcpu: int, memory_in_bytes: int, worker_fraction_in_1024ths: int, external_storage_in_gib: int ) -> Optional[QuantifiedResource]: # pylint: disable=unused-argument @@ -84,7 +84,7 @@ def to_quantified_resource( return {'name': self.name, 'quantity': worker_fraction_in_1024ths} -class ServiceFeeResourceMixin(Resource, abc.ABC): +class ServiceFeeResourceMixin(Resource): def to_quantified_resource( self, cpu_in_mcpu: int, memory_in_bytes: int, worker_fraction_in_1024ths: int, external_storage_in_gib: int ) -> Optional[QuantifiedResource]: # pylint: disable=unused-argument From f4c39938781c8b4ae7ed6962a67caf7e2b822c62 Mon Sep 17 00:00:00 2001 From: Dan King Date: Fri, 1 Sep 2023 16:57:59 -0400 Subject: [PATCH 2/2] fix lints --- batch/batch/cloud/azure/resources.py | 1 - batch/batch/cloud/gcp/resources.py | 1 - 2 files changed, 2 deletions(-) diff --git a/batch/batch/cloud/azure/resources.py b/batch/batch/cloud/azure/resources.py index 32a7ac4a65b..e8f08a6c3c1 100644 --- a/batch/batch/cloud/azure/resources.py +++ b/batch/batch/cloud/azure/resources.py @@ -1,4 +1,3 @@ -import abc from typing import Any, Dict, Optional from ...driver.billing_manager import ProductVersions diff --git a/batch/batch/cloud/gcp/resources.py b/batch/batch/cloud/gcp/resources.py index d5106cfb559..8218eb23cb7 100644 --- a/batch/batch/cloud/gcp/resources.py +++ b/batch/batch/cloud/gcp/resources.py @@ -1,4 +1,3 @@ -import abc from typing import Any, Dict, Optional from ...driver.billing_manager import ProductVersions