signals.py 344 B

1234567891011
  1. from django.db.models.signals import post_save
  2. from django.dispatch import receiver
  3. from main.models import Run
  4. from main.tasks import celery_task
  5. @receiver(post_save, sender=Run)
  6. def upload_to_s3bucket(sender, **kwargs):
  7. pending_runs = Run.objects.filter(status='Pending')
  8. for run in pending_runs:
  9. celery_task.delay(run.run)