-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove incomplete iterations from subflows (#699)
- Loading branch information
1 parent
0e04bfb
commit ad34c3c
Showing
5 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/java/org/ilgcc/app/submission/actions/RemoveIncompleteChildIterations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.ilgcc.app.submission.actions; | ||
|
||
import static java.util.Collections.emptyList; | ||
|
||
import formflow.library.config.submission.Action; | ||
import formflow.library.data.Submission; | ||
import formflow.library.data.SubmissionRepositoryService; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
public class RemoveIncompleteChildIterations implements Action { | ||
|
||
private final SubmissionRepositoryService submissionRepositoryService; | ||
|
||
public RemoveIncompleteChildIterations(SubmissionRepositoryService submissionRepositoryService) { | ||
this.submissionRepositoryService = submissionRepositoryService; | ||
} | ||
|
||
@Override | ||
public void run(Submission submission) { | ||
var subflowData = (List<Map<String, Object>>) submission.getInputData().getOrDefault("children", emptyList()); | ||
if (!subflowData.isEmpty()) { | ||
log.info("Removing incomplete child iterations from submission {}", submission.getId()); | ||
subflowData.removeIf(childIteration -> !(boolean) childIteration.getOrDefault("iterationIsComplete", false)); | ||
submissionRepositoryService.save(submission); | ||
} | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
src/main/java/org/ilgcc/app/submission/actions/RemoveIncompleteJobIterations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.ilgcc.app.submission.actions; | ||
|
||
import static java.util.Collections.emptyList; | ||
|
||
import formflow.library.config.submission.Action; | ||
import formflow.library.data.Submission; | ||
import formflow.library.data.SubmissionRepositoryService; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
public class RemoveIncompleteJobIterations implements Action { | ||
|
||
private final SubmissionRepositoryService submissionRepositoryService; | ||
|
||
public RemoveIncompleteJobIterations(SubmissionRepositoryService submissionRepositoryService) { | ||
this.submissionRepositoryService = submissionRepositoryService; | ||
} | ||
|
||
@Override | ||
public void run(Submission submission) { | ||
var subflowData = (List<Map<String, Object>>) submission.getInputData().getOrDefault("jobs", emptyList()); | ||
if (!subflowData.isEmpty()) { | ||
log.info("Removing incomplete job iterations from submission {}", submission.getId()); | ||
subflowData.removeIf(job -> !(boolean) job.getOrDefault("iterationIsComplete", false)); | ||
submissionRepositoryService.save(submission); | ||
} | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
src/main/java/org/ilgcc/app/submission/actions/RemoveIncompletePartnerJobIterations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.ilgcc.app.submission.actions; | ||
|
||
import static java.util.Collections.emptyList; | ||
|
||
import formflow.library.config.submission.Action; | ||
import formflow.library.data.Submission; | ||
import formflow.library.data.SubmissionRepositoryService; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
public class RemoveIncompletePartnerJobIterations implements Action { | ||
|
||
private final SubmissionRepositoryService submissionRepositoryService; | ||
|
||
public RemoveIncompletePartnerJobIterations(SubmissionRepositoryService submissionRepositoryService) { | ||
this.submissionRepositoryService = submissionRepositoryService; | ||
} | ||
|
||
@Override | ||
public void run(Submission submission) { | ||
var subflowData = (List<Map<String, Object>>) submission.getInputData().getOrDefault("partnerJobs", emptyList()); | ||
if (!subflowData.isEmpty()) { | ||
log.info("Removing incomplete partner job iterations from submission {}", submission.getId()); | ||
subflowData.removeIf(partnerJob -> !(boolean) partnerJob.getOrDefault("iterationIsComplete", false)); | ||
submissionRepositoryService.save(submission); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters