1
0
Fork 0

lint(api): log which device is assigned to which job

This commit is contained in:
Sean Sube 2023-02-04 15:56:32 -06:00
parent 5e0231c01b
commit f6a6c997bb
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 4 additions and 1 deletions

View File

@ -142,7 +142,10 @@ class DevicePoolExecutor:
self.jobs[:] = [job for job in self.jobs if job.future.done()]
def submit(self, key: str, fn: Callable[..., None], /, *args, **kwargs) -> None:
context = JobContext(key, self.devices, device_index=self.get_next_device())
device = self.get_next_device()
logger.info('assigning job %s to device %s', key, device)
context = JobContext(key, self.devices, device_index=device)
future = self.pool.submit(fn, context, *args, **kwargs)
job = Job(key, future, context)
self.jobs.append(job)