Skip to content

Commit 3cd1bb0

Browse files
committed
Fix client request error checks
1 parent 13a7b29 commit 3cd1bb0

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

tools/python/liveanalytics_influxdb3_migration_plugin/liveanalytics_migration_client/liveanalytics_influxdb3_migration_client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ def __init__(
3232
db_name: str,
3333
s3_bucket_name: str,
3434
resume_migration: bool = False,
35-
timeout_seconds: int = 120,
35+
timeout_seconds: int = 1_200,
3636
region: str = "us-west-2",
3737
) -> None:
3838
"""
3939
Initialize
4040
4141
Args:
4242
db_name (str): Timestream for LiveAnalytics database name.
43-
s3_bucket (str): S3 bucket name.
43+
s3_bucket (str) S3 bucket name.
4444
resume_migration (bool): Whether to resume an existing migration, skipping unload operations.
45+
timeout_seconds (int): The number of seconds to wait for each migration request.
46+
region (str): The AWS Region to use.
4547
4648
Returns:
4749
None
@@ -432,7 +434,7 @@ def bulk_invoke_http_trigger(self, metadata):
432434
)
433435
trigger_invocation_response.raise_for_status()
434436
response_body = trigger_invocation_response.json()
435-
if response_body["status"] == "error":
437+
if response_body["status"] != 200 and response_body["status"] != 202:
436438
raise RuntimeError(
437439
f"Migrating {s3_key} failed: {response_body['message']}"
438440
)
@@ -455,8 +457,7 @@ def bulk_invoke_http_trigger(self, metadata):
455457
f"Final verification failed: {final_invocation_response.json()['message']}"
456458
)
457459
except Exception as e:
458-
self.error(f"HTTP invocation failed: {e}")
459-
self.error("View processing engine logs for more information")
460+
self.error(f"HTTP invocation failed: {e}. View processing engine logs for more information")
460461
sys.exit(1)
461462

462463
def get_num_completed_and_total_parquet_files(self):

tools/python/liveanalytics_influxdb3_migration_plugin/liveanalytics_migration_plugin/liveanalytics_migration_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def transform_row_to_lp(influxdb3_local, row, table_name, field_types):
515515
influxdb3_local (InfluxDB client): Logging and ingestion client
516516
row (string): Row in parquet file
517517
table_name (string): Table name
518-
field_types(array): Array of field types (only includes double and int64)
518+
field_types (list[tuple[str, Any]]): Array of field types, which only includes double, float, and int64.
519519
520520
Returns:
521521
LineBuilder: LineBuilder object ready for writing to InfluxDB.
@@ -545,7 +545,7 @@ def transform_row_to_lp(influxdb3_local, row, table_name, field_types):
545545
elif parse_dimensions and isinstance(
546546
val, (str, numpy.bool_, pandas.StringDtype().type)
547547
):
548-
builder.tag(col, val)
548+
builder.tag(col_name, val)
549549
elif not parse_dimensions and (pandas.isna(val) or val is None):
550550
influxdb3_local.info(
551551
f"Skipping field value with nulled or missing value for column {col}"

0 commit comments

Comments
 (0)