Skip to content

Commit ea6026b

Browse files
committed
fix: move coal imports inside of csm-data commands call
this to reduce loading overload by around 2 seconds TODO : fix tests
1 parent 8e7745c commit ea6026b

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

cosmotech/csm_data/commands/api/wsf_load_file.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
from cosmotech.csm_data.utils.click import click
1010
from cosmotech.csm_data.utils.decorators import web_help, translate_help
11-
from cosmotech.coal.cosmotech_api.connection import get_api_client
12-
from cosmotech.coal.cosmotech_api.workspace import download_workspace_file
13-
from cosmotech.coal.cosmotech_api.workspace import list_workspace_files
1411
from cosmotech.orchestrator.utils.translate import T
1512

1613

@@ -53,6 +50,11 @@
5350
@web_help("csm-data/api/wsf-load-file")
5451
@translate_help("csm_data.commands.api.wsf_load_file.description")
5552
def wsf_load_file(organization_id, workspace_id, workspace_path: str, target_folder: str):
53+
54+
from cosmotech.coal.cosmotech_api.connection import get_api_client
55+
from cosmotech.coal.cosmotech_api.workspace import download_workspace_file
56+
from cosmotech.coal.cosmotech_api.workspace import list_workspace_files
57+
5658
with get_api_client()[0] as api_client:
5759
target_list = list_workspace_files(api_client, organization_id, workspace_id, workspace_path)
5860

cosmotech/csm_data/commands/api/wsf_send_file.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
from cosmotech.csm_data.utils.click import click
99
from cosmotech.csm_data.utils.decorators import web_help, translate_help
10-
from cosmotech.coal.cosmotech_api.connection import get_api_client
11-
from cosmotech.coal.cosmotech_api.workspace import upload_workspace_file
1210
from cosmotech.orchestrator.utils.translate import T
1311

1412

@@ -57,6 +55,10 @@
5755
@web_help("csm-data/api/wsf-send-file")
5856
@translate_help("csm_data.commands.api.wsf_send_file.description")
5957
def wsf_send_file(organization_id, workspace_id, file_path, workspace_path: str, overwrite: bool):
58+
59+
from cosmotech.coal.cosmotech_api.connection import get_api_client
60+
from cosmotech.coal.cosmotech_api.workspace import upload_workspace_file
61+
6062
with get_api_client()[0] as api_client:
6163
upload_workspace_file(
6264
api_client,

cosmotech/csm_data/commands/store/store.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from cosmotech.csm_data.commands.store.reset import reset
1818
from cosmotech.csm_data.utils.click import click
1919
from cosmotech.csm_data.utils.decorators import web_help, translate_help
20-
from cosmotech.orchestrator.utils.translate import T
2120

2221

2322
@click.group()

0 commit comments

Comments
 (0)