async def _run_job(self, job: Job) -> None:
    now = datetime.now(timezone.utc)
    if (job.start_deadline is not None):
        if (now.timestamp() > job.start_deadline.timestamp()):
            self.logger.info('Missed the deadline of job %r', job.id)
            event = JobDeadlineMissed(now, job_id=job.id, task_id=job.task_id, schedule_id=job.schedule_id, scheduled_fire_time=job.scheduled_fire_time, start_time=now, start_deadline=job.start_deadline)
            (await self.publish(event))
            return
    self.logger.info('Started job %r', job.id)
    job.started_at = now
    event = JobUpdated(timestamp=now, job_id=job.id, task_id=job.task_id, schedule_id=job.schedule_id)
    (await self.publish(event))
    self._running_jobs += 1
    try:
        return_value = (await self._call_job_func(job.func, job.args, job.kwargs))
    except BaseException as exc:
        self.logger.exception('Job %r raised an exception', job.id)
        event = JobFailed(timestamp=datetime.now(timezone.utc), job_id=job.id, task_id=job.task_id, schedule_id=job.schedule_id, scheduled_fire_time=job.scheduled_fire_time, start_time=now, start_deadline=job.start_deadline, traceback=format_exc(), exception=exc)
    else:
        self.logger.info('Job %r completed successfully', job.id)
        event = JobSuccessful(timestamp=datetime.now(timezone.utc), job_id=job.id, task_id=job.task_id, schedule_id=job.schedule_id, scheduled_fire_time=job.scheduled_fire_time, start_time=now, start_deadline=job.start_deadline, return_value=return_value)
    self._running_jobs -= 1
    (await self.data_store.release_jobs(self.identity, [job]))
    (await self.publish(event))
async def _run_job(self, job: Job) -> None:
    now = datetime.now(timezone.utc)
    if (job.start_deadline is not None):
        if (now.timestamp() > job.start_deadline.timestamp()):
            self.logger.info('Missed the deadline of job %r', job.id)
            event = JobDeadlineMissed(now, job_id=job.id, task_id=job.task_id, schedule_id=job.schedule_id, scheduled_fire_time=job.scheduled_fire_time, start_time=now, start_deadline=job.start_deadline)
            (await self.publish(event))
            return
    self.logger.info('Started job %r', job.id)
    job.started_at = now
    event = JobUpdated(timestamp=now, job_id=job.id, task_id=job.task_id, schedule_id=job.schedule_id)
    (await self.publish(event))
    self._running_jobs += 1
    try:
        return_value = (await self._call_job_func(job.func, job.args, job.kwargs))
    except BaseException as exc:
        self.logger.exception('Job %r raised an exception', job.id)
        event = JobFailed(timestamp=datetime.now(timezone.utc), job_id=job.id, task_id=job.task_id, schedule_id=job.schedule_id, scheduled_fire_time=job.scheduled_fire_time, start_time=now, start_deadline=job.start_deadline, traceback=format_exc(), exception=exc)
    else:
        self.logger.info('Job %r completed successfully', job.id)
        event = JobSuccessful(timestamp=datetime.now(timezone.utc), job_id=job.id, task_id=job.task_id, schedule_id=job.schedule_id, scheduled_fire_time=job.scheduled_fire_time, start_time=now, start_deadline=job.start_deadline, return_value=return_value)
    self._running_jobs -= 1
    (await self.data_store.release_jobs(self.identity, [job]))
    (await self.publish(event))