mirror of
https://github.com/karma-riuk/crab-webapp.git
synced 2025-07-05 14:18:12 +02:00
implement the queue
This commit is contained in:
@ -6,6 +6,7 @@ from typing import Callable, Optional, Set, Any
|
||||
|
||||
class Status(Enum):
|
||||
CREATED = "created"
|
||||
WAITING = "waiting"
|
||||
PROCESSING = "processing"
|
||||
COMPLETE = "complete"
|
||||
|
||||
@ -65,19 +66,5 @@ class Subject:
|
||||
self.results = results
|
||||
# TODO: maybe save results to disk here?
|
||||
|
||||
def launch_task(self, *args, **kwargs):
|
||||
self.status = Status.PROCESSING
|
||||
t = Thread(
|
||||
target=self.task,
|
||||
args=args,
|
||||
kwargs={
|
||||
**kwargs,
|
||||
"percent_cb": self.notifyPercentage,
|
||||
"complete_cb": self.notifyComplete,
|
||||
},
|
||||
daemon=True,
|
||||
)
|
||||
t.start()
|
||||
|
||||
|
||||
request2status: dict[str, Subject] = {}
|
||||
|
Reference in New Issue
Block a user