Skip to content

Commit

Permalink
fix: Update settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Dec 13, 2024
1 parent c51d8e3 commit f920a38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions posthog/settings/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"BATCH_EXPORT_S3_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES", 0, type_cast=int
)
BATCH_EXPORT_SNOWFLAKE_UPLOAD_CHUNK_SIZE_BYTES: int = 1024 * 1024 * 100 # 100MB
BATCH_EXPORT_SNOWFLAKE_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES: int = get_from_env(
"BATCH_EXPORT_SNOWFLAKE_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES", 1024 * 1024 * 300, type_cast=int
)
BATCH_EXPORT_POSTGRES_UPLOAD_CHUNK_SIZE_BYTES: int = 1024 * 1024 * 50 # 50MB
BATCH_EXPORT_BIGQUERY_UPLOAD_CHUNK_SIZE_BYTES: int = 1024 * 1024 * 100 # 100MB
BATCH_EXPORT_BIGQUERY_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES: int = get_from_env(
Expand Down
5 changes: 2 additions & 3 deletions posthog/temporal/batch_exports/snowflake_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ async def insert_into_snowflake_activity(inputs: SnowflakeInsertInputs) -> Recor
data_interval_end = dt.datetime.fromisoformat(inputs.data_interval_end)
full_range = (data_interval_start, data_interval_end)

queue = RecordBatchQueue()
queue = RecordBatchQueue(max_size_bytes=settings.BATCH_EXPORT_SNOWFLAKE_RECORD_BATCH_QUEUE_MAX_SIZE_BYTES)
producer = Producer(clickhouse_client=client)
producer_task = producer.start(
queue=queue,
Expand Down Expand Up @@ -724,8 +724,7 @@ async def insert_into_snowflake_activity(inputs: SnowflakeInsertInputs) -> Recor
data_interval_start=data_interval_start,
schema=record_batch_schema,
writer_format=WriterFormat.JSONL,
max_bytes=settings.BATCH_EXPORT_BIGQUERY_UPLOAD_CHUNK_SIZE_BYTES,
non_retryable_error_types=NON_RETRYABLE_ERROR_TYPES,
max_bytes=settings.BATCH_EXPORT_SNOWFLAKE_UPLOAD_CHUNK_SIZE_BYTES,
json_columns=known_variant_columns,
snowflake_client=snow_client,
snowflake_table=snow_stage_table if requires_merge else snow_table,
Expand Down

0 comments on commit f920a38

Please sign in to comment.