Skip to content

Commit e03e5ff

Browse files
committed
Add remaining translations
1 parent e39e2b9 commit e03e5ff

File tree

13 files changed

+57
-34
lines changed

13 files changed

+57
-34
lines changed

cosmotech/coal/azure/adx/runner.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def insert_csv_files(
136136
report_level=ReportLevel.FailuresAndSuccesses,
137137
additional_properties={"ignoreFirstRecord": "true"},
138138
)
139-
LOGGER.info(T("coal.logs.ingestion.ingesting").format(table=filename))
139+
LOGGER.info(T("coal.services.adx.ingesting").format(table=filename))
140140
results: IngestionResult = ingest_client.ingest_from_file(fd, ingestion_properties)
141141
ingestion_ids[str(results.source_id)] = filename
142142
if wait:
@@ -149,14 +149,14 @@ def insert_csv_files(
149149
):
150150
count += 1
151151
if count > wait_limit:
152-
LOGGER.warning(T("coal.logs.ingestion.max_retry"))
152+
LOGGER.warning(T("coal.services.adx.max_retry"))
153153
break
154154
LOGGER.info(
155-
T("coal.logs.ingestion.waiting_results").format(duration=wait_duration, count=count, limit=wait_limit)
155+
T("coal.services.adx.waiting_results").format(duration=wait_duration, count=count, limit=wait_limit)
156156
)
157157
time.sleep(wait_duration)
158158

159-
LOGGER.info(T("coal.logs.ingestion.status"))
159+
LOGGER.info(T("coal.services.adx.status"))
160160
for _id, status in check_ingestion_status(ingest_client, source_ids=list(ingestion_ids.keys())):
161161
color = (
162162
"red"
@@ -166,10 +166,10 @@ def insert_csv_files(
166166
else "bright_black"
167167
)
168168
LOGGER.info(
169-
T("coal.logs.ingestion.status_report").format(table=ingestion_ids[_id], status=status.name, color=color)
169+
T("coal.services.adx.status_report").format(table=ingestion_ids[_id], status=status.name, color=color)
170170
)
171171
else:
172-
LOGGER.info(T("coal.logs.ingestion.no_wait"))
172+
LOGGER.info(T("coal.services.adx.no_wait"))
173173

174174

175175
def send_runner_data(
@@ -205,13 +205,13 @@ def send_runner_data(
205205
queries = construct_create_query(csv_data)
206206
kusto_client, ingest_client = initialize_clients(adx_uri, adx_ingest_uri)
207207
for k, v in queries.items():
208-
LOGGER.info(T("coal.logs.ingestion.creating_table").format(query=v))
208+
LOGGER.info(T("coal.services.adx.creating_table").format(table_name=k, database=database_name))
209209
r: KustoResponseDataSet = run_query(kusto_client, database_name, v)
210210
if r.errors_count == 0:
211-
LOGGER.info(T("coal.logs.ingestion.table_created").format(table=k))
211+
LOGGER.info(T("coal.services.adx.table_created").format(table_name=k))
212212
else:
213-
LOGGER.error(T("coal.logs.ingestion.table_creation_failed").format(table=k))
214-
LOGGER.error(T("coal.logs.ingestion.exceptions").format(exceptions=r.get_exceptions()))
213+
LOGGER.error(T("coal.services.adx.table_creation_failed").format(table_name=k, database=database_name))
214+
LOGGER.error(T("coal.services.adx.exceptions").format(exceptions=r.get_exceptions()))
215215
raise RuntimeError(f"Failed to create table {k}")
216216
insert_csv_files(
217217
files_data=csv_data,

cosmotech/coal/cosmotech_api/run_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def send_csv_to_run_data(
5656
with open(csv_path) as _f:
5757
dr = DictReader(_f)
5858
table_name = csv_path.name.replace(".csv", "")
59-
LOGGER.info(T("coal.logs.run_data.sending_to_table").format(table_name=f"CD_{table_name}"))
59+
LOGGER.info(T("coal.cosmotech_api.run_data.sending_to_table").format(table_name=f"CD_{table_name}"))
6060
LOGGER.debug(T("coal.services.database.column_list").format(columns=dr.fieldnames))
6161
data = []
6262

@@ -109,7 +109,7 @@ def send_store_to_run_data(
109109
api_run = RunApi(api_client)
110110
_s = Store()
111111
for table_name in _s.list_tables():
112-
LOGGER.info(T("coal.logs.run_data.sending_to_table").format(table_name=f"CD_{table_name}"))
112+
LOGGER.info(T("coal.cosmotech_api.run_data.sending_to_table").format(table_name=f"CD_{table_name}"))
113113
data = convert_table_as_pylist(table_name)
114114
if not len(data):
115115
LOGGER.info(T("coal.services.database.no_rows"))

cosmotech/coal/cosmotech_api/run_template.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def load_run_template_handlers(
5151
with get_api_client()[0] as api_client:
5252
api_w = WorkspaceApi(api_client)
5353

54-
LOGGER.info(T("coal.logs.orchestrator.loading_solution"))
54+
LOGGER.info(T("coal.cosmotech_api.run_template.loading_solution"))
5555
try:
5656
r_data: Workspace = api_w.find_workspace_by_id(organization_id=organization_id, workspace_id=workspace_id)
5757
except ServiceException as e:
@@ -60,7 +60,7 @@ def load_run_template_handlers(
6060
workspace_id=workspace_id, organization_id=organization_id
6161
)
6262
)
63-
LOGGER.debug(T("coal.logs.orchestrator.error_details").format(details=e.body))
63+
LOGGER.debug(T("coal.cosmotech_api.run_template.error_details").format(details=e.body))
6464
raise ValueError(f"Workspace {workspace_id} not found in organization {organization_id}")
6565
solution_id = r_data.solution.solution_id
6666

@@ -71,7 +71,9 @@ def load_run_template_handlers(
7171
for handler_id in handler_list.split(","):
7272
handler_path: pathlib.Path = template_path / handler_id
7373
LOGGER.info(
74-
T("coal.logs.orchestrator.querying_handler").format(handler=handler_id, template=run_template_id)
74+
T("coal.cosmotech_api.run_template.querying_handler").format(
75+
handler=handler_id, template=run_template_id
76+
)
7577
)
7678
try:
7779
rt_data = api_sol.download_run_template_handler(
@@ -82,25 +84,25 @@ def load_run_template_handlers(
8284
)
8385
except ServiceException as e:
8486
LOGGER.error(
85-
T("coal.logs.orchestrator.handler_not_found").format(
87+
T("coal.cosmotech_api.run_template.handler_not_found").format(
8688
handler=handler_id,
8789
template=run_template_id,
8890
solution=solution_id,
8991
)
9092
)
91-
LOGGER.debug(T("coal.logs.orchestrator.error_details").format(details=e.body))
93+
LOGGER.debug(T("coal.cosmotech_api.run_template.error_details").format(details=e.body))
9294
has_errors = True
9395
continue
94-
LOGGER.info(T("coal.logs.orchestrator.extracting_handler").format(path=handler_path.absolute()))
96+
LOGGER.info(T("coal.cosmotech_api.run_template.extracting_handler").format(path=handler_path.absolute()))
9597
handler_path.mkdir(parents=True, exist_ok=True)
9698

9799
try:
98100
with ZipFile(BytesIO(rt_data)) as _zip:
99101
_zip.extractall(handler_path)
100102
except BadZipfile:
101-
LOGGER.error(T("coal.logs.orchestrator.handler_not_zip").format(handler=handler_id))
103+
LOGGER.error(T("coal.cosmotech_api.run_template.handler_not_zip").format(handler=handler_id))
102104
has_errors = True
103105
if has_errors:
104-
LOGGER.error(T("coal.logs.orchestrator.run_issues"))
106+
LOGGER.error(T("coal.cosmotech_api.run_template.run_issues"))
105107
return False
106108
return True

cosmotech/coal/cosmotech_api/workspace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ def list_workspace_files(
3636

3737
if not target_list:
3838
LOGGER.error(
39-
T("coal.errors.data.no_workspace_files").format(file_prefix=file_prefix, workspace_id=workspace_id)
39+
T("coal.common.errors.data_no_workspace_files").format(file_prefix=file_prefix, workspace_id=workspace_id)
4040
)
4141
raise ValueError(
42-
T("coal.errors.data.no_workspace_files").format(file_prefix=file_prefix, workspace_id=workspace_id)
42+
T("coal.common.errors.data_no_workspace_files").format(file_prefix=file_prefix, workspace_id=workspace_id)
4343
)
4444

4545
return target_list

cosmotech/csm_data/commands/api/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def api(ctx: click.Context):
3333
if ctx.invoked_subcommand is None:
3434
try:
3535
api_client, description = get_api_client()
36-
LOGGER.info(T("coal.logs.connection.found_valid").format(type=description))
36+
LOGGER.info(T("coal.cosmotech_api.connection.found_valid").format(type=description))
3737
except EnvironmentError:
3838
raise click.Abort()
3939

cosmotech/csm_data/commands/store/dump_to_s3.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def dump_to_s3(
122122
_s = Store(store_location=store_folder)
123123

124124
if output_type not in VALID_TYPES:
125-
LOGGER.error(T("coal.errors.data.invalid_output_type").format(output_type=output_type))
126-
raise ValueError(T("coal.errors.data.invalid_output_type").format(output_type=output_type))
125+
LOGGER.error(T("coal.common.errors.data_invalid_output_type").format(output_type=output_type))
126+
raise ValueError(T("coal.common.errors.data_invalid_output_type").format(output_type=output_type))
127127

128128
# Create S3 client
129129
s3_client = create_s3_client(
@@ -139,7 +139,7 @@ def dump_to_s3(
139139
_file_name = "db.sqlite"
140140
_uploaded_file_name = file_prefix + _file_name
141141
LOGGER.info(
142-
T("coal.logs.data_transfer.file_sent").format(file_path=_file_path, uploaded_name=_uploaded_file_name)
142+
T("coal.common.data_transfer.file_sent").format(file_path=_file_path, uploaded_name=_uploaded_file_name)
143143
)
144144
s3_client.upload_file(_file_path, bucket_name, _uploaded_file_name)
145145
else:
@@ -149,7 +149,7 @@ def dump_to_s3(
149149
_file_name = None
150150
_data = _s.get_table(table_name)
151151
if not len(_data):
152-
LOGGER.info(T("coal.logs.data_transfer.table_empty").format(table_name=table_name))
152+
LOGGER.info(T("coal.common.data_transfer.table_empty").format(table_name=table_name))
153153
continue
154154
if output_type == "csv":
155155
_file_name = table_name + ".csv"
@@ -158,7 +158,7 @@ def dump_to_s3(
158158
_file_name = table_name + ".parquet"
159159
pq.write_table(_data, _data_stream)
160160
LOGGER.info(
161-
T("coal.logs.data_transfer.sending_table").format(table_name=table_name, output_type=output_type)
161+
T("coal.common.data_transfer.sending_table").format(table_name=table_name, output_type=output_type)
162162
)
163163
upload_data_stream(
164164
data_stream=_data_stream,

cosmotech/csm_data/commands/store/list_tables.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ def list_tables(store_folder, schema):
3737
_s = Store(store_location=store_folder)
3838
tables = list(_s.list_tables())
3939
if len(tables):
40-
LOGGER.info(T("coal.logs.database.store_tables"))
40+
LOGGER.info(T("coal.services.database.store_tables"))
4141
for table_name in tables:
42-
LOGGER.info(T("coal.logs.database.table_entry").format(table=table_name))
42+
LOGGER.info(T("coal.services.database.table_entry").format(table=table_name))
4343
if schema:
44-
LOGGER.info(T("coal.logs.database.table_schema").format(schema=str(_s.get_table_schema(table_name))))
44+
LOGGER.info(
45+
T("coal.services.database.table_schema").format(schema=str(_s.get_table_schema(table_name)))
46+
)
4547
else:
46-
LOGGER.info(T("coal.logs.database.store_empty"))
48+
LOGGER.info(T("coal.services.database.store_empty"))

cosmotech/csm_data/commands/store/load_csv_folder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ def load_csv_folder(store_folder, csv_folder):
3939
from cosmotech.coal.utils.logger import LOGGER
4040

4141
for csv_path in pathlib.Path(csv_folder).glob("*.csv"):
42-
LOGGER.info(T("coal.logs.storage.found_file").format(file=csv_path.name))
42+
LOGGER.info(T("coal.services.azure_storage.found_file").format(file=csv_path.name))
4343
store_csv_file(csv_path.name[:-4], csv_path, store=Store(False, store_folder))

cosmotech/csm_data/commands/store/reset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ def reset(store_folder):
2828
from cosmotech.coal.utils.logger import LOGGER
2929

3030
Store(True, store_folder)
31-
LOGGER.info(T("coal.logs.database.store_reset").format(folder=store_folder))
31+
LOGGER.info(T("coal.services.database.store_reset").format(folder=store_folder))

cosmotech/translation/coal/en-US/coal/common/errors.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ no_valid_connection: "No valid connection configuration found"
55
no_credentials: "No credentials available for connection"
66
operation_failed: "Operation '{operation}' failed: {error}"
77
unexpected_error: "Unexpected error: {error}"
8+
data_invalid_output_type: "Invalid output type: {output_type}"
9+
data_no_workspace_files: "No workspace files found with prefix {file_prefix} in workspace {workspace_id}"

0 commit comments

Comments
 (0)