|
6 | 6 | from pydantic import Field, validator
|
7 | 7 | from pyiceberg.catalog import Catalog, load_catalog
|
8 | 8 | from sortedcontainers import SortedList
|
9 |
| - |
| 9 | +from functools import lru_cache |
10 | 10 | from datahub.configuration.common import AllowDenyPattern, ConfigModel
|
11 | 11 | from datahub.configuration.source_common import DatasetSourceConfigMixin
|
12 | 12 | from datahub.ingestion.source.state.stale_entity_removal_handler import (
|
@@ -85,10 +85,6 @@ class IcebergSourceConfig(StatefulIngestionConfigBase, DatasetSourceConfigMixin)
|
85 | 85 | processing_threads: int = Field(
|
86 | 86 | default=1, description="How many threads will be processing tables"
|
87 | 87 | )
|
88 |
| - def __init__(self): |
89 |
| - self.profiling_enabled = self.profiling.enabled and is_profiling_enabled( |
90 |
| - self.profiling.operation_config |
91 |
| - ) |
92 | 88 |
|
93 | 89 | @validator("catalog", pre=True, always=True)
|
94 | 90 | def handle_deprecated_catalog_format(cls, value):
|
@@ -128,9 +124,12 @@ def validate_catalog_size(cls, value):
|
128 | 124 | )
|
129 | 125 |
|
130 | 126 | return value
|
131 |
| - |
| 127 | + |
| 128 | + @lru_cache() |
132 | 129 | def is_profiling_enabled(self) -> bool:
|
133 |
| - return self.profiling_enabled |
| 130 | + return self.profiling.enabled and is_profiling_enabled( |
| 131 | + self.profiling.operation_config |
| 132 | + ) |
134 | 133 |
|
135 | 134 | def get_catalog(self) -> Catalog:
|
136 | 135 | """Returns the Iceberg catalog instance as configured by the `catalog` dictionary.
|
|
0 commit comments