MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / SessionState

Class SessionState

ui/easydiffusion/task_manager.py:169–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167
168
169class SessionState:
170 def __init__(self, id: str):
171 self._id = id
172 self._tasks_ids = []
173
174 @property
175 def id(self):
176 return self._id
177
178 @property
179 def tasks(self):
180 tasks = []
181 for task_id in self._tasks_ids:
182 task = task_cache.tryGet(task_id)
183 if task:
184 tasks.append(task)
185 return tasks
186
187 def put(self, task: Task, ttl=TASK_TTL):
188 task_id = task.id
189 self._tasks_ids.append(task_id)
190 if not task_cache.put(task_id, task, ttl):
191 return False
192 while len(self._tasks_ids) > len(render_threads) * 2:
193 self._tasks_ids.pop(0)
194 return True
195
196
197def keep_task_alive(task: Task):

Callers 1

get_cached_sessionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected