Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-4770 Error running migration calculate_pedigree_graph #2314

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,28 @@ public class CalculatePedigreeGraphMigration extends MigrationTool {
protected void run() throws Exception {
MigrationRun migrationRun = getMigrationRun();

// Map study studyFqn -> job
Map<String, Job> jobs = new HashMap<>();
for (JobReferenceParam jobReference : migrationRun.getJobs()) {
Job job = catalogManager.getJobManager().get(jobReference.getStudyId(), jobReference.getId(), new QueryOptions(), token)
.first();
logger.info("Registering job {} for study {} to migrate", job.getId(), job.getStudy().getId());
logger.info("Reading already executed job '{}' for study '{}' with status '{}'",
job.getId(),
job.getStudy().getId(),
job.getInternal().getStatus().getId());
jobs.put(job.getStudy().getId(), job);
}
for (String study : getStudies()) {

Set<String> studies = new LinkedHashSet<>(getStudies());
logger.info("Study IDs (num. total = {}) to initialize pedigree graphs: {}", studies.size(), StringUtils.join(studies, ", "));

// Ensure that studies with already executed jobs are included in the migration run
getMigrationRun().getJobs().forEach(j -> studies.add(j.getStudyId()));

logger.info("Study IDs (num. total = {}) after adding studies from migration jobs: {}", studies.size(),
StringUtils.join(studies, ", "));

for (String study : studies) {
Job job = jobs.get(study);
if (job != null) {
String status = job.getInternal().getStatus().getId();
Expand All @@ -61,8 +75,9 @@ protected void run() throws Exception {
logger.info("Adding new job to migrate/initialize pedigree graph for study {}", study);
ObjectMap params = new ObjectMap()
.append(ParamConstants.STUDY_PARAM, study);
getMigrationRun().addJob(catalogManager.getJobManager().submit(study, PedigreeGraphInitAnalysis.ID, Enums.Priority.MEDIUM,
params, null, null, null, new ArrayList<>(), token).first());
Job newJob = catalogManager.getJobManager().submit(study, PedigreeGraphInitAnalysis.ID, Enums.Priority.MEDIUM,
params, null, null, null, new ArrayList<>(), token).first();
getMigrationRun().addJob(newJob);
}
}

Expand All @@ -73,7 +88,7 @@ public List<String> getStudies() throws CatalogException {
for (Project project : catalogManager.getProjectManager().search(new Query(), projectOptions, token).getResults()) {
if (CollectionUtils.isNotEmpty(project.getStudies())) {
for (Study study : project.getStudies()) {
String id = project.getId() + ":" + study.getId();
String id = study.getFqn();
for (Family family : catalogManager.getFamilyManager().search(id, new Query(), familyOptions, token).getResults()) {
if (PedigreeGraphUtils.hasMinTwoGenerations(family)
&& (family.getPedigreeGraph() == null || StringUtils.isEmpty(family.getPedigreeGraph().getBase64()))) {
Expand Down
Loading