fix: 清理错误定时策略并支持生成cron文本3

This commit is contained in:
caoqianming 2023-08-07 00:38:55 +08:00
parent 51acf6caa0
commit 4375c344e9
1 changed files with 9 additions and 5 deletions

View File

@ -36,11 +36,15 @@ def correct_myschedule():
elif typeset == 'crontab': elif typeset == 'crontab':
try: try:
crontab = item.crontab crontab = item.crontab
item.name = get_chinese_description(typeset, if crontab:
{"minute": crontab.minute, "hour": crontab.hour, "day_of_month": crontab.day_of_month, item.name = get_chinese_description(typeset,
"month_of_year": crontab.month_of_year, "day_of_week": crontab.day_of_week}) {"minute": crontab.minute, "hour": crontab.hour, "day_of_month": crontab.day_of_month,
if item.name == '': "month_of_year": crontab.month_of_year, "day_of_week": crontab.day_of_week})
crontab.delete() if item.name == '':
crontab.delete()
item.delete()
else:
PeriodicTask.objects.filter(gridtaskset_periodictask__myschedule=item).delete()
item.delete() item.delete()
except ObjectDoesNotExist: except ObjectDoesNotExist:
GridTaskSet.objects.filter(myschedule=item).delete() GridTaskSet.objects.filter(myschedule=item).delete()