diff --git a/src/utils/resource_stat.py b/src/utils/resource_stat.py index c27c22f2a..0fc9d9945 100644 --- a/src/utils/resource_stat.py +++ b/src/utils/resource_stat.py @@ -132,19 +132,6 @@ def __ne__(self, other): class Gpu(ResourceStat): def __init__(self, res=None): - if res is None: - res = {} - elif isinstance(res, Gpu): - res = res.resource - elif not isinstance(res, dict): - res = {} - - # Disallow empty string for gpu type - res_keys = list(res.keys()) - for k in res_keys: - if k == "": - res.pop(k) - ResourceStat.__init__(self, res=res) diff --git a/src/utils/test_resource_stat.py b/src/utils/test_resource_stat.py index 098a9d241..68ed0315e 100644 --- a/src/utils/test_resource_stat.py +++ b/src/utils/test_resource_stat.py @@ -4,7 +4,7 @@ from resource_stat import ResourceStat, Gpu, Cpu, Memory -class TestResource(TestCase): +class TestResourceStat(TestCase): def init_with_class(self): self.cls_name = ResourceStat @@ -177,19 +177,16 @@ def test_ne(self): self.assertTrue(t2 != self.a) -class TestGpu(TestResource): +class TestGpu(TestResourceStat): def init_with_class(self): self.cls_name = Gpu - def test_empty_gpu_type(self): - self.assertEqual(Gpu(), Gpu({"": 1})) - -class TestCpu(TestResource): +class TestCpu(TestResourceStat): def init_with_class(self): self.cls_name = Cpu -class TestMemory(TestResource): +class TestMemory(TestResourceStat): def init_with_class(self): self.cls_name = Memory