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
This commit is contained in:
Martyn Inglis
2016-02-24 17:12:30 +00:00
parent 1667f82df1
commit b3884e2d6c
20 changed files with 453 additions and 527 deletions

View File

@@ -2,24 +2,23 @@ from app import db
from app.models import Job
def save_job(job, update_dict={}):
if update_dict:
update_dict.pop('id', None)
update_dict.pop('service', None)
update_dict.pop('template', None)
Job.query.filter_by(id=job.id).update(update_dict)
else:
db.session.add(job)
db.session.commit()
def get_job(service_id, job_id):
def dao_get_job_by_service_id_and_job_id(service_id, job_id):
return Job.query.filter_by(service_id=service_id, id=job_id).first()
def get_jobs_by_service(service_id):
def dao_get_jobs_by_service_id(service_id):
return Job.query.filter_by(service_id=service_id).all()
def _get_jobs():
return Job.query.all()
def dao_get_job_by_id(job_id):
return Job.query.filter_by(id=job_id).first()
def dao_create_job(job):
db.session.add(job)
db.session.commit()
def dao_update_job(job):
db.session.add(job)
db.session.commit()