Beispiel #1
0
def remove_from_sql_main_index(snapshots: QuerySet,
                               out_dir: str = OUTPUT_DIR) -> None:
    setup_django(out_dir, check_db=True)
    from django.db import transaction

    with transaction.atomic():
        snapshots.delete()
Beispiel #2
0
def forget_tasks(jobs: QuerySet):
    tasks = [
        task[0] for task in [
            sublist for biglist in [job.data for job in jobs]
            for sublist in biglist
        ]
    ]
    for task_id in tasks:
        task = AsyncResult(id=task_id)
        task.forget()
    jobs.delete()
 def delete_by_queryset(self, queryset: QuerySet) -> int:
     for entity in queryset.all():
         self._message_publisher.send_entity_delete_message(entity)
     # return only the number of deleted objects
     return queryset.delete()[0]
Beispiel #4
0
def remove_from_sql_main_index(snapshots: QuerySet, atomic: bool=False, out_dir: Path=OUTPUT_DIR) -> None:
    if atomic:
        with transaction.atomic():
            return snapshots.delete()
    return snapshots.delete()
Beispiel #5
0
def remove_from_sql_main_index(snapshots: QuerySet,
                               out_dir: Path = OUTPUT_DIR) -> None:
    with transaction.atomic():
        snapshots.delete()