Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbruinsslot committed Nov 6, 2023
1 parent 32560ea commit eeaa2fc
Show file tree
Hide file tree
Showing 5 changed files with 823 additions and 895 deletions.
2 changes: 0 additions & 2 deletions mula/scheduler/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,6 @@ def list_tasks(

f_req.filters.update(f_plugin) # type: ignore

self.logger.info(f"FILTER_REQUEST: {f_req}")

try:
results, count = self.ctx.datastores.task_store.get_tasks(
scheduler_id=scheduler_id,
Expand Down
9 changes: 6 additions & 3 deletions mula/scheduler/storage/task_store.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime, timedelta, timezone
from typing import Dict, List, Optional, Tuple

from sqlalchemy import func
from sqlalchemy import exc, func

from scheduler import models

Expand Down Expand Up @@ -48,8 +48,11 @@ def get_tasks(
if filters is not None:
query = apply_filter(models.TaskDB, query, filters)

count = query.count()
tasks_orm = query.order_by(models.TaskDB.created_at.desc()).offset(offset).limit(limit).all()
try:
count = query.count()
tasks_orm = query.order_by(models.TaskDB.created_at.desc()).offset(offset).limit(limit).all()
except exc.ProgrammingError as e:
raise ValueError(f"Invalid filter: {e}") from e

tasks = [models.Task.model_validate(task_orm) for task_orm in tasks_orm]

Expand Down
Loading

0 comments on commit eeaa2fc

Please sign in to comment.