Skip to content

Commit

Permalink
Feat: Add new configurable env var AIRBYTE_TEMP_FILE_CLEANUP (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored Aug 10, 2024
1 parent 9bb782e commit 94681b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions airbyte/caches/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from airbyte._future_cdk.state_writers import StdOutStateWriter
from airbyte.caches._catalog_backend import CatalogBackendBase, SqlCatalogBackend
from airbyte.caches._state_backend import SqlStateBackend
from airbyte.constants import DEFAULT_ARROW_MAX_CHUNK_SIZE
from airbyte.constants import DEFAULT_ARROW_MAX_CHUNK_SIZE, TEMP_FILE_CLEANUP
from airbyte.datasets._sql import CachedDataset


Expand Down Expand Up @@ -49,7 +49,7 @@ class CacheBase(SqlConfig):
cache_dir: Path = Field(default=Path(".cache"))
"""The directory to store the cache in."""

cleanup: bool = True
cleanup: bool = TEMP_FILE_CLEANUP
"""Whether to clean up the cache after use."""

_deployed_api_root: Optional[str] = PrivateAttr(default=None)
Expand Down
15 changes: 15 additions & 0 deletions airbyte/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,18 @@ def _get_logging_root() -> Path | None:
temporary directory. If the directory cannot be created, PyAirbyte will log a warning and
set this value to `None`.
"""

TEMP_FILE_CLEANUP = bool(
os.getenv(
key="AIRBYTE_TEMP_FILE_CLEANUP",
default="true",
)
.lower()
.replace("false", "")
.replace("0", "")
)
"""Whether to clean up temporary files after use.
This value is read from the `AIRBYTE_TEMP_FILE_CLEANUP` environment variable. If the variable is
not set, the default value is `True`.
"""

0 comments on commit 94681b0

Please sign in to comment.