[ 
https://issues.apache.org/jira/browse/GOBBLIN-988?focusedWorklogId=353953&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-353953
 ]

ASF GitHub Bot logged work on GOBBLIN-988:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Dec/19 00:37
            Start Date: 05/Dec/19 00:37
    Worklog Time Spent: 10m 
      Work Description: autumnust commented on pull request #2834: 
[GOBBLIN-988] Implement LocalFSJobStatusRetriever
URL: https://github.com/apache/incubator-gobblin/pull/2834#discussion_r354058775
 
 

 ##########
 File path: 
gobblin-service/src/main/java/org/apache/gobblin/service/monitoring/LocalFsJobStatusRetriever.java
 ##########
 @@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gobblin.service.monitoring;
+
+import com.google.common.base.Preconditions;
+
+import com.google.common.collect.Iterators;
+import com.typesafe.config.Config;
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.gobblin.configuration.State;
+import org.apache.gobblin.metastore.StateStore;
+import org.apache.gobblin.runtime.spec_executorInstance.LocalFsSpecProducer;
+import org.apache.gobblin.service.ExecutionStatus;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+@Slf4j
+public class LocalFsJobStatusRetriever extends JobStatusRetriever {
+
+  public static final String CONF_PREFIX = "localFsJobStatusRetriever";
+  private String specProducerPath;
+
+  // Do not use a state store for this implementation, just look at the job 
folder that @LocalFsSpecProducer writes to
+  public LocalFsJobStatusRetriever(Config config) {
+    this.specProducerPath = 
config.getString(LocalFsSpecProducer.LOCAL_FS_PRODUCER_PATH_KEY);
+  }
+
+  private Boolean isJobPending(String flowName, String flowGroup, long 
flowExecutionId) {
+    // Local FS has no monitor to update job state yet, for now check if 
standalone is completed with job, and mark as done
+    // Otherwise the job is pending
+    try {
+      String fileName = LocalFsSpecProducer.getJobFileName(new 
URI(File.separatorChar + flowGroup + File.separatorChar + flowName), 
String.valueOf(flowExecutionId));
+      return new File(this.specProducerPath + File.separatorChar + 
fileName).exists();
+    } catch (URISyntaxException e) {
+      log.error("URISyntaxException occurred when retrieving job status for 
flow: {},{}", flowGroup, flowName, e);
+    }
+    return false;
+  }
+
+  private Boolean isJobDone(String flowName, String flowGroup, long 
flowExecutionId) {
+    // Local FS has no monitor to update job state yet, for now check if 
standalone is completed with job, and mark as done
+    // Otherwise the job is pending
+    try {
+      String fileName = LocalFsSpecProducer.getJobFileName(new 
URI(File.separatorChar + flowGroup + File.separatorChar + flowName), 
String.valueOf(flowExecutionId));
+      return new File(this.specProducerPath + File.separatorChar + fileName + 
".done").exists();
+    } catch (URISyntaxException e) {
+      log.error("URISyntaxException occurred when retrieving job status for 
flow: {},{}", flowGroup, flowName, e);
+    }
+    return false;
+  }
+
+  @Override
+  public Iterator<JobStatus> getJobStatusesForFlowExecution(String flowName, 
String flowGroup, long flowExecutionId) {
 
 Review comment:
   Can this method be implemented by calling `getJobStatusesForFlowExecution ` 
with dummy value of `jobName` and `jobGroup` instead ?
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 353953)

> Create Local FS Job Status Retriever
> ------------------------------------
>
>                 Key: GOBBLIN-988
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-988
>             Project: Apache Gobblin
>          Issue Type: New Feature
>            Reporter: William Lo
>            Priority: Minor
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> GaaS currently only supports Kafka to monitor job status in the dagManager.
> Create a simple jobstatusmonitor that can track completed jobs in gobblin 
> standalone.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to