MCPcopy Create free account
hub / github.com/HumanSignal/label-studio / post

Method post

label_studio/data_export/api.py:708–731  ·  view source on GitHub ↗
(self, request, *args, **kwargs)

Source from the content-addressed store, hash-verified

706 permission_required = all_permissions.projects_change
707
708 def post(self, request, *args, **kwargs):
709 snapshot = self.get_object()
710 serializer = ExportConvertSerializer(data=request.data, context={'project': snapshot.project})
711 serializer.is_valid(raise_exception=True)
712 export_type = serializer.validated_data['export_type']
713 download_resources = serializer.validated_data.get('download_resources')
714
715 converted_format, created = ConvertedFormat.objects.exclude(
716 status=ConvertedFormat.Status.FAILED
717 ).get_or_create(export=snapshot, export_type=export_type)
718
719 if not created:
720 raise ValidationError(f'Conversion to {export_type} already started')
721
722 start_job_async_or_sync(
723 async_convert,
724 converted_format.id,
725 export_type,
726 snapshot.project,
727 request.build_absolute_uri('/'),
728 download_resources=download_resources,
729 on_failure=set_convert_background_failure,
730 )
731 return Response({'export_type': export_type, 'converted_format': converted_format.id})

Calls 4

start_job_async_or_syncFunction · 0.90
get_objectMethod · 0.45
getMethod · 0.45