Commit Graph

16 Commits

Author SHA1 Message Date
Martyn Inglis
5d0bc0abe8 Add a stop celery script into the scripts folder.
Stopping celery via upstart issues a TERM signal to the whole process group, which immediately kills the worker threads. This can lead to inconsistentcy in the state of a notification as an API call, for example, can take several seconds consequently the likelihood of the call being lost due to a restart is relatively high.

We need to ensure that we stop cleanly to ensure code deploys and autoscale events do not cause issues.

this script is called as part of a pre-stop hook in upstart, which passes a pid file location to the script. The script will then issues the TERM signal to only the master celery process. which will cleanly shut down the workers and exit.

the script will loop based on the existence of a /proc/{pid} for the celery master process. Once the file is gone the script will exit. Upstart blocks on this script before issuing kill on whatever processes may be left hanging around.

the length of the loop is a maximum 15 minutes - which is the tested max time a task may take. In reality it will exit much quicker.
2017-02-08 16:17:50 +00:00
Rebecca Law
0169ebe69a Add routing keys to celery queues.
NOTE: make sure upstart script on preview is updated before merging.
2016-03-02 16:22:22 +00:00
Rebecca Law
6a739d5ec9 Remove celery_queues from config.
Removed unused endpoint.
2016-03-02 13:15:23 +00:00
Martyn Inglis
3872ac5e67 Moved the deinition of which queues the worker will consume from
- now in config not the script
2016-03-01 16:57:06 +00:00
Rebecca Law
6f338f17ac Merge branch 'master' into invitation
Conflicts:
	scripts/run_celery.sh
2016-02-29 16:14:35 +00:00
Rebecca Law
3879350c12 Send email invitation to invited user 2016-02-29 15:56:00 +00:00
Adam Shimali
59aec1939c [WIP] invited user now has comma separated permission values
stored against it so that user can be created with correct
permissions.
2016-02-29 14:05:02 +00:00
Martyn Inglis
10a764a2c1 Renamed the header of the CSV to 'to' from 'number' to allow for email jobs
- added new columns to Job and Notification to capture the start/end dates accurately
2016-02-25 09:59:50 +00:00
Martyn Inglis
b3884e2d6c Move job processing into celery
- brings boto S3 into new AWS folder
- CSV processing utils method

Rejigs the jobs rest endpoint - removes some now unused endpoints,

Calls to the task with the job, job processing in task, delegating SMS calls to the sms task
2016-02-24 17:12:30 +00:00
Martyn Inglis
b01782bbe6 Send Email via the API
- uses the new subject/email from fields present on the templates / service tables
- brings the send email api call into line with the sms one.
- same fields (to/template_id)
- same rules regarding restricted services
- wired in as a task into celery

Requires
- new celery queue
- new env property (NOTIFY_EMAIL_DOMAIN)
2016-02-22 17:17:29 +00:00
Rebecca Law
aff948e9ca Merge branch 'celery-send-sms-code' into celery-send-email-code
Conflicts:
	app/celery/tasks.py
	app/user/rest.py
	scripts/run_celery.sh
2016-02-18 10:50:14 +00:00
Rebecca Law
b286b4356c Update queue name with dashes 2016-02-18 10:45:25 +00:00
Rebecca Law
9073814d9f I have an issue with the test, not sure why? 2016-02-17 17:48:23 +00:00
Rebecca Law
d022d036dc Celery task to send the sms verify code.
Each celery task will use it's own queue.
2016-02-17 15:41:33 +00:00
Martyn Inglis
95cdfe08d1 Updated logging in run-celery script to log to application logs
- poll every second
- visibility of 1 minute
2016-02-17 11:18:27 +00:00
Martyn Inglis
e0e47b40fc Setup celery config 2016-02-17 10:22:25 +00:00