Coverage for src/couchers/jobs/enqueue.py: 100%
7 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-12-20 18:03 +0000
« prev ^ index » next coverage.py v7.5.0, created at 2024-12-20 18:03 +0000
1"""
2Background jobs
3"""
5import logging
7from couchers.models import BackgroundJob
9logger = logging.getLogger(__name__)
12def queue_job(session, job_type: str, payload, max_tries=None):
13 job = BackgroundJob(
14 job_type=job_type,
15 payload=payload.SerializeToString(),
16 max_tries=max_tries,
17 )
18 session.add(job)
19 return job.id