From a7ab936dbf4e3d43d080029bacfb596eda4083e7 Mon Sep 17 00:00:00 2001 From: Roman Skurikhin Date: Thu, 9 Jun 2022 13:57:43 +0300 Subject: [PATCH] Do config reload in neuro config show (#2728) * Do config reload in neuro config show * Add changelog --- CHANGELOG.D/2728.feature | 1 + neuro-cli/src/neuro_cli/config.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG.D/2728.feature diff --git a/CHANGELOG.D/2728.feature b/CHANGELOG.D/2728.feature new file mode 100644 index 000000000..442942b9a --- /dev/null +++ b/CHANGELOG.D/2728.feature @@ -0,0 +1 @@ +Re-load clusters config in `neuro config show`. diff --git a/neuro-cli/src/neuro_cli/config.py b/neuro-cli/src/neuro_cli/config.py index c09d34bd8..75164db73 100644 --- a/neuro-cli/src/neuro_cli/config.py +++ b/neuro-cli/src/neuro_cli/config.py @@ -34,12 +34,18 @@ async def show(root: Root) -> None: """ Print current settings. """ + + with root.status("Fetching the current config"): + await root.client.config.fetch() cluster_name = root.client.config.cluster_name fmt = ConfigFormatter() - try: - jobs_capacity = await root.client.jobs.get_capacity(cluster_name=cluster_name) - except (ClientConnectionError, AuthorizationError): - jobs_capacity = {} + with root.status("Fetching the jobs capacity"): + try: + jobs_capacity = await root.client.jobs.get_capacity( + cluster_name=cluster_name + ) + except (ClientConnectionError, AuthorizationError): + jobs_capacity = {} quota = await root.client.users.get_quota() org_quota = await root.client.users.get_org_quota() root.print(fmt(root.client.config, jobs_capacity, quota, org_quota))