Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"pytest",
"pytz",
"requests",
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@3b74a445b370745fcb7bc380b4f37e9bf2f7cf56",
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@66cbce0d89d15e4c372b690363c24ea350cc9314",
"us-equity-strategies @ git+https://github.com/QuantStrategyLab/UsEquityStrategies.git@271358eea934f731d8f92b1b4ca8e596425ca364",
]
license = "MIT"
Expand Down Expand Up @@ -82,5 +82,5 @@ show_missing = true

[tool.uv]
override-dependencies = [
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@3b74a445b370745fcb7bc380b4f37e9bf2f7cf56",
"quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@66cbce0d89d15e4c372b690363c24ea350cc9314",
]
2 changes: 1 addition & 1 deletion qsl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ upgrade_ring = "ring_d"
allow_legacy = false

[qsl.requires]
quant_platform_kit = "3b74a445b370745fcb7bc380b4f37e9bf2f7cf56"
quant_platform_kit = "66cbce0d89d15e4c372b690363c24ea350cc9314"
us_equity_strategies = "271358eea934f731d8f92b1b4ca8e596425ca364"

[qsl.compat]
Expand Down
15 changes: 13 additions & 2 deletions scripts/runtime_heartbeat_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ def _enabled(value: Any, *, default: bool = True) -> bool:
return str(value).strip().lower() not in {"0", "false", "no", "n", "off"}


def runtime_target_permits_standard_execution(runtime_target: Mapping[str, Any]) -> bool:
"""Return whether the generic execution heartbeat should require a receipt."""

continuity = _mapping(runtime_target.get("live_continuity"))
state = str(continuity.get("state") or "").strip().upper()
return not state or state in {"ACTIVE_LKG", "ROLLBACK_LKG"}


def _mapping(value: Any) -> Mapping[str, Any]:
return value if isinstance(value, Mapping) else {}

Expand Down Expand Up @@ -317,7 +325,7 @@ def runtime_target_configuration_has_enabled_targets(
)
if enabled_value is None:
enabled_value = runtime_target.get("runtime_target_enabled")
if _enabled(enabled_value):
if _enabled(enabled_value) and runtime_target_permits_standard_execution(runtime_target):
return True
return False

Expand All @@ -342,7 +350,10 @@ def load_runtime_targets(
)
if enabled_value is None:
enabled_value = runtime_target.get("runtime_target_enabled")
enabled = _enabled(enabled_value)
enabled = (
_enabled(enabled_value)
and runtime_target_permits_standard_execution(runtime_target)
)
if not enabled and not include_disabled:
continue
target_scope = _first_value(
Expand Down
22 changes: 22 additions & 0 deletions tests/test_runtime_heartbeat_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,28 @@ def test_target_defaults_and_scheduler_aliases_are_normalized() -> None:
}


def test_reconcile_only_target_is_not_an_execution_heartbeat_target() -> None:
environ = {
"CLOUD_RUN_SERVICE_TARGETS_JSON": json.dumps(
{
"targets": [
{
"service": "reconcile-only-service",
"runtime_target": {
"service_name": "reconcile-only-service",
"strategy_profile": "strategy-a",
"live_continuity": {"state": "RECONCILE_ONLY"},
},
}
]
}
)
}

assert load_runtime_targets(environ) == []
assert runtime_target_configuration_present(environ) is True


def test_strategy_profile_resolver_canonicalizes_aliases() -> None:
targets = load_runtime_targets(
{
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.