Spaces:
Sleeping
Sleeping
File size: 2,738 Bytes
b14c6e3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #!/bin/bash
# Docker Entrypoint Script for Adaptive Alert Triage Environment
set -e
echo "================================"
echo "Adaptive Alert Triage - OpenEnv"
echo "================================"
echo ""
# Function to run validation
validate_env() {
echo "Running OpenEnv validation..."
echo ""
# Check Python environment
python --version
pip list | grep -E "(pydantic|openenv|numpy)"
echo ""
echo "Checking package installation..."
python -c "import adaptive_alert_triage; print(f'✓ Package version: {adaptive_alert_triage.__version__}')"
echo ""
echo "Validating environment structure..."
python -c "
from adaptive_alert_triage.env import AdaptiveAlertTriageEnv
from adaptive_alert_triage.models import Action, Observation, Reward
# Test easy task
print('Testing easy task...')
env = AdaptiveAlertTriageEnv(task_id='easy', seed=42)
obs = env.reset()
assert isinstance(obs, Observation)
print(f' ✓ Reset successful: {len(obs.alerts)} alerts')
action = Action(alert_id=obs.alerts[0].id, action_type='INVESTIGATE')
obs, reward, done, info = env.step(action)
assert isinstance(reward, Reward)
print(f' ✓ Step successful: reward={reward.value}')
# Test medium task
print('Testing medium task...')
env = AdaptiveAlertTriageEnv(task_id='medium', seed=42)
obs = env.reset()
print(f' ✓ Resource budget: {obs.resource_budget}')
# Test hard task
print('Testing hard task...')
env = AdaptiveAlertTriageEnv(task_id='hard', seed=42)
obs = env.reset()
state = env.state()
print(f' ✓ Hidden state keys: {list(state.hidden_state.keys())}')
print('')
print('✅ All validation checks passed!')
"
echo ""
echo "Environment validated successfully!"
}
# Function to run tests
run_tests() {
echo "Running test suite..."
echo ""
pytest tests/ -v --tb=short
echo ""
echo "Tests completed!"
}
# Function to run evaluation
run_evaluation() {
echo "Running baseline evaluation..."
echo ""
python evaluation/evaluate.py --episodes 5 --verbose
echo ""
echo "Evaluation completed!"
}
# Function to start demo
run_demo() {
echo "Running environment demo..."
echo ""
python src/adaptive_alert_triage/env.py
echo ""
echo "Demo completed!"
}
# Main command routing
case "$1" in
validate|openenv)
validate_env
;;
test)
run_tests
;;
evaluate)
run_evaluation
;;
demo)
run_demo
;;
bash|sh|shell)
exec /bin/bash
;;
*)
# Default: run validation
if [ $# -eq 0 ]; then
validate_env
else
# Pass through to command
exec "$@"
fi
;;
esac |