MCPcopy
hub / github.com/WebODM/WebODM / commit

Method commit

app/api/tasks.py:274–300  ·  view source on GitHub ↗

Commit a task after all images have been uploaded

(self, request, pk=None, project_pk=None)

Source from the content-addressed store, hash-verified

272
273 @action(detail=True, methods=['post'])
274 def commit(self, request, pk=None, project_pk=None):
275 """
276 Commit a task after all images have been uploaded
277 """
278 # import time
279 # time.sleep(10)
280 # return Response('', status=524)
281 # raise exceptions.ValidationError(detail=_("Random upload failure for testing"))
282
283 try:
284 task = self.queryset.get(pk=pk, project=project_pk)
285 check_project_perms(request, task.project, ('change_project', ))
286 except (ObjectDoesNotExist, ValidationError):
287 raise exceptions.NotFound()
288
289 task.partial = False
290 task.images_count = len(task.scan_images())
291
292 if task.images_count < 1:
293 raise exceptions.ValidationError(detail=_("You need to upload at least 1 file before commit"))
294
295 task.update_size()
296 task.save()
297 worker_tasks.process_task.delay(task.id)
298
299 serializer = TaskSerializer(task)
300 return Response(serializer.data, status=status.HTTP_200_OK)
301
302 @action(detail=True, methods=['post'])
303 def upload(self, request, pk=None, project_pk=None):

Callers

nothing calls this directly

Calls 7

check_project_permsFunction · 0.85
TaskSerializerClass · 0.85
scan_imagesMethod · 0.80
update_sizeMethod · 0.80
_Function · 0.50
getMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected