mneethiraj commented on code in PR #307:
URL: https://github.com/apache/atlas/pull/307#discussion_r2011269334


##########
repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java:
##########
@@ -177,6 +238,100 @@ AtlasImportResult run(EntityImportStream source, 
AtlasImportRequest request, Str
         return result;
     }
 
+    @Override
+    public void onImportTypeDef(AtlasTypesDef typesDef, String importId) 
throws AtlasBaseException {
+        RequestContext.get().setImportInProgress(true);
+        LOG.info("==> onImportTypeDef(typesDef={}, importId={})", typesDef, 
importId);
+        AtlasAsyncImportRequest importRequest = 
asyncImportService.fetchImportRequestByImportId(importId);
+        if (importRequest == null) {
+            throw new AtlasBaseException(AtlasErrorCode.IMPORT_NOT_FOUND, 
importId);

Review Comment:
   RequestContext.get().setImportInProgress(false) must be called here? Please 
review and reorganize blocks.



##########
repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java:
##########
@@ -48,22 +59,34 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
+import static 
org.apache.atlas.model.impexp.AtlasAsyncImportRequest.ImportStatus.FAILED;
 import static 
org.apache.atlas.model.impexp.AtlasImportRequest.TRANSFORMERS_KEY;
 import static org.apache.atlas.model.impexp.AtlasImportRequest.TRANSFORMS_KEY;
+import static 
org.apache.atlas.model.impexp.AtlasImportResult.OperationStatus.SUCCESS;
 
 @Component
-public class ImportService {
+public class ImportService implements AsyncImporter {
     private static final Logger LOG = 
LoggerFactory.getLogger(ImportService.class);
 
     private static final String ATLAS_TYPE_HIVE_TABLE = "hive_table";
+    private static final String OPERATION_STATUS      = "operationStatus";
 
-    private final AtlasTypeDefStore      typeDefStore;
-    private final AtlasTypeRegistry      typeRegistry;
-    private final BulkImporter           bulkImporter;
-    private final AuditsWriter           auditsWriter;
-    private final ImportTransformsShaper importTransformsShaper;
+    private final AtlasTypeDefStore       typeDefStore;
+    private final AtlasTypeRegistry       typeRegistry;
+    private final BulkImporter            bulkImporter;
+    private final AuditsWriter            auditsWriter;
+    private final ImportTransformsShaper  importTransformsShaper;
+    private final AsyncImportTaskExecutor asyncImportTaskExecutor;
+    private final AsyncImportService      asyncImportService;
+    private final AtlasAuditService       auditService;
 
     private final TableReplicationRequestProcessor 
tableReplicationRequestProcessor;
 

Review Comment:
   `ImportService` is a singleton object; `startTimestamp` and `endTimestamp` 
are relevant for a single import request. These shouldn't be instance members; 
instead of they should be traced in the request or result object - to avoid 
potential overwrites from multiple import requests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@atlas.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to