Esempio n. 1
0
def delete_job_api():
    if request.method == 'POST':
        job_id = request.form.get('job_id')
        if job_id is None:
            raise RQMonitorException('Job ID not received', status_code=400)

        delete_job(job_id)
        return {
            'message': 'Successfully deleted job with ID {0}'.format(job_id)
        }
Esempio n. 2
0
def delete_job_api():
    if request.method == 'POST':
        job_id = request.form.get('job_id')
        if job_id is None:
            raise RQMonitorException('Job ID not received', status_code=400)
        try:
            delete_job(job_id)
        except ActionFailed:
            raise RQMonitorException('Unable to delete {0}'.format(job_id),
                                     status_code=500)

        return {
            'message': 'Successfully deleted job with ID {0}'.format(job_id)
        }
    raise RQMonitorException('Invalid HTTP Request type', status_code=400)