diff --git a/backend/auto_labeling/urls.py b/backend/auto_labeling/urls.py index 0d947d33..c9a64f2e 100644 --- a/backend/auto_labeling/urls.py +++ b/backend/auto_labeling/urls.py @@ -1,6 +1,6 @@ from django.urls import path -from .views import (ConfigDetail, FullPipelineTesting, AutomatedLabeling, +from .views import (ConfigDetail, AutomatedLabeling, LabelMapperTesting, TemplateListAPI, TemplateDetailAPI, ConfigList, RestAPIRequestTesting, LabelExtractorTesting) @@ -25,11 +25,6 @@ urlpatterns = [ view=ConfigDetail.as_view(), name='auto_labeling_config' ), - path( - route='auto-labeling-config-testing', - view=FullPipelineTesting.as_view(), - name='auto_labeling_config_test' - ), path( route='auto-labeling-parameter-testing', view=RestAPIRequestTesting.as_view(), diff --git a/backend/auto_labeling/views.py b/backend/auto_labeling/views.py index e357ff36..11ff437c 100644 --- a/backend/auto_labeling/views.py +++ b/backend/auto_labeling/views.py @@ -61,41 +61,6 @@ class ConfigDetail(generics.RetrieveUpdateDestroyAPIView): permission_classes = [IsAuthenticated & IsProjectAdmin] -class FullPipelineTesting(APIView): - permission_classes = [IsAuthenticated & IsProjectAdmin] - - def post(self, *args, **kwargs): - try: - output = self.pass_config_validation() - output = self.pass_pipeline_call(output) - if not output: - raise SampleDataException() - return Response( - data={'valid': True, 'labels': output}, - status=status.HTTP_200_OK - ) - except requests.exceptions.ConnectionError: - raise URLConnectionError() - except botocore.exceptions.ClientError: - raise AWSTokenError() - except ValidationError as e: - raise e - except Exception as e: - raise e - - def pass_config_validation(self): - config = self.request.data['config'] - serializer = AutoLabelingConfigSerializer(data=config) - serializer.is_valid(raise_exception=True) - return serializer - - def pass_pipeline_call(self, serializer): - test_input = self.request.data['input'] - config = AutoLabelingConfig(**serializer.data) - labels = execute_pipeline(test_input, config=config) - return labels.labels - - class RestAPIRequestTesting(APIView): permission_classes = [IsAuthenticated & IsProjectAdmin] @@ -186,6 +151,7 @@ class AutomatedLabeling(generics.CreateAPIView): project = get_object_or_404(Project, pk=self.kwargs['project_id']) example = get_object_or_404(Example, pk=self.kwargs['example_id']) configs = AutoLabelingConfig.objects.filter(project=project) + # Todo: make async calls or celery tasks to reduce waiting time. for config in configs: labels = execute_pipeline(example.data, config=config) labels.save(project, example, self.request.user) diff --git a/frontend/domain/models/autoLabeling/configRepository.ts b/frontend/domain/models/autoLabeling/configRepository.ts index c0161b7a..205747a6 100644 --- a/frontend/domain/models/autoLabeling/configRepository.ts +++ b/frontend/domain/models/autoLabeling/configRepository.ts @@ -14,8 +14,6 @@ export interface ConfigRepository { update(projectId: string, item: ConfigItem): Promise - testConfig(projectId: string, item: ConfigItem, text: string): Promise - testParameters(projectId: string, item: ConfigItem, text: string): Promise testTemplate(projectId: string, response: any, item: ConfigItem): Promise diff --git a/frontend/repositories/autoLabeling/config/apiConfigRepository.ts b/frontend/repositories/autoLabeling/config/apiConfigRepository.ts index 3f321814..89bb9c90 100644 --- a/frontend/repositories/autoLabeling/config/apiConfigRepository.ts +++ b/frontend/repositories/autoLabeling/config/apiConfigRepository.ts @@ -50,13 +50,6 @@ export class APIConfigRepository implements ConfigRepository { await this.request.delete(url) } - async testConfig(projectId: string, item: ConfigItem, text: string): Promise { - const url = `/projects/${projectId}/auto-labeling-config-testing` - const response = await this.request.post(url, {config: {...item.toAPI()}, input: text}) - const responseItem: ConfigTestResponse = response.data - return responseItem - } - async testParameters(projectId: string, item: ConfigItem, text: string) { const url = `/projects/${projectId}/auto-labeling-parameter-testing` const response = await this.request.post(url, {...item.toAPI(), text}) diff --git a/frontend/services/application/autoLabeling/configApplicationService.ts b/frontend/services/application/autoLabeling/configApplicationService.ts index 1cb4b7a4..a4db1700 100644 --- a/frontend/services/application/autoLabeling/configApplicationService.ts +++ b/frontend/services/application/autoLabeling/configApplicationService.ts @@ -18,25 +18,6 @@ export class ConfigApplicationService { return this.configRepository.delete(projectId, itemId) } - public testConfig(projectId: string, item: ConfigItem, text: string): Promise { - return this.configRepository.testConfig(projectId, item, text) - .then((value) => { - return value - }) - .catch((error) => { - const data = error.response.data - if ('non_field_errors' in data) { - throw new Error(data.non_field_errors) - } else if ('template' in data) { - throw new Error('The template need to be filled.') - } else if ('detail' in data) { - throw new Error(data.detail) - } else { - throw new Error(data) - } - }) - } - public testParameters(projectId: string, item: ConfigItem, text: string) { return this.configRepository.testParameters(projectId, item, text) .then((value) => {