-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-entrypoint.sh
73 lines (67 loc) · 1.85 KB
/
docker-entrypoint.sh
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
#!/usr/bin/env bash
set -Eeo pipefail
CONCURRENCY=${WORKERS_PER_INSTANCE:-1}
if [[ -n "$1" ]]; then
# if we start with a params assume we want to run that
# prep commands
if [ "$1" = "migrate" ]; then
echo "migrate"
python ./dj_airbnb/manage.py migrate
exit
elif [ "$1" = "load-mask" ]; then
echo "load-mask"
python ./dj_airbnb/manage.py import_world_mask "${@:2}"
exit
elif [ "$1" = "sense-aoi" ]; then
echo "sense-aoi"
python ./dj_airbnb/manage.py sense_aoi "${@:2}"
exit
elif [ "$1" = "prep-grid" ]; then
echo "prep-grid"
python ./dj_airbnb/manage.py generate_grid "${@:2}"
exit
elif [ "$1" = 'tidy-grids' ]; then
python ./dj_airbnb/manage.py tidi_grid
exit
# Op commands
elif [ "$1" = "find-listings" ]; then
echo "find-listings"
python ./dj_airbnb/manage.py find_listings_aoi "${@:2}"
exit
elif [ "$1" = "fetch-calendar" ]; then
echo "fetch-calendar"
python ./dj_airbnb/manage.py fetch_resource_for_listing calendar "${@:2}"
exit
elif [ "$1" = "fetch-listing-detail" ]; then
echo "fetch-listing-detail"
python ./dj_airbnb/manage.py fetch_resource_for_listing listing-detail "${@:2}"
exit
elif [ "$1" = "fetch-reviews" ]; then
echo "fetch-reviews"
python ./dj_airbnb/manage.py fetch_resource_for_listing reviews "${@:2}"
exit
elif
[ "$1" = "send-task" ]
then
python ./dj_airbnb/manage.py send_task "${@:2}"
exit
elif [ "$1" = 'shell' ]; then
python ./dj_airbnb/manage.py shell
exit
fi
exec "$@"
fi
if
[ "$MODE" = "worker" ]
then
echo "!!!Starting Worker!!!"
celery -A dj_airbnb.celery:app worker -l info --concurrency="${CONCURRENCY}"
exit
elif
[ "$MODE" = "beat" ]
then
echo "Starting Beat"
celery -A dj_airbnb.celery:app beat -l info -s /celerybeat-schedule.d --pidfile="$(mktemp)".pid
exit
fi
exit $?