From 825e3f518925223af78d71f7f913694668c9d857 Mon Sep 17 00:00:00 2001 From: merp Date: Tue, 22 Mar 2022 08:44:08 -0700 Subject: [PATCH] sort the listdir of jobs, so that jobs will run in a predictable order This makes it so that jobs will be run in alphabetic order per directory, starting with the jobs dir, then in order of time period from smallest (minutely) to largest (yearly), still contingent on the specification of time period as before. This allows the user to set the order of their jobs in a way similar to init; e.g. name the files with `00_` for it to go before `10_` --- django_extensions/management/jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_extensions/management/jobs.py b/django_extensions/management/jobs.py index 1c6cdb48a..e7a592d48 100644 --- a/django_extensions/management/jobs.py +++ b/django_extensions/management/jobs.py @@ -67,7 +67,7 @@ def my_import(name): def find_jobs(jobs_dir): try: - return [f[:-3] for f in os.listdir(jobs_dir) if not f.startswith('_') and f.endswith(".py")] + return sorted([f[:-3] for f in os.listdir(jobs_dir) if not f.startswith('_') and f.endswith(".py")]) except OSError: return []