def add_batch(batch, count, task_type):
    if batch == app.config['DEFAULT_BATCH']:
        batch, _ = Batch.objects.get_or_create(id=batch)
        batch.update(inc__tasks_count=count)
    else:
        Batch.objects.create(id=batch, task_type=task_type, tasks_count=count)
Updates or creates new batch after loading new dataset
dataset/ETHPy150Open mrgambal/vulyk/vulyk/cli/batches.py/add_batch