From 13461597f38a4594d9f9d0bcae80657cf170c229 Mon Sep 17 00:00:00 2001 From: Romil Bhardwaj Date: Tue, 30 Apr 2024 12:11:30 -0700 Subject: [PATCH] lint --- sky/cli.py | 20 +++++++++---------- sky/clouds/service_catalog/__init__.py | 17 ++++++++-------- .../service_catalog/kubernetes_catalog.py | 4 ++-- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/sky/cli.py b/sky/cli.py index 57f468166bf..97833eaa6e2 100644 --- a/sky/cli.py +++ b/sky/cli.py @@ -2919,10 +2919,8 @@ def _kubernetes_realtime_gpu_output(name_filter: Optional[str] = None, qty_header = 'QTY_FILTER' else: qty_header = 'QTY_PER_NODE' - realtime_gpu_table = log_utils.create_table([ - 'GPU', qty_header, 'TOTAL_GPUS', - 'AVAILABLE_GPUS' - ]) + realtime_gpu_table = log_utils.create_table( + ['GPU', qty_header, 'TOTAL_GPUS', 'AVAILABLE_GPUS']) counts, capacity, available = service_catalog.list_accelerator_realtime( gpus_only=True, clouds=cloud, @@ -2941,14 +2939,14 @@ def _kubernetes_realtime_gpu_output(name_filter: Optional[str] = None, 'run: sky show-gpus --cloud kubernetes.') if quantity_filter is not None: gpu_info_msg += f' with quantity {quantity_filter}' - err_msg = kubernetes_utils.NO_GPU_ERROR_MESSAGE.format(gpu_info_msg=gpu_info_msg, debug_msg=debug_msg) + err_msg = kubernetes_utils.NO_GPU_ERROR_MESSAGE.format( + gpu_info_msg=gpu_info_msg, debug_msg=debug_msg) yield err_msg return for gpu, _ in sorted(counts.items()): realtime_gpu_table.add_row([ gpu, - _list_to_str(counts.pop(gpu)), capacity[gpu], - available[gpu] + _list_to_str(counts.pop(gpu)), capacity[gpu], available[gpu] ]) yield from realtime_gpu_table.get_string() @@ -3082,15 +3080,17 @@ def _output(): cpu_str = str(int(cpu_count)) else: cpu_str = f'{cpu_count:.1f}' - device_memory_str = (f'{item.device_memory:.0f}GB' if - not pd.isna(item.device_memory) else '-') + device_memory_str = (f'{item.device_memory:.0f}GB' + if not pd.isna(item.device_memory) else + '-') host_memory_str = f'{item.memory:.0f}GB' if not pd.isna( item.memory) else '-' price_str = f'$ {item.price:.3f}' if not pd.isna( item.price) else '-' spot_price_str = f'$ {item.spot_price:.3f}' if not pd.isna( item.spot_price) else '-' - region_str = item.region if not pd.isna(item.region) else '-' + region_str = item.region if not pd.isna( + item.region) else '-' accelerator_table_vals = [ item.accelerator_name, item.accelerator_count, diff --git a/sky/clouds/service_catalog/__init__.py b/sky/clouds/service_catalog/__init__.py index 11063623f35..c654a66aecd 100644 --- a/sky/clouds/service_catalog/__init__.py +++ b/sky/clouds/service_catalog/__init__.py @@ -138,15 +138,14 @@ def list_accelerator_realtime( - Number of accelerators available at the time of call (availability). """ qtys_map, total_accelerators_capacity, total_accelerators_available = ( - _map_clouds_catalog( - clouds, - 'list_accelerators_realtime', - gpus_only, - name_filter, - region_filter, - quantity_filter, - all_regions=False, - require_price=False)) + _map_clouds_catalog(clouds, + 'list_accelerators_realtime', + gpus_only, + name_filter, + region_filter, + quantity_filter, + all_regions=False, + require_price=False)) accelerator_counts: Dict[str, List[int]] = collections.defaultdict(list) for gpu, items in qtys_map.items(): for item in items: diff --git a/sky/clouds/service_catalog/kubernetes_catalog.py b/sky/clouds/service_catalog/kubernetes_catalog.py index a7b0a7296ba..6e43fb62612 100644 --- a/sky/clouds/service_catalog/kubernetes_catalog.py +++ b/sky/clouds/service_catalog/kubernetes_catalog.py @@ -123,7 +123,7 @@ def list_accelerators_realtime( if accelerator_count >= min_quantity_filter: quantized_count = (min_quantity_filter * - (accelerator_count//min_quantity_filter)) + (accelerator_count // min_quantity_filter)) if accelerator_name not in total_accelerators_capacity: total_accelerators_capacity[ accelerator_name] = quantized_count @@ -133,7 +133,7 @@ def list_accelerators_realtime( if accelerators_available >= min_quantity_filter: quantized_availability = min_quantity_filter * ( - accelerators_available // min_quantity_filter) + accelerators_available // min_quantity_filter) if accelerator_name not in total_accelerators_available: total_accelerators_available[ accelerator_name] = quantized_availability