From a88f417b66fa51750322f4a004ed68bac89e5a65 Mon Sep 17 00:00:00 2001 From: Diego Tavares Date: Fri, 6 Sep 2024 11:19:53 -0700 Subject: [PATCH 1/2] Minor fixes to cueadmin Fix issue when accessing pycue grpc objects and properly convert core values on displaySubscriptions --- cueadmin/cueadmin/common.py | 6 +++--- cueadmin/cueadmin/output.py | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cueadmin/cueadmin/common.py b/cueadmin/cueadmin/common.py index b80a76e12..237695cef 100644 --- a/cueadmin/cueadmin/common.py +++ b/cueadmin/cueadmin/common.py @@ -410,18 +410,18 @@ def dropAllDepends(job, layer=None, frame=None): logger.debug("dropping all depends on: %s/%04d-%s", job, layer, frame) depend_er_frame = opencue.api.findFrame(job, layer, frame) for depend in depend_er_frame.getWhatThisDependsOn(): - depend.proxy.satisfy() + depend.satisfy() elif layer: logger.debug("dropping all depends on: %s/%s", job, layer) depend_er_layer = opencue.api.findLayer(job, layer) for depend in depend_er_layer.getWhatThisDependsOn(): - depend.proxy.satisfy() + depend.satisfy() else: logger.debug("dropping all depends on: %s", job) depend_er_job = opencue.api.findJob(job) for depend in depend_er_job.getWhatThisDependsOn(): logger.debug("dropping depend %s %s", depend.data.type, opencue.id(depend)) - depend.proxy.satisfy() + depend.satisfy() class Convert(object): diff --git a/cueadmin/cueadmin/output.py b/cueadmin/cueadmin/output.py index 991a32b1f..2d338cb19 100644 --- a/cueadmin/cueadmin/output.py +++ b/cueadmin/cueadmin/output.py @@ -141,16 +141,19 @@ def displaySubscriptions(subscriptions, show): sub_format = "%-30s %-12s %6s %8s %8s %8s" print(sub_format % ("Allocation", "Show", "Size", "Burst", "Run", "Used")) for s in subscriptions: + size = s.data.size/100 + burst = s.data.burst/100 + run = s.data.reserved_cores/100 if s.data.size: perc = float(s.data.reserved_cores) / s.data.size * 100.0 else: - perc = s.data.reserved_cores * 100.0 + perc = run print(sub_format % (s.data.allocation_name, s.data.show_name, - s.data.size, - s.data.burst, - "%0.2f" % s.data.reserved_cores, + size, + burst, + "%0.2f" % run, "%0.2f%%" % perc)) From 7bbff8d72c996d4dc031609a8a14381d932856d4 Mon Sep 17 00:00:00 2001 From: Diego Tavares Date: Fri, 6 Sep 2024 12:10:09 -0700 Subject: [PATCH 2/2] Fix unit tests --- cueadmin/tests/output_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cueadmin/tests/output_tests.py b/cueadmin/tests/output_tests.py index 86305ac74..616263faa 100644 --- a/cueadmin/tests/output_tests.py +++ b/cueadmin/tests/output_tests.py @@ -213,8 +213,8 @@ def testDisplaySubscriptions(self, getStubMock): self.assertEqual( 'Subscriptions for showName\n' 'Allocation Show Size Burst Run Used\n' - 'local.general showName 1000 1500 500.00 50.00%\n' - 'cloud.desktop showName 0 1500 50.00 5000.00%\n', + 'local.general showName 10.0 15.0 5.00 50.00%\n' + 'cloud.desktop showName 0.0 15.0 0.50 0.50%\n', out.getvalue()) def testDisplayJobs(self, getStubMock):