queueueueue
This commit is contained in:
@@ -102,6 +102,28 @@ class OllamaQueue:
|
||||
return i + 1
|
||||
return 0
|
||||
|
||||
def has_pending_with_priority(self, priority: Priority) -> bool:
|
||||
"""Check if there are any pending or processing requests with the given priority"""
|
||||
# Check pending requests
|
||||
for req_file in self.pending_dir.glob("*.json"):
|
||||
try:
|
||||
data = json.loads(req_file.read_text())
|
||||
if data.get("priority") == priority.value:
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
|
||||
# Check processing requests
|
||||
for req_file in self.processing_dir.glob("*.json"):
|
||||
try:
|
||||
data = json.loads(req_file.read_text())
|
||||
if data.get("priority") == priority.value:
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
def wait_for_result(
|
||||
self,
|
||||
request_id: str,
|
||||
|
||||
Reference in New Issue
Block a user