fix: checktaskset create bug
This commit is contained in:
parent
a9cbd846cd
commit
388b28133f
|
@ -83,13 +83,18 @@ class CheckTaskSetCreateSerializer(CustomModelSerializer):
|
|||
with transaction.atomic():
|
||||
sch = validated_data["myschedule"]
|
||||
pobj = PeriodicTask()
|
||||
pobj.name = 'checktask_' + time.strftime('%Y%m%d%H%M%S')
|
||||
pobj.task = 'apps.dpm.dispath_checkwork_task'
|
||||
if sch.crontab:
|
||||
pobj.crontab = sch.crontab
|
||||
elif sch.interval:
|
||||
pobj.interval = sch.interval
|
||||
pobj.save()
|
||||
validated_data["periodictask"] = pobj
|
||||
return super().create(validated_data)
|
||||
ins = super().create(validated_data)
|
||||
pobj.kwargs = json.dumps({'checktaskset': ins.id})
|
||||
pobj.save()
|
||||
return ins
|
||||
|
||||
class CheckTaskSetUpdateSerializer(CustomModelSerializer):
|
||||
class Meta:
|
||||
|
|
Loading…
Reference in New Issue