Files
stonks-oracle/pipelines/kargo/market-hours-check.yaml
T
Celes Renata facce5dbb5 fix: add TTL and backoffLimit to market-hours-check jobs
Prevents accumulation of completed/failed verification jobs.
- ttlSecondsAfterFinished: 3600 (auto-cleanup after 1h)
- backoffLimit: 0 (no retries on intentional market-hours failure)
2026-04-30 04:33:50 +00:00

41 lines
1.4 KiB
YAML

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: market-hours-check
namespace: stonks-oracle
spec:
metrics:
- name: outside-market-hours
provider:
job:
spec:
ttlSecondsAfterFinished: 3600
backoffLimit: 0
template:
spec:
containers:
- name: check
image: alpine:3.19
command: [sh, -c]
args:
- |
apk add --no-cache tzdata
export TZ=America/New_York
DOW=$(date +%u) # 1=Mon, 7=Sun
HOUR=$(date +%H)
MIN=$(date +%M)
TIME_MIN=$((HOUR * 60 + MIN))
MARKET_OPEN=570 # 09:30
MARKET_CLOSE=960 # 16:00
if [ "$DOW" -ge 6 ]; then
echo "Weekend — promotions allowed"
exit 0
fi
if [ "$TIME_MIN" -lt "$MARKET_OPEN" ] || [ "$TIME_MIN" -ge "$MARKET_CLOSE" ]; then
echo "Outside market hours — promotions allowed"
exit 0
fi
echo "Market hours active ($(date)) — promotion blocked"
exit 1
restartPolicy: Never