Skip to content

Commit 0674c50

Browse files
committed
feat:remove old-models
1 parent d4ecaee commit 0674c50

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

scheduler/templates/admin/scheduler/workers-list.partial.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<td>{{ worker.birth_date | date:"Y-m-d, H:i:s" }}</td>
4646
<td>{{ worker.hostname }}</td>
4747
<td>{{ worker.pid | unlocalize }}</td>
48-
<td>{{ worker.total_working_time | default:0 | floatformat }}secs</td>
48+
<td>{{ worker.total_working_time | default:0 | floatformat }} secs</td>
4949
<td>{{ worker.successful_job_count | default:0 }}</td>
5050
<td>{{ worker.failed_job_count | default:0 }}</td>
5151
<td>{{ worker | worker_scheduler_pid }}</td>

scheduler/templatetags/scheduler_tags.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from typing import Dict
1+
from typing import Dict, Optional
22

33
from django import template
44
from django.utils.safestring import mark_safe
55

6-
from scheduler.rq_classes import JobExecution, DjangoQueue
6+
from scheduler.rq_classes import JobExecution, DjangoQueue, DjangoWorker
77
from scheduler.tools import get_scheduled_task
88

99
register = template.Library()
@@ -33,8 +33,9 @@ def scheduled_job(job: JobExecution):
3333

3434

3535
@register.filter
36-
def worker_scheduler_pid(worker):
37-
return worker.scheduler_pid()
36+
def worker_scheduler_pid(worker: Optional[DjangoWorker]) -> str:
37+
scheduler_pid = worker.scheduler_pid() if worker is not None else None
38+
return str(scheduler_pid) if scheduler_pid is not None else "-"
3839

3940

4041
@register.filter

0 commit comments

Comments
 (0)