Skip to content

Commit

Permalink
Re-word internal use of id to tag
Browse files Browse the repository at this point in the history
Inside the worker we track predictions by tag not exterenal predicition
IDs, this commit updates the variable names to reflect this.
  • Loading branch information
aron committed Nov 26, 2024
1 parent d19b3b7 commit 41adaa9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions python/cog/server/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ def predict(

with self._predict_tasks_lock:
# first remove finished tasks so we don't grow the dictionary without bound
done_ids = [
id for id in self._predict_tasks if self._predict_tasks[id].done()
# TODO: clean this up by adding a done callback to the task.
done_tags = [
tag for tag in self._predict_tasks if self._predict_tasks[tag].done()
]
for id in done_ids:
del self._predict_tasks[id]
for tag in done_tags:
del self._predict_tasks[tag]

self._predict_tasks[tag] = task

Expand Down

0 comments on commit 41adaa9

Please sign in to comment.