Skip to content

Commit 8340706

Browse files
committed
fix:p3.11
1 parent 4584348 commit 8340706

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

scheduler/management/commands/scheduler_stats.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _print_stats_dashboard(self, statistics, prev_stats=None, with_color: bool =
8484
def handle(self, *args, **options):
8585
if options.get("json") and options.get("yaml"):
8686
click.secho("Aborting. Cannot output as both json and yaml", err=True, fg="red")
87-
return
87+
exit(1)
8888
if options.get("json"):
8989
import json
9090

scheduler/tests/test_mgmt_commands/test_scheduler_stats.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def test_scheduler_stats__bad_args(self):
8585
sys.stderr = StringIO()
8686
sys.stdout = StringIO()
8787
# act
88-
call_command("scheduler_stats", "-y", "-j")
88+
with self.assertRaises(SystemExit):
89+
call_command("scheduler_stats", "-y", "-j")
8990
# assert
9091
res = sys.stdout.getvalue()
9192
self.assertEqual(res, """""")

scheduler/views/job_views.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class JobDetailAction(str, Enum):
2020
ENQUEUE = "enqueue"
2121
CANCEL = "cancel"
2222

23-
2423
@never_cache
2524
@staff_member_required
2625
def job_detail(request: HttpRequest, job_name: str) -> HttpResponse:
@@ -57,7 +56,7 @@ def job_action(request: HttpRequest, job_name: str, action: str) -> HttpResponse
5756
if job is None:
5857
messages.warning(request, f"Job {escape(job_name)} does not exist, maybe its TTL has passed")
5958
return redirect("queues_home")
60-
if action not in JobDetailAction:
59+
if action not in [item.value for item in JobDetailAction]:
6160
return HttpResponseBadRequest(f"Action {escape(action)} is not supported")
6261

6362
if request.method != "POST":

scheduler/views/queue_job_actions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def queue_job_actions(request: HttpRequest, queue_name: str) -> HttpResponse:
3131
next_url = _check_next_url(request, reverse("queue_registry_jobs", args=[queue_name, "queued"]))
3232
action = request.POST.get("action", False)
3333
job_names = request.POST.get("job_names", False)
34-
if request.method != "POST" or not action or not job_names or action not in QueueJobAction:
34+
if request.method != "POST" or not action or not job_names or action not in [item.value for item in QueueJobAction]:
3535
return redirect(next_url)
3636
job_names = request.POST.getlist("job_names")
3737
if action == QueueJobAction.DELETE.value:

scheduler/views/queue_registry_actions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def queue_registry_actions(request: HttpRequest, queue_name: str, registry_name:
4848
if registry is None:
4949
return HttpResponseNotFound()
5050
next_url = _check_next_url(request, reverse("queue_registry_jobs", args=[queue_name, registry_name]))
51-
if action not in QueueRegistryActions:
51+
if action not in [item.value for item in QueueRegistryActions]:
5252
return redirect(next_url)
5353
if request.method == "POST":
5454
if action == QueueRegistryActions.EMPTY.value:

0 commit comments

Comments
 (0)