zxcware commented on a change in pull request #2755: [GOBBLIN-897] adds local 
FS spec executor to write jobs to a local dir
URL: https://github.com/apache/incubator-gobblin/pull/2755#discussion_r342724920
 
 

 ##########
 File path: 
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_executorInstance/LocalFsSpecProducer.java
 ##########
 @@ -94,7 +96,14 @@ public LocalFsSpecProducer(Config config) {
    * @param headers*/
   @Override
   public Future<?> deleteSpec(URI deletedSpecURI, Properties headers) {
-    return new CompletedFuture<>(Boolean.TRUE, null);
+    String[] uriTokens = deletedSpecURI.getPath().split("/");
+    String jobFileName = String.join("_", uriTokens) + ".job";
+    File file = new File(jobFileName);
+    if (file.delete()) {
+      log.info("Deleted spec: {}", jobFileName);
+      return new CompletedFuture<>(Boolean.TRUE, null);
+    }
+    throw new RuntimeException(String.format("Failed to delete file with uri 
%s", deletedSpecURI));
 
 Review comment:
   This shouldn't halt the service, return a `CompletedFuture` with an 
exception and expect the invoker to do proper error handling.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to