19
19
20
20
import java .io .IOException ;
21
21
import java .net .URI ;
22
+ import java .sql .SQLException ;
22
23
import java .util .Collection ;
23
24
import java .util .List ;
24
25
import java .util .Optional ;
@@ -146,12 +147,6 @@ default void deleteFailedDag(Dag<JobExecutionPlan> dag) throws IOException {
146
147
*/
147
148
List <Dag .DagNode <JobExecutionPlan >> getDagNodes (DagManager .DagId dagId ) throws IOException ;
148
149
149
- /**
150
- * Returns the {@link Dag} the provided {@link org.apache.gobblin.service.modules.flowgraph.Dag.DagNode} belongs to
151
- * or Optional.absent if it is not found.
152
- */
153
- Optional <Dag <JobExecutionPlan >> getParentDag (Dag .DagNode <JobExecutionPlan > dagNode );
154
-
155
150
/**
156
151
* Deletes the dag node state that was added through {@link DagManagementStateStore#addDagNodeState(Dag.DagNode, DagManager.DagId)}
157
152
* No-op if the dag node is not found in the store.
@@ -201,4 +196,77 @@ default void deleteFailedDag(Dag<JobExecutionPlan> dag) throws IOException {
201
196
* has any running job, false otherwise.
202
197
*/
203
198
public boolean hasRunningJobs (DagManager .DagId dagId );
199
+
200
+ /**
201
+ * Check if an action exists in dagAction store by flow group, flow name, flow execution id, and job name.
202
+ * @param flowGroup flow group for the dag action
203
+ * @param flowName flow name for the dag action
204
+ * @param flowExecutionId flow execution for the dag action
205
+ * @param jobName job name for the dag action
206
+ * @param dagActionType the value of the dag action
207
+ * @throws IOException
208
+ */
209
+ boolean existsJobDagAction (String flowGroup , String flowName , String flowExecutionId , String jobName ,
210
+ DagActionStore .DagActionType dagActionType ) throws IOException , SQLException ;
211
+
212
+ /**
213
+ * Check if an action exists in dagAction store by flow group, flow name, and flow execution id, it assumes jobName is
214
+ * empty ("").
215
+ * @param flowGroup flow group for the dag action
216
+ * @param flowName flow name for the dag action
217
+ * @param flowExecutionId flow execution for the dag action
218
+ * @param dagActionType the value of the dag action
219
+ * @throws IOException
220
+ */
221
+ boolean existsFlowDagAction (String flowGroup , String flowName , String flowExecutionId ,
222
+ DagActionStore .DagActionType dagActionType ) throws IOException , SQLException ;
223
+
224
+ /** Persist the {@link DagActionStore.DagAction} in {@link DagActionStore} for durability */
225
+ default void addDagAction (DagActionStore .DagAction dagAction ) throws IOException {
226
+ addJobDagAction (
227
+ dagAction .getFlowGroup (),
228
+ dagAction .getFlowName (),
229
+ dagAction .getFlowExecutionId (),
230
+ dagAction .getJobName (),
231
+ dagAction .getDagActionType ());
232
+ }
233
+
234
+ /**
235
+ * Persist the dag action in {@link DagActionStore} for durability
236
+ * @param flowGroup flow group for the dag action
237
+ * @param flowName flow name for the dag action
238
+ * @param flowExecutionId flow execution for the dag action
239
+ * @param jobName job name for the dag action
240
+ * @param dagActionType the value of the dag action
241
+ * @throws IOException
242
+ */
243
+ void addJobDagAction (String flowGroup , String flowName , String flowExecutionId , String jobName ,
244
+ DagActionStore .DagActionType dagActionType ) throws IOException ;
245
+
246
+ /**
247
+ * Persist the dag action in {@link DagActionStore} for durability. This method assumes an empty jobName.
248
+ * @param flowGroup flow group for the dag action
249
+ * @param flowName flow name for the dag action
250
+ * @param flowExecutionId flow execution for the dag action
251
+ * @param dagActionType the value of the dag action
252
+ * @throws IOException
253
+ */
254
+ default void addFlowDagAction (String flowGroup , String flowName , String flowExecutionId ,
255
+ DagActionStore .DagActionType dagActionType ) throws IOException {
256
+ addDagAction (DagActionStore .DagAction .forFlow (flowGroup , flowName , flowExecutionId , dagActionType ));
257
+ }
258
+
259
+ /**
260
+ * delete the dag action from {@link DagActionStore}
261
+ * @param dagAction containing all information needed to identify dag and specific action value
262
+ * @throws IOException
263
+ * @return true if we successfully delete one record, return false if the record does not exist
264
+ */
265
+ boolean deleteDagAction (DagActionStore .DagAction dagAction ) throws IOException ;
266
+
267
+ /***
268
+ * Get all {@link DagActionStore.DagAction}s from the {@link DagActionStore}.
269
+ * @throws IOException Exception in retrieving {@link DagActionStore.DagAction}s.
270
+ */
271
+ Collection <DagActionStore .DagAction > getDagActions () throws IOException ;
204
272
}
0 commit comments