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

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

                Author: ASF GitHub Bot
            Created on: 04/Apr/24 22:09
            Start Date: 04/Apr/24 22:09
    Worklog Time Spent: 10m 
      Work Description: phet commented on code in PR #3901:
URL: https://github.com/apache/gobblin/pull/3901#discussion_r1552501071


##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/proc/KillDagProc.java:
##########
@@ -0,0 +1,125 @@
+/*
+ * 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.modules.orchestration.proc;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Properties;
+import java.util.concurrent.Future;
+
+import org.apache.directory.api.util.Strings;
+
+import com.google.common.collect.Maps;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+import org.apache.gobblin.metrics.event.TimingEvent;
+import org.apache.gobblin.service.modules.flowgraph.Dag;
+import org.apache.gobblin.service.modules.flowgraph.DagNodeId;
+import 
org.apache.gobblin.service.modules.orchestration.DagManagementStateStore;
+import org.apache.gobblin.service.modules.orchestration.DagManagerUtils;
+import org.apache.gobblin.service.modules.orchestration.TimingEventUtils;
+import org.apache.gobblin.service.modules.orchestration.task.KillDagTask;
+import org.apache.gobblin.service.modules.spec.JobExecutionPlan;
+
+import static org.apache.gobblin.service.ExecutionStatus.CANCELLED;
+
+
+/**
+ * An implementation for {@link DagProc} that kills all the nodes of a dag.
+ * If the dag action has job name set, then it kills only that particular 
job/dagNode.
+ */
+@Slf4j
+public class KillDagProc extends DagProc<Optional<Dag<JobExecutionPlan>>> {
+  private final Optional<DagNodeId> dagNodeId;
+
+  public KillDagProc(KillDagTask killDagTask) {
+    super(killDagTask);
+    this.dagNodeId = Strings.isEmpty(this.dagTask.getDagAction().getJobName())
+        ? Optional.empty()
+        : Optional.of(new 
DagNodeId(this.dagTask.getDagAction().getFlowGroup(), 
this.dagTask.getDagAction().getFlowName(),
+        Long.parseLong(this.dagTask.getDagAction().getFlowExecutionId()),
+        this.dagTask.getDagAction().getFlowGroup(), 
this.dagTask.getDagAction().getJobName()));

Review Comment:
   didn't we recently add a way to convert a `DagAction` into a `DagNodeId`?  
(I'd prefer more abstraction here)





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

    Worklog Id:     (was: 913097)
    Time Spent: 0.5h  (was: 20m)

> create dag proc that can kill dags/dag nodes
> --------------------------------------------
>
>                 Key: GOBBLIN-2023
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-2023
>             Project: Apache Gobblin
>          Issue Type: Task
>            Reporter: Arjun Singh Bora
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to