async def run(self, start_event: Optional[Event]=None) -> None:
    self._stop_event = create_event()
    self._running = True
    if start_event:
        (await start_event.set())
    while self._running:
        limit = (self.max_concurrent_jobs - self._running_jobs)
        jobs = []
        async with open_cancel_scope() as self._acquire_cancel_scope:
            try:
                jobs = (await self.data_store.acquire_jobs(self.identity, limit))
            finally:
                del self._acquire_cancel_scope
        for job in jobs:
            (await self._task_group.spawn(self._run_job, job))
    (await self._stop_event.set())
    del self._stop_event
    del self._task_group
async def run(self, start_event: Optional[Event]=None) -> None:
    self._stop_event = create_event()
    self._running = True
    if start_event:
        (await start_event.set())
    while self._running:
        limit = (self.max_concurrent_jobs - self._running_jobs)
        jobs = []
        async with open_cancel_scope() as self._acquire_cancel_scope:
            try:
                jobs = (await self.data_store.acquire_jobs(self.identity, limit))
            finally:
                del self._acquire_cancel_scope
        for job in jobs:
            (await self._task_group.spawn(self._run_job, job))
    (await self._stop_event.set())
    del self._stop_event
    del self._task_group