cosmotech-acceleration-library 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cosmotech/coal/__init__.py +8 -0
- cosmotech/coal/aws/__init__.py +23 -0
- cosmotech/coal/aws/s3.py +235 -0
- cosmotech/coal/azure/__init__.py +23 -0
- cosmotech/coal/azure/adx/__init__.py +26 -0
- cosmotech/coal/azure/adx/auth.py +125 -0
- cosmotech/coal/azure/adx/ingestion.py +329 -0
- cosmotech/coal/azure/adx/query.py +56 -0
- cosmotech/coal/azure/adx/runner.py +217 -0
- cosmotech/coal/azure/adx/store.py +255 -0
- cosmotech/coal/azure/adx/tables.py +118 -0
- cosmotech/coal/azure/adx/utils.py +71 -0
- cosmotech/coal/azure/blob.py +109 -0
- cosmotech/coal/azure/functions.py +72 -0
- cosmotech/coal/azure/storage.py +74 -0
- cosmotech/coal/cosmotech_api/__init__.py +36 -0
- cosmotech/coal/cosmotech_api/connection.py +96 -0
- cosmotech/coal/cosmotech_api/dataset/__init__.py +26 -0
- cosmotech/coal/cosmotech_api/dataset/converters.py +164 -0
- cosmotech/coal/cosmotech_api/dataset/download/__init__.py +19 -0
- cosmotech/coal/cosmotech_api/dataset/download/adt.py +119 -0
- cosmotech/coal/cosmotech_api/dataset/download/common.py +140 -0
- cosmotech/coal/cosmotech_api/dataset/download/file.py +216 -0
- cosmotech/coal/cosmotech_api/dataset/download/twingraph.py +188 -0
- cosmotech/coal/cosmotech_api/dataset/utils.py +132 -0
- cosmotech/coal/cosmotech_api/parameters.py +48 -0
- cosmotech/coal/cosmotech_api/run.py +25 -0
- cosmotech/coal/cosmotech_api/run_data.py +173 -0
- cosmotech/coal/cosmotech_api/run_template.py +108 -0
- cosmotech/coal/cosmotech_api/runner/__init__.py +28 -0
- cosmotech/coal/cosmotech_api/runner/data.py +38 -0
- cosmotech/coal/cosmotech_api/runner/datasets.py +364 -0
- cosmotech/coal/cosmotech_api/runner/download.py +146 -0
- cosmotech/coal/cosmotech_api/runner/metadata.py +42 -0
- cosmotech/coal/cosmotech_api/runner/parameters.py +157 -0
- cosmotech/coal/cosmotech_api/twin_data_layer.py +512 -0
- cosmotech/coal/cosmotech_api/workspace.py +127 -0
- cosmotech/coal/csm/__init__.py +6 -0
- cosmotech/coal/csm/engine/__init__.py +47 -0
- cosmotech/coal/postgresql/__init__.py +22 -0
- cosmotech/coal/postgresql/runner.py +93 -0
- cosmotech/coal/postgresql/store.py +98 -0
- cosmotech/coal/singlestore/__init__.py +17 -0
- cosmotech/coal/singlestore/store.py +100 -0
- cosmotech/coal/store/__init__.py +42 -0
- cosmotech/coal/store/csv.py +44 -0
- cosmotech/coal/store/native_python.py +25 -0
- cosmotech/coal/store/pandas.py +26 -0
- cosmotech/coal/store/pyarrow.py +23 -0
- cosmotech/coal/store/store.py +79 -0
- cosmotech/coal/utils/__init__.py +18 -0
- cosmotech/coal/utils/api.py +68 -0
- cosmotech/coal/utils/logger.py +10 -0
- cosmotech/coal/utils/postgresql.py +236 -0
- cosmotech/csm_data/__init__.py +6 -0
- cosmotech/csm_data/commands/__init__.py +6 -0
- cosmotech/csm_data/commands/adx_send_data.py +92 -0
- cosmotech/csm_data/commands/adx_send_runnerdata.py +119 -0
- cosmotech/csm_data/commands/api/__init__.py +6 -0
- cosmotech/csm_data/commands/api/api.py +50 -0
- cosmotech/csm_data/commands/api/postgres_send_runner_metadata.py +119 -0
- cosmotech/csm_data/commands/api/rds_load_csv.py +90 -0
- cosmotech/csm_data/commands/api/rds_send_csv.py +74 -0
- cosmotech/csm_data/commands/api/rds_send_store.py +74 -0
- cosmotech/csm_data/commands/api/run_load_data.py +120 -0
- cosmotech/csm_data/commands/api/runtemplate_load_handler.py +66 -0
- cosmotech/csm_data/commands/api/tdl_load_files.py +76 -0
- cosmotech/csm_data/commands/api/tdl_send_files.py +82 -0
- cosmotech/csm_data/commands/api/wsf_load_file.py +66 -0
- cosmotech/csm_data/commands/api/wsf_send_file.py +68 -0
- cosmotech/csm_data/commands/az_storage_upload.py +76 -0
- cosmotech/csm_data/commands/s3_bucket_delete.py +107 -0
- cosmotech/csm_data/commands/s3_bucket_download.py +118 -0
- cosmotech/csm_data/commands/s3_bucket_upload.py +128 -0
- cosmotech/csm_data/commands/store/__init__.py +6 -0
- cosmotech/csm_data/commands/store/dump_to_azure.py +120 -0
- cosmotech/csm_data/commands/store/dump_to_postgresql.py +107 -0
- cosmotech/csm_data/commands/store/dump_to_s3.py +169 -0
- cosmotech/csm_data/commands/store/list_tables.py +48 -0
- cosmotech/csm_data/commands/store/load_csv_folder.py +43 -0
- cosmotech/csm_data/commands/store/load_from_singlestore.py +96 -0
- cosmotech/csm_data/commands/store/reset.py +31 -0
- cosmotech/csm_data/commands/store/store.py +37 -0
- cosmotech/csm_data/main.py +57 -0
- cosmotech/csm_data/utils/__init__.py +6 -0
- cosmotech/csm_data/utils/click.py +18 -0
- cosmotech/csm_data/utils/decorators.py +75 -0
- cosmotech/orchestrator_plugins/csm-data/__init__.py +11 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/postgres_send_runner_metadata.json +40 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/rds_load_csv.json +27 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/rds_send_csv.json +27 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/rds_send_store.json +27 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/run_load_data.json +30 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/runtemplate_load_handler.json +27 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/tdl_load_files.json +32 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/tdl_send_files.json +27 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/try_api_connection.json +9 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/wsf_load_file.json +36 -0
- cosmotech/orchestrator_plugins/csm-data/templates/api/wsf_send_file.json +36 -0
- cosmotech/orchestrator_plugins/csm-data/templates/main/adx_send_runnerdata.json +29 -0
- cosmotech/orchestrator_plugins/csm-data/templates/main/az_storage_upload.json +25 -0
- cosmotech/orchestrator_plugins/csm-data/templates/main/s3_bucket_delete.json +31 -0
- cosmotech/orchestrator_plugins/csm-data/templates/main/s3_bucket_download.json +34 -0
- cosmotech/orchestrator_plugins/csm-data/templates/main/s3_bucket_upload.json +35 -0
- cosmotech/orchestrator_plugins/csm-data/templates/store/store_dump_to_azure.json +35 -0
- cosmotech/orchestrator_plugins/csm-data/templates/store/store_dump_to_postgresql.json +34 -0
- cosmotech/orchestrator_plugins/csm-data/templates/store/store_dump_to_s3.json +36 -0
- cosmotech/orchestrator_plugins/csm-data/templates/store/store_list_tables.json +15 -0
- cosmotech/orchestrator_plugins/csm-data/templates/store/store_load_csv_folder.json +18 -0
- cosmotech/orchestrator_plugins/csm-data/templates/store/store_load_from_singlestore.json +34 -0
- cosmotech/orchestrator_plugins/csm-data/templates/store/store_reset.json +15 -0
- cosmotech/translation/coal/__init__.py +6 -0
- cosmotech/translation/coal/en-US/coal/common/data_transfer.yml +6 -0
- cosmotech/translation/coal/en-US/coal/common/errors.yml +9 -0
- cosmotech/translation/coal/en-US/coal/common/file_operations.yml +6 -0
- cosmotech/translation/coal/en-US/coal/common/progress.yml +6 -0
- cosmotech/translation/coal/en-US/coal/common/timing.yml +5 -0
- cosmotech/translation/coal/en-US/coal/common/validation.yml +8 -0
- cosmotech/translation/coal/en-US/coal/cosmotech_api/connection.yml +10 -0
- cosmotech/translation/coal/en-US/coal/cosmotech_api/run_data.yml +2 -0
- cosmotech/translation/coal/en-US/coal/cosmotech_api/run_template.yml +8 -0
- cosmotech/translation/coal/en-US/coal/cosmotech_api/runner.yml +16 -0
- cosmotech/translation/coal/en-US/coal/cosmotech_api/solution.yml +5 -0
- cosmotech/translation/coal/en-US/coal/cosmotech_api/workspace.yml +7 -0
- cosmotech/translation/coal/en-US/coal/services/adx.yml +59 -0
- cosmotech/translation/coal/en-US/coal/services/api.yml +8 -0
- cosmotech/translation/coal/en-US/coal/services/azure_storage.yml +14 -0
- cosmotech/translation/coal/en-US/coal/services/database.yml +19 -0
- cosmotech/translation/coal/en-US/coal/services/dataset.yml +68 -0
- cosmotech/translation/coal/en-US/coal/services/postgresql.yml +28 -0
- cosmotech/translation/coal/en-US/coal/services/s3.yml +9 -0
- cosmotech/translation/coal/en-US/coal/solution.yml +3 -0
- cosmotech/translation/coal/en-US/coal/web.yml +2 -0
- cosmotech/translation/csm_data/__init__.py +6 -0
- cosmotech/translation/csm_data/en-US/csm-data.yml +434 -0
- cosmotech_acceleration_library-1.0.0.dist-info/METADATA +255 -0
- cosmotech_acceleration_library-1.0.0.dist-info/RECORD +141 -0
- cosmotech_acceleration_library-1.0.0.dist-info/WHEEL +5 -0
- cosmotech_acceleration_library-1.0.0.dist-info/entry_points.txt +2 -0
- cosmotech_acceleration_library-1.0.0.dist-info/licenses/LICENSE +17 -0
- cosmotech_acceleration_library-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Copyright (C) - 2023 - 2025 - Cosmo Tech
|
|
2
|
+
# This document and all information contained herein is the exclusive property -
|
|
3
|
+
# including all intellectual property rights pertaining thereto - of Cosmo Tech.
|
|
4
|
+
# Any use, reproduction, translation, broadcasting, transmission, distribution,
|
|
5
|
+
# etc., to any person is prohibited unless it has been previously and
|
|
6
|
+
# specifically authorized by written means by Cosmo Tech.
|
|
7
|
+
|
|
8
|
+
from cosmotech.csm_data.utils.click import click
|
|
9
|
+
from cosmotech.csm_data.utils.decorators import web_help, translate_help
|
|
10
|
+
from cosmotech.orchestrator.utils.translate import T
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@click.command()
|
|
14
|
+
@click.option(
|
|
15
|
+
"--api-url",
|
|
16
|
+
envvar="CSM_API_URL",
|
|
17
|
+
help=T("csm-data.commands.api.tdl_send_files.parameters.api_url"),
|
|
18
|
+
metavar="URI",
|
|
19
|
+
type=str,
|
|
20
|
+
show_envvar=True,
|
|
21
|
+
required=True,
|
|
22
|
+
)
|
|
23
|
+
@click.option(
|
|
24
|
+
"--organization-id",
|
|
25
|
+
envvar="CSM_ORGANIZATION_ID",
|
|
26
|
+
help=T("csm-data.commands.api.tdl_send_files.parameters.organization_id"),
|
|
27
|
+
metavar="o-XXXXXXXX",
|
|
28
|
+
type=str,
|
|
29
|
+
show_envvar=True,
|
|
30
|
+
required=True,
|
|
31
|
+
)
|
|
32
|
+
@click.option(
|
|
33
|
+
"--workspace-id",
|
|
34
|
+
envvar="CSM_WORKSPACE_ID",
|
|
35
|
+
help=T("csm-data.commands.api.tdl_send_files.parameters.workspace_id"),
|
|
36
|
+
metavar="w-XXXXXXXX",
|
|
37
|
+
type=str,
|
|
38
|
+
show_envvar=True,
|
|
39
|
+
required=True,
|
|
40
|
+
)
|
|
41
|
+
@click.option(
|
|
42
|
+
"--runner-id",
|
|
43
|
+
envvar="CSM_RUNNER_ID",
|
|
44
|
+
help=T("csm-data.commands.api.tdl_send_files.parameters.runner_id"),
|
|
45
|
+
metavar="r-XXXXXXXX",
|
|
46
|
+
type=str,
|
|
47
|
+
show_envvar=True,
|
|
48
|
+
required=True,
|
|
49
|
+
)
|
|
50
|
+
@click.option(
|
|
51
|
+
"--dir",
|
|
52
|
+
"directory_path",
|
|
53
|
+
help=T("csm-data.commands.api.tdl_send_files.parameters.dir"),
|
|
54
|
+
metavar="PATH",
|
|
55
|
+
default="./",
|
|
56
|
+
type=str,
|
|
57
|
+
envvar="CSM_DATASET_ABSOLUTE_PATH",
|
|
58
|
+
show_envvar=True,
|
|
59
|
+
required=True,
|
|
60
|
+
)
|
|
61
|
+
@click.option(
|
|
62
|
+
"--clear/--keep",
|
|
63
|
+
help=T("csm-data.commands.api.tdl_send_files.parameters.clear"),
|
|
64
|
+
is_flag=True,
|
|
65
|
+
default=True,
|
|
66
|
+
show_default=True,
|
|
67
|
+
type=bool,
|
|
68
|
+
)
|
|
69
|
+
@web_help("csm-data/api/tdl-send-files")
|
|
70
|
+
@translate_help("csm-data.commands.api.tdl_send_files.description")
|
|
71
|
+
def tdl_send_files(api_url, organization_id, workspace_id, runner_id, directory_path, clear: bool):
|
|
72
|
+
# Import the function at the start of the command
|
|
73
|
+
from cosmotech.coal.cosmotech_api import send_files_to_tdl
|
|
74
|
+
|
|
75
|
+
send_files_to_tdl(
|
|
76
|
+
api_url=api_url,
|
|
77
|
+
organization_id=organization_id,
|
|
78
|
+
workspace_id=workspace_id,
|
|
79
|
+
runner_id=runner_id,
|
|
80
|
+
directory_path=directory_path,
|
|
81
|
+
clear=clear,
|
|
82
|
+
)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Copyright (C) - 2023 - 2025 - Cosmo Tech
|
|
2
|
+
# This document and all information contained herein is the exclusive property -
|
|
3
|
+
# including all intellectual property rights pertaining thereto - of Cosmo Tech.
|
|
4
|
+
# Any use, reproduction, translation, broadcasting, transmission, distribution,
|
|
5
|
+
# etc., to any person is prohibited unless it has been previously and
|
|
6
|
+
# specifically authorized by written means by Cosmo Tech.
|
|
7
|
+
import pathlib
|
|
8
|
+
|
|
9
|
+
from cosmotech.csm_data.utils.click import click
|
|
10
|
+
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
|
|
14
|
+
from cosmotech.orchestrator.utils.translate import T
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@click.command()
|
|
18
|
+
@click.option(
|
|
19
|
+
"--organization-id",
|
|
20
|
+
envvar="CSM_ORGANIZATION_ID",
|
|
21
|
+
help=T("csm-data.commands.api.wsf_load_file.parameters.organization_id"),
|
|
22
|
+
metavar="o-XXXXXXXX",
|
|
23
|
+
type=str,
|
|
24
|
+
show_envvar=True,
|
|
25
|
+
required=True,
|
|
26
|
+
)
|
|
27
|
+
@click.option(
|
|
28
|
+
"--workspace-id",
|
|
29
|
+
envvar="CSM_WORKSPACE_ID",
|
|
30
|
+
help=T("csm-data.commands.api.wsf_load_file.parameters.workspace_id"),
|
|
31
|
+
metavar="w-XXXXXXXX",
|
|
32
|
+
type=str,
|
|
33
|
+
show_envvar=True,
|
|
34
|
+
required=True,
|
|
35
|
+
)
|
|
36
|
+
@click.option(
|
|
37
|
+
"--workspace-path",
|
|
38
|
+
help=T("csm-data.commands.api.wsf_load_file.parameters.workspace_path"),
|
|
39
|
+
metavar="PATH",
|
|
40
|
+
default="/",
|
|
41
|
+
type=str,
|
|
42
|
+
)
|
|
43
|
+
@click.option(
|
|
44
|
+
"--target-folder",
|
|
45
|
+
help=T("csm-data.commands.api.wsf_load_file.parameters.target_folder"),
|
|
46
|
+
metavar="PATH",
|
|
47
|
+
default="./",
|
|
48
|
+
type=str,
|
|
49
|
+
envvar="CSM_DATASET_ABSOLUTE_PATH",
|
|
50
|
+
show_envvar=True,
|
|
51
|
+
required=True,
|
|
52
|
+
)
|
|
53
|
+
@web_help("csm-data/api/wsf-load-file")
|
|
54
|
+
@translate_help("csm-data.commands.api.wsf_load_file.description")
|
|
55
|
+
def wsf_load_file(organization_id, workspace_id, workspace_path: str, target_folder: str):
|
|
56
|
+
with get_api_client()[0] as api_client:
|
|
57
|
+
target_list = list_workspace_files(api_client, organization_id, workspace_id, workspace_path)
|
|
58
|
+
|
|
59
|
+
for target in target_list:
|
|
60
|
+
download_workspace_file(
|
|
61
|
+
api_client,
|
|
62
|
+
organization_id,
|
|
63
|
+
workspace_id,
|
|
64
|
+
target,
|
|
65
|
+
pathlib.Path(target_folder),
|
|
66
|
+
)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Copyright (C) - 2023 - 2025 - Cosmo Tech
|
|
2
|
+
# This document and all information contained herein is the exclusive property -
|
|
3
|
+
# including all intellectual property rights pertaining thereto - of Cosmo Tech.
|
|
4
|
+
# Any use, reproduction, translation, broadcasting, transmission, distribution,
|
|
5
|
+
# etc., to any person is prohibited unless it has been previously and
|
|
6
|
+
# specifically authorized by written means by Cosmo Tech.
|
|
7
|
+
|
|
8
|
+
from cosmotech.csm_data.utils.click import click
|
|
9
|
+
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
|
|
12
|
+
from cosmotech.orchestrator.utils.translate import T
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@click.command()
|
|
16
|
+
@click.option(
|
|
17
|
+
"--organization-id",
|
|
18
|
+
envvar="CSM_ORGANIZATION_ID",
|
|
19
|
+
help=T("csm-data.commands.api.wsf_send_file.parameters.organization_id"),
|
|
20
|
+
metavar="o-XXXXXXXX",
|
|
21
|
+
type=str,
|
|
22
|
+
show_envvar=True,
|
|
23
|
+
required=True,
|
|
24
|
+
)
|
|
25
|
+
@click.option(
|
|
26
|
+
"--workspace-id",
|
|
27
|
+
envvar="CSM_WORKSPACE_ID",
|
|
28
|
+
help=T("csm-data.commands.api.wsf_send_file.parameters.workspace_id"),
|
|
29
|
+
metavar="w-XXXXXXXX",
|
|
30
|
+
type=str,
|
|
31
|
+
show_envvar=True,
|
|
32
|
+
required=True,
|
|
33
|
+
)
|
|
34
|
+
@click.option(
|
|
35
|
+
"--file-path",
|
|
36
|
+
help=T("csm-data.commands.api.wsf_send_file.parameters.file_path"),
|
|
37
|
+
metavar="PATH",
|
|
38
|
+
type=str,
|
|
39
|
+
required=True,
|
|
40
|
+
)
|
|
41
|
+
@click.option(
|
|
42
|
+
"--workspace-path",
|
|
43
|
+
help=T("csm-data.commands.api.wsf_send_file.parameters.workspace_path"),
|
|
44
|
+
metavar="PATH",
|
|
45
|
+
default="/",
|
|
46
|
+
type=str,
|
|
47
|
+
required=True,
|
|
48
|
+
)
|
|
49
|
+
@click.option(
|
|
50
|
+
"--overwrite/--keep",
|
|
51
|
+
help=T("csm-data.commands.api.wsf_send_file.parameters.overwrite"),
|
|
52
|
+
is_flag=True,
|
|
53
|
+
default=True,
|
|
54
|
+
show_default=True,
|
|
55
|
+
type=bool,
|
|
56
|
+
)
|
|
57
|
+
@web_help("csm-data/api/wsf-send-file")
|
|
58
|
+
@translate_help("csm-data.commands.api.wsf_send_file.description")
|
|
59
|
+
def wsf_send_file(organization_id, workspace_id, file_path, workspace_path: str, overwrite: bool):
|
|
60
|
+
with get_api_client()[0] as api_client:
|
|
61
|
+
upload_workspace_file(
|
|
62
|
+
api_client,
|
|
63
|
+
organization_id,
|
|
64
|
+
workspace_id,
|
|
65
|
+
file_path,
|
|
66
|
+
workspace_path,
|
|
67
|
+
overwrite,
|
|
68
|
+
)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Copyright (C) - 2023 - 2025 - Cosmo Tech
|
|
2
|
+
# This document and all information contained herein is the exclusive property -
|
|
3
|
+
# including all intellectual property rights pertaining thereto - of Cosmo Tech.
|
|
4
|
+
# Any use, reproduction, translation, broadcasting, transmission, distribution,
|
|
5
|
+
# etc., to any person is prohibited unless it has been previously and
|
|
6
|
+
# specifically authorized by written means by Cosmo Tech.
|
|
7
|
+
|
|
8
|
+
from cosmotech.csm_data.utils.click import click
|
|
9
|
+
from cosmotech.csm_data.utils.decorators import web_help, translate_help
|
|
10
|
+
from cosmotech.orchestrator.utils.translate import T
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@click.command()
|
|
14
|
+
@click.option(
|
|
15
|
+
"--source-folder",
|
|
16
|
+
envvar="CSM_DATASET_ABSOLUTE_PATH",
|
|
17
|
+
help=T("csm-data.commands.storage.az_storage_upload.parameters.source_folder"),
|
|
18
|
+
metavar="PATH",
|
|
19
|
+
type=str,
|
|
20
|
+
show_envvar=True,
|
|
21
|
+
required=True,
|
|
22
|
+
)
|
|
23
|
+
@click.option(
|
|
24
|
+
"--recursive/--no-recursive",
|
|
25
|
+
default=False,
|
|
26
|
+
help=T("csm-data.commands.storage.az_storage_upload.parameters.recursive"),
|
|
27
|
+
type=bool,
|
|
28
|
+
is_flag=True,
|
|
29
|
+
)
|
|
30
|
+
@click.option(
|
|
31
|
+
"--blob-name",
|
|
32
|
+
envvar="AZURE_STORAGE_BLOB_NAME",
|
|
33
|
+
help=T("csm-data.commands.storage.az_storage_upload.parameters.blob_name"),
|
|
34
|
+
metavar="BUCKET",
|
|
35
|
+
type=str,
|
|
36
|
+
show_envvar=True,
|
|
37
|
+
required=True,
|
|
38
|
+
)
|
|
39
|
+
@click.option(
|
|
40
|
+
"--prefix",
|
|
41
|
+
"file_prefix",
|
|
42
|
+
envvar="CSM_DATA_BLOB_PREFIX",
|
|
43
|
+
help=T("csm-data.commands.storage.az_storage_upload.parameters.prefix"),
|
|
44
|
+
metavar="PREFIX",
|
|
45
|
+
type=str,
|
|
46
|
+
show_envvar=True,
|
|
47
|
+
default="",
|
|
48
|
+
)
|
|
49
|
+
@click.option(
|
|
50
|
+
"--az-storage-sas-url",
|
|
51
|
+
help=T("csm-data.commands.storage.az_storage_upload.parameters.az_storage_sas_url"),
|
|
52
|
+
type=str,
|
|
53
|
+
show_envvar=True,
|
|
54
|
+
metavar="URL",
|
|
55
|
+
envvar="AZURE_STORAGE_SAS_URL",
|
|
56
|
+
)
|
|
57
|
+
@web_help("csm-data/az-storage-upload")
|
|
58
|
+
@translate_help("csm-data.commands.storage.az_storage_upload.description")
|
|
59
|
+
def az_storage_upload(
|
|
60
|
+
source_folder,
|
|
61
|
+
blob_name: str,
|
|
62
|
+
az_storage_sas_url: str,
|
|
63
|
+
file_prefix: str = "",
|
|
64
|
+
recursive: bool = False,
|
|
65
|
+
):
|
|
66
|
+
# Import the function at the start of the command
|
|
67
|
+
from cosmotech.coal.azure.storage import upload_folder
|
|
68
|
+
|
|
69
|
+
# Upload files to Azure Blob Storage
|
|
70
|
+
upload_folder(
|
|
71
|
+
source_folder=source_folder,
|
|
72
|
+
blob_name=blob_name,
|
|
73
|
+
az_storage_sas_url=az_storage_sas_url,
|
|
74
|
+
file_prefix=file_prefix,
|
|
75
|
+
recursive=recursive,
|
|
76
|
+
)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Copyright (C) - 2023 - 2025 - Cosmo Tech
|
|
2
|
+
# This document and all information contained herein is the exclusive property -
|
|
3
|
+
# including all intellectual property rights pertaining thereto - of Cosmo Tech.
|
|
4
|
+
# Any use, reproduction, translation, broadcasting, transmission, distribution,
|
|
5
|
+
# etc., to any person is prohibited unless it has been previously and
|
|
6
|
+
# specifically authorized by written means by Cosmo Tech.
|
|
7
|
+
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
from cosmotech.csm_data.utils.click import click
|
|
11
|
+
from cosmotech.csm_data.utils.decorators import web_help, translate_help
|
|
12
|
+
from cosmotech.orchestrator.utils.translate import T
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@click.command()
|
|
16
|
+
@click.option(
|
|
17
|
+
"--bucket-name",
|
|
18
|
+
envvar="CSM_DATA_BUCKET_NAME",
|
|
19
|
+
help=T("csm-data.commands.storage.s3_bucket_delete.parameters.bucket_name"),
|
|
20
|
+
metavar="BUCKET",
|
|
21
|
+
type=str,
|
|
22
|
+
show_envvar=True,
|
|
23
|
+
required=True,
|
|
24
|
+
)
|
|
25
|
+
@click.option(
|
|
26
|
+
"--prefix-filter",
|
|
27
|
+
"file_prefix",
|
|
28
|
+
envvar="CSM_DATA_BUCKET_PREFIX",
|
|
29
|
+
help=T("csm-data.commands.storage.s3_bucket_delete.parameters.prefix_filter"),
|
|
30
|
+
metavar="PREFIX",
|
|
31
|
+
type=str,
|
|
32
|
+
show_envvar=True,
|
|
33
|
+
)
|
|
34
|
+
@click.option(
|
|
35
|
+
"--use-ssl/--no-ssl",
|
|
36
|
+
default=True,
|
|
37
|
+
help=T("csm-data.commands.storage.s3_bucket_delete.parameters.use_ssl"),
|
|
38
|
+
type=bool,
|
|
39
|
+
is_flag=True,
|
|
40
|
+
)
|
|
41
|
+
@click.option(
|
|
42
|
+
"--s3-url",
|
|
43
|
+
"endpoint_url",
|
|
44
|
+
help=T("csm-data.commands.storage.s3_bucket_delete.parameters.s3_url"),
|
|
45
|
+
type=str,
|
|
46
|
+
required=True,
|
|
47
|
+
show_envvar=True,
|
|
48
|
+
metavar="URL",
|
|
49
|
+
envvar="AWS_ENDPOINT_URL",
|
|
50
|
+
)
|
|
51
|
+
@click.option(
|
|
52
|
+
"--access-id",
|
|
53
|
+
"access_id",
|
|
54
|
+
help=T("csm-data.commands.storage.s3_bucket_delete.parameters.access_id"),
|
|
55
|
+
type=str,
|
|
56
|
+
required=True,
|
|
57
|
+
show_envvar=True,
|
|
58
|
+
metavar="ID",
|
|
59
|
+
envvar="AWS_ACCESS_KEY_ID",
|
|
60
|
+
)
|
|
61
|
+
@click.option(
|
|
62
|
+
"--secret-key",
|
|
63
|
+
"secret_key",
|
|
64
|
+
help=T("csm-data.commands.storage.s3_bucket_delete.parameters.secret_key"),
|
|
65
|
+
type=str,
|
|
66
|
+
required=True,
|
|
67
|
+
show_envvar=True,
|
|
68
|
+
metavar="ID",
|
|
69
|
+
envvar="AWS_SECRET_ACCESS_KEY",
|
|
70
|
+
)
|
|
71
|
+
@click.option(
|
|
72
|
+
"--ssl-cert-bundle",
|
|
73
|
+
help=T("csm-data.commands.storage.s3_bucket_delete.parameters.ssl_cert_bundle"),
|
|
74
|
+
type=str,
|
|
75
|
+
show_envvar=True,
|
|
76
|
+
metavar="PATH",
|
|
77
|
+
envvar="CSM_S3_CA_BUNDLE",
|
|
78
|
+
)
|
|
79
|
+
@web_help("csm-data/s3-bucket-delete")
|
|
80
|
+
@translate_help("csm-data.commands.storage.s3_bucket_delete.description")
|
|
81
|
+
def s3_bucket_delete(
|
|
82
|
+
bucket_name: str,
|
|
83
|
+
file_prefix: str,
|
|
84
|
+
endpoint_url: str,
|
|
85
|
+
access_id: str,
|
|
86
|
+
secret_key: str,
|
|
87
|
+
use_ssl: bool = True,
|
|
88
|
+
ssl_cert_bundle: Optional[str] = None,
|
|
89
|
+
):
|
|
90
|
+
# Import the functions at the start of the command
|
|
91
|
+
from cosmotech.coal.aws.s3 import create_s3_resource, delete_objects
|
|
92
|
+
|
|
93
|
+
# Create S3 resource
|
|
94
|
+
s3_resource = create_s3_resource(
|
|
95
|
+
endpoint_url=endpoint_url,
|
|
96
|
+
access_id=access_id,
|
|
97
|
+
secret_key=secret_key,
|
|
98
|
+
use_ssl=use_ssl,
|
|
99
|
+
ssl_cert_bundle=ssl_cert_bundle,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
# Delete objects
|
|
103
|
+
delete_objects(
|
|
104
|
+
bucket_name=bucket_name,
|
|
105
|
+
s3_resource=s3_resource,
|
|
106
|
+
file_prefix=file_prefix,
|
|
107
|
+
)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Copyright (C) - 2023 - 2025 - Cosmo Tech
|
|
2
|
+
# This document and all information contained herein is the exclusive property -
|
|
3
|
+
# including all intellectual property rights pertaining thereto - of Cosmo Tech.
|
|
4
|
+
# Any use, reproduction, translation, broadcasting, transmission, distribution,
|
|
5
|
+
# etc., to any person is prohibited unless it has been previously and
|
|
6
|
+
# specifically authorized by written means by Cosmo Tech.
|
|
7
|
+
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
from cosmotech.csm_data.utils.click import click
|
|
11
|
+
from cosmotech.csm_data.utils.decorators import web_help, translate_help
|
|
12
|
+
from cosmotech.orchestrator.utils.translate import T
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@click.command()
|
|
16
|
+
@click.option(
|
|
17
|
+
"--target-folder",
|
|
18
|
+
envvar="CSM_DATASET_ABSOLUTE_PATH",
|
|
19
|
+
help=T("csm-data.commands.storage.s3_bucket_download.parameters.target_folder"),
|
|
20
|
+
metavar="PATH",
|
|
21
|
+
type=str,
|
|
22
|
+
show_envvar=True,
|
|
23
|
+
required=True,
|
|
24
|
+
)
|
|
25
|
+
@click.option(
|
|
26
|
+
"--bucket-name",
|
|
27
|
+
envvar="CSM_DATA_BUCKET_NAME",
|
|
28
|
+
help=T("csm-data.commands.storage.s3_bucket_download.parameters.bucket_name"),
|
|
29
|
+
metavar="BUCKET",
|
|
30
|
+
type=str,
|
|
31
|
+
show_envvar=True,
|
|
32
|
+
required=True,
|
|
33
|
+
)
|
|
34
|
+
@click.option(
|
|
35
|
+
"--prefix-filter",
|
|
36
|
+
"file_prefix",
|
|
37
|
+
envvar="CSM_DATA_BUCKET_PREFIX",
|
|
38
|
+
help=T("csm-data.commands.storage.s3_bucket_download.parameters.prefix_filter"),
|
|
39
|
+
metavar="PREFIX",
|
|
40
|
+
type=str,
|
|
41
|
+
show_envvar=True,
|
|
42
|
+
)
|
|
43
|
+
@click.option(
|
|
44
|
+
"--use-ssl/--no-ssl",
|
|
45
|
+
default=True,
|
|
46
|
+
help=T("csm-data.commands.storage.s3_bucket_download.parameters.use_ssl"),
|
|
47
|
+
type=bool,
|
|
48
|
+
is_flag=True,
|
|
49
|
+
)
|
|
50
|
+
@click.option(
|
|
51
|
+
"--s3-url",
|
|
52
|
+
"endpoint_url",
|
|
53
|
+
help=T("csm-data.commands.storage.s3_bucket_download.parameters.s3_url"),
|
|
54
|
+
type=str,
|
|
55
|
+
required=True,
|
|
56
|
+
show_envvar=True,
|
|
57
|
+
metavar="URL",
|
|
58
|
+
envvar="AWS_ENDPOINT_URL",
|
|
59
|
+
)
|
|
60
|
+
@click.option(
|
|
61
|
+
"--access-id",
|
|
62
|
+
"access_id",
|
|
63
|
+
help=T("csm-data.commands.storage.s3_bucket_download.parameters.access_id"),
|
|
64
|
+
type=str,
|
|
65
|
+
required=True,
|
|
66
|
+
show_envvar=True,
|
|
67
|
+
metavar="ID",
|
|
68
|
+
envvar="AWS_ACCESS_KEY_ID",
|
|
69
|
+
)
|
|
70
|
+
@click.option(
|
|
71
|
+
"--secret-key",
|
|
72
|
+
"secret_key",
|
|
73
|
+
help=T("csm-data.commands.storage.s3_bucket_download.parameters.secret_key"),
|
|
74
|
+
type=str,
|
|
75
|
+
required=True,
|
|
76
|
+
show_envvar=True,
|
|
77
|
+
metavar="ID",
|
|
78
|
+
envvar="AWS_SECRET_ACCESS_KEY",
|
|
79
|
+
)
|
|
80
|
+
@click.option(
|
|
81
|
+
"--ssl-cert-bundle",
|
|
82
|
+
help=T("csm-data.commands.storage.s3_bucket_download.parameters.ssl_cert_bundle"),
|
|
83
|
+
type=str,
|
|
84
|
+
show_envvar=True,
|
|
85
|
+
metavar="PATH",
|
|
86
|
+
envvar="CSM_S3_CA_BUNDLE",
|
|
87
|
+
)
|
|
88
|
+
@web_help("csm-data/s3-bucket-download")
|
|
89
|
+
@translate_help("csm-data.commands.storage.s3_bucket_download.description")
|
|
90
|
+
def s3_bucket_download(
|
|
91
|
+
target_folder: str,
|
|
92
|
+
bucket_name: str,
|
|
93
|
+
file_prefix: str,
|
|
94
|
+
endpoint_url: str,
|
|
95
|
+
access_id: str,
|
|
96
|
+
secret_key: str,
|
|
97
|
+
use_ssl: bool = True,
|
|
98
|
+
ssl_cert_bundle: Optional[str] = None,
|
|
99
|
+
):
|
|
100
|
+
# Import the functions at the start of the command
|
|
101
|
+
from cosmotech.coal.aws.s3 import create_s3_resource, download_files
|
|
102
|
+
|
|
103
|
+
# Create S3 resource
|
|
104
|
+
s3_resource = create_s3_resource(
|
|
105
|
+
endpoint_url=endpoint_url,
|
|
106
|
+
access_id=access_id,
|
|
107
|
+
secret_key=secret_key,
|
|
108
|
+
use_ssl=use_ssl,
|
|
109
|
+
ssl_cert_bundle=ssl_cert_bundle,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Download files
|
|
113
|
+
download_files(
|
|
114
|
+
target_folder=target_folder,
|
|
115
|
+
bucket_name=bucket_name,
|
|
116
|
+
s3_resource=s3_resource,
|
|
117
|
+
file_prefix=file_prefix,
|
|
118
|
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Copyright (C) - 2023 - 2025 - Cosmo Tech
|
|
2
|
+
# This document and all information contained herein is the exclusive property -
|
|
3
|
+
# including all intellectual property rights pertaining thereto - of Cosmo Tech.
|
|
4
|
+
# Any use, reproduction, translation, broadcasting, transmission, distribution,
|
|
5
|
+
# etc., to any person is prohibited unless it has been previously and
|
|
6
|
+
# specifically authorized by written means by Cosmo Tech.
|
|
7
|
+
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
from cosmotech.csm_data.utils.click import click
|
|
11
|
+
from cosmotech.csm_data.utils.decorators import web_help, translate_help
|
|
12
|
+
from cosmotech.orchestrator.utils.translate import T
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@click.command()
|
|
16
|
+
@click.option(
|
|
17
|
+
"--source-folder",
|
|
18
|
+
envvar="CSM_DATASET_ABSOLUTE_PATH",
|
|
19
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.source_folder"),
|
|
20
|
+
metavar="PATH",
|
|
21
|
+
type=str,
|
|
22
|
+
show_envvar=True,
|
|
23
|
+
required=True,
|
|
24
|
+
)
|
|
25
|
+
@click.option(
|
|
26
|
+
"--recursive/--no-recursive",
|
|
27
|
+
default=False,
|
|
28
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.recursive"),
|
|
29
|
+
type=bool,
|
|
30
|
+
is_flag=True,
|
|
31
|
+
)
|
|
32
|
+
@click.option(
|
|
33
|
+
"--bucket-name",
|
|
34
|
+
envvar="CSM_DATA_BUCKET_NAME",
|
|
35
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.bucket_name"),
|
|
36
|
+
metavar="BUCKET",
|
|
37
|
+
type=str,
|
|
38
|
+
show_envvar=True,
|
|
39
|
+
required=True,
|
|
40
|
+
)
|
|
41
|
+
@click.option(
|
|
42
|
+
"--prefix",
|
|
43
|
+
"file_prefix",
|
|
44
|
+
envvar="CSM_DATA_BUCKET_PREFIX",
|
|
45
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.prefix"),
|
|
46
|
+
metavar="PREFIX",
|
|
47
|
+
type=str,
|
|
48
|
+
show_envvar=True,
|
|
49
|
+
default="",
|
|
50
|
+
)
|
|
51
|
+
@click.option(
|
|
52
|
+
"--use-ssl/--no-ssl",
|
|
53
|
+
default=True,
|
|
54
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.use_ssl"),
|
|
55
|
+
type=bool,
|
|
56
|
+
is_flag=True,
|
|
57
|
+
)
|
|
58
|
+
@click.option(
|
|
59
|
+
"--s3-url",
|
|
60
|
+
"endpoint_url",
|
|
61
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.s3_url"),
|
|
62
|
+
type=str,
|
|
63
|
+
required=True,
|
|
64
|
+
show_envvar=True,
|
|
65
|
+
metavar="URL",
|
|
66
|
+
envvar="AWS_ENDPOINT_URL",
|
|
67
|
+
)
|
|
68
|
+
@click.option(
|
|
69
|
+
"--access-id",
|
|
70
|
+
"access_id",
|
|
71
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.access_id"),
|
|
72
|
+
type=str,
|
|
73
|
+
required=True,
|
|
74
|
+
show_envvar=True,
|
|
75
|
+
metavar="ID",
|
|
76
|
+
envvar="AWS_ACCESS_KEY_ID",
|
|
77
|
+
)
|
|
78
|
+
@click.option(
|
|
79
|
+
"--secret-key",
|
|
80
|
+
"secret_key",
|
|
81
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.secret_key"),
|
|
82
|
+
type=str,
|
|
83
|
+
required=True,
|
|
84
|
+
show_envvar=True,
|
|
85
|
+
metavar="ID",
|
|
86
|
+
envvar="AWS_SECRET_ACCESS_KEY",
|
|
87
|
+
)
|
|
88
|
+
@click.option(
|
|
89
|
+
"--ssl-cert-bundle",
|
|
90
|
+
help=T("csm-data.commands.storage.s3_bucket_upload.parameters.ssl_cert_bundle"),
|
|
91
|
+
type=str,
|
|
92
|
+
show_envvar=True,
|
|
93
|
+
metavar="PATH",
|
|
94
|
+
envvar="CSM_S3_CA_BUNDLE",
|
|
95
|
+
)
|
|
96
|
+
@web_help("csm-data/s3-bucket-upload")
|
|
97
|
+
@translate_help("csm-data.commands.storage.s3_bucket_upload.description")
|
|
98
|
+
def s3_bucket_upload(
|
|
99
|
+
source_folder,
|
|
100
|
+
bucket_name: str,
|
|
101
|
+
endpoint_url: str,
|
|
102
|
+
access_id: str,
|
|
103
|
+
secret_key: str,
|
|
104
|
+
file_prefix: str = "",
|
|
105
|
+
use_ssl: bool = True,
|
|
106
|
+
ssl_cert_bundle: Optional[str] = None,
|
|
107
|
+
recursive: bool = False,
|
|
108
|
+
):
|
|
109
|
+
# Import the functions at the start of the command
|
|
110
|
+
from cosmotech.coal.aws.s3 import create_s3_resource, upload_folder
|
|
111
|
+
|
|
112
|
+
# Create S3 resource
|
|
113
|
+
s3_resource = create_s3_resource(
|
|
114
|
+
endpoint_url=endpoint_url,
|
|
115
|
+
access_id=access_id,
|
|
116
|
+
secret_key=secret_key,
|
|
117
|
+
use_ssl=use_ssl,
|
|
118
|
+
ssl_cert_bundle=ssl_cert_bundle,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# Upload files
|
|
122
|
+
upload_folder(
|
|
123
|
+
source_folder=source_folder,
|
|
124
|
+
bucket_name=bucket_name,
|
|
125
|
+
s3_resource=s3_resource,
|
|
126
|
+
file_prefix=file_prefix,
|
|
127
|
+
recursive=recursive,
|
|
128
|
+
)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Copyright (C) - 2023 - 2025 - Cosmo Tech
|
|
2
|
+
# This document and all information contained herein is the exclusive property -
|
|
3
|
+
# including all intellectual property rights pertaining thereto - of Cosmo Tech.
|
|
4
|
+
# Any use, reproduction, translation, broadcasting, transmission, distribution,
|
|
5
|
+
# etc., to any person is prohibited unless it has been previously and
|
|
6
|
+
# specifically authorized by written means by Cosmo Tech.
|