Skip to content

Commit 408d428

Browse files
authored
fix: respect default cache ttl for local runs (#5472)
1 parent 62d70b6 commit 408d428

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/oso-core/oso_core/cache/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ def with_no_expiration(cls) -> t.Self:
2626
return cls(ttl_seconds=0)
2727

2828
@classmethod
29-
def with_no_expiration_if(cls, condition: bool) -> t.Self:
29+
def with_no_expiration_if(
30+
cls, condition: bool, default_ttl_seconds: int = 900
31+
) -> t.Self:
3032
if condition:
3133
return cls.with_no_expiration()
32-
return cls()
34+
return cls(ttl_seconds=default_ttl_seconds)
3335

3436

3537
class CacheOptions(BaseModel):

warehouse/oso_dagster/assets/sqlmesh/sqlmesh.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def sqlmesh_factory(
126126
sqlmesh_gateway=global_config.sqlmesh_gateway,
127127
),
128128
cache_metadata_options=CacheMetadataOptions.with_no_expiration_if(
129-
global_config.run_mode == "build" and global_config.in_deployed_container
129+
global_config.run_mode == "build" and global_config.in_deployed_container,
130+
default_ttl_seconds=global_config.asset_cache_default_ttl_seconds,
130131
),
131132
)
132133
def cacheable_sqlmesh_multi_asset_options(

0 commit comments

Comments
 (0)