app.tasks
This module implements tasks to run.
- copyright
2018 European Spallation Source ERIC
- license
BSD 2-Clause, see LICENSE for more details.
- class app.tasks.TaskWorker(queues, name=None, default_result_ttl=500, connection=None, exc_handler=None, exception_handlers=None, default_worker_ttl=420, job_class=None, queue_class=None, log_job_description=True, job_monitoring_interval=30, disable_default_exception_handler=False, prepare_for_work=True, serializer=None)[source]
Modified version of the rq worker which updates the task status and end time in the CSEntry database
- handle_job_failure(job, queue, started_job_registry=None, exc_string='')[source]
Handles the failure or an executing job by: 1. Setting the job status to failed 2. Removing the job from StartedJobRegistry 3. Setting the workers current job to None 4. Add the job to FailedJobRegistry
- prepare_job_execution(job, heartbeat_ttl=None)[source]
Performs misc bookkeeping like updating states prior to job execution.
- app.tasks.generate_items_excel_file()[source]
Export all inventory items to an excel file
Return the name of the file
- app.tasks.launch_awx_job(resource='job', **kwargs)[source]
Launch an AWX job
job_template or inventory_source shall be passed as keyword argument
- Parameters
resource – job|workflow_job|inventory_source
**kwargs – keyword arguments passed to launch the job
- Returns
A dictionary with information from resource.monitor