-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
99 lines (82 loc) · 2.28 KB
/
Copy pathentrypoint.sh
File metadata and controls
99 lines (82 loc) · 2.28 KB
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
#!/bin/bash
# Entrypoint script for Heliosail-RX Docker container
set -e
# Function to display usage
usage() {
cat << EOF
Usage: docker run heliosail-rx [COMMAND] [OPTIONS]
Commands:
demo Run architecture demonstration (default)
mission FILE Run mission from YAML config file
test Run all tests
test-io Run I/O infrastructure tests
test-wrappers Run physics module wrapper tests
shell Start interactive Python shell
bash Start bash shell
Examples:
docker run heliosail-rx demo
docker run -v /home/user/missions:/app/missions heliosail-rx mission /app/missions/my_mission.yaml
docker run heliosail-rx test
Environment Variables:
OUTPUT_DIR Output directory for results (default: /app/outputs)
LOG_LEVEL Logging level (default: INFO)
EOF
}
# Default to demo if no command provided
COMMAND="${1:-demo}"
case "$COMMAND" in
demo)
echo "Starting Heliosail-RX Architecture Demo..."
exec python architecture_demo.py
;;
mission)
if [ -z "$2" ]; then
echo "Error: Mission file not specified"
echo "Usage: docker run heliosail-rx mission <config_file>"
exit 1
fi
echo "Running mission from: $2"
exec python -c "
from io.config_loader import load_config
from api import Mission
from models.wrappers import TwoBodyModule, SolarRadiationPressureModule
from io import export_all
config = load_config('$2')
mission = Mission(config)
mission.add_physics_module('orbital_mechanics', TwoBodyModule())
mission.add_physics_module('sail_srp', SolarRadiationPressureModule())
result = mission.run()
export_all(result, output_dir='${OUTPUT_DIR:-/app/outputs}')
print('Mission complete!')
"
;;
test)
echo "Running all tests..."
exec python -m pytest test_*.py -v
;;
test-io)
echo "Running I/O infrastructure tests..."
exec python test_io_simple.py
;;
test-wrappers)
echo "Running physics module wrapper tests..."
exec python test_wrappers_simple.py
;;
shell)
echo "Starting Python interactive shell..."
exec python
;;
bash)
echo "Starting bash shell..."
exec /bin/bash
;;
--help|-h)
usage
exit 0
;;
*)
echo "Unknown command: $COMMAND"
usage
exit 1
;;
esac