phet commented on code in PR #3878:
URL: https://github.com/apache/gobblin/pull/3878#discussion_r1490508747


##########
gobblin-service/src/main/java/org/apache/gobblin/service/modules/orchestration/MostlyInMemoryDagManagementStateStore.java:
##########
@@ -130,44 +122,42 @@ public Set<String> getFailedDagIds() throws IOException {
   }
 
   @Override
-  public synchronized void deleteDagNodeState(String dagId, 
Dag.DagNode<JobExecutionPlan> dagNode) {
+  public synchronized void deleteDagNodeState(DagManager.DagId dagId, 
Dag.DagNode<JobExecutionPlan> dagNode) {
+    String dagIdStr = dagId.toString();
     this.jobToDag.remove(dagNode);
     this.dagNodes.remove(dagNode.getValue().getId());
-    this.dagToDeadline.remove(dagId);
-    this.dagToJobs.get(dagId).remove(dagNode);
-    if (this.dagToJobs.get(dagId).isEmpty()) {
-      this.dagToJobs.remove(dagId);
+    this.dagToDeadline.remove(dagIdStr);
+    this.dagToJobs.get(dagIdStr).remove(dagNode);
+    if (this.dagToJobs.get(dagIdStr).isEmpty()) {
+      this.dagToJobs.remove(dagIdStr);
     }
   }
 
   @Override
-  public synchronized void addDagNodeState(String dagId, 
Dag.DagNode<JobExecutionPlan> dagNode) {
-    Dag<JobExecutionPlan> dag = this.dags.get(dagId);
+  public synchronized void addDagNodeState(DagManager.DagId dagId, 
Dag.DagNode<JobExecutionPlan> dagNode)
+      throws IOException {
+    String dagIdStr = dagId.toString();
+    Dag<JobExecutionPlan> dag = getDag(dagId);
     this.jobToDag.put(dagNode, dag);
     this.dagNodes.put(dagNode.getValue().getId(), dagNode);
-    if (!this.dagToJobs.containsKey(dagId)) {
-      this.dagToJobs.put(dagId, Lists.newLinkedList());
+    if (!this.dagToJobs.containsKey(dagIdStr)) {
+      this.dagToJobs.put(dagIdStr, Lists.newLinkedList());
     }
-    this.dagToJobs.get(dagId).add(dagNode);
-  }
-
-  @Override
-  public Dag<JobExecutionPlan> getDag(DagManager.DagId dagId) {
-    return this.dags.get(dagId.toString());
+    this.dagToJobs.get(dagIdStr).add(dagNode);
   }
 
   @Override
-  public void addDag(Dag<JobExecutionPlan> dag) {
-    this.dags.put(DagManagerUtils.generateDagId(dag).toString(), dag);
+  public Dag<JobExecutionPlan> getDag(DagManager.DagId dagId) throws 
IOException {
+    return this.dagStateStore.getDag(dagId.toString());
   }
 
   @Override
-  public boolean containsDag(String dagId) {
-    return this.dags.containsKey(dagId);
+  public boolean containsDag(DagManager.DagId dagId) throws IOException {
+    return this.dagStateStore.existsDag(dagId.toString());

Review Comment:
   `DagId` seems the better param type for the `DagStateStore` methods than 
`String`.  I suggest we move to that by making default methods in the DSS 
interface that call `.toString()` there, within the interface itself, rather 
than here
   
   then either as part of this PR or leave a TODO to deprecate the `String 
dagId` forms



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to