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

migrate analyses vdi ids #88

Merged
merged 17 commits into from
Apr 23, 2024
Merged

migrate analyses vdi ids #88

merged 17 commits into from
Apr 23, 2024

Conversation

dmgaldi
Copy link
Contributor

@dmgaldi dmgaldi commented Apr 18, 2024

Overview

  • Migrate VDI entity and variable IDs in analyses
  • It's a little bit hacky, so feel free to propose alternative approaches.

Testing

  • Ran with write disabled and inspected output.
  • Will test once migration is done in QA.

@dmgaldi dmgaldi requested a review from ryanrdoherty April 18, 2024 22:50
@dmgaldi dmgaldi self-assigned this Apr 18, 2024
Copy link
Member

@ryanrdoherty ryanrdoherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really think we need to consider >1 entityId per descriptor.

readVdiMappingFile(tinyDbFile);

// Default to dryrun to avoid incidental migrations when testing.
_writeToDb = Boolean.parseBoolean(args.getOrDefault("-write", "false"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have the double dash to be like the other args?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fixed

.map(match -> match.group(1))
.collect(Collectors.toSet());

final String entityId = ENTITY_ID_PATTERN.matcher(descriptor).results()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure there's only one here? We could easily have a config with >1 variable spec, each of which might contain a different entity ID, especially across different visualizations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's only one entity allowed in ISA simple studies


return new TableRowInterfaces.RowResult<>(nextRow)
// Create a copy with just the dataset ID updated to VDI counterpart.
AnalysisRow out = new AnalysisRow(nextRow.getAnalysisId(), vdiDatasetId, new JSONObject(descriptor),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just use setters to assign dataset ID and descriptor here, but probably not much more expensive given the work above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use setters instead.

AnalysisRow out = new AnalysisRow(nextRow.getAnalysisId(), vdiDatasetId, new JSONObject(descriptor),
nextRow.getNumFilters(), nextRow.getNumComputations(), nextRow.getNumVisualizations());

LOG.info("Analysis descriptor after migration: " + out);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're dumping the AnalysisRow here; might have a decent toString() but isn't necessarily good for comparing to the "before" log line above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, meant to log just the descriptor.

@dmgaldi dmgaldi requested a review from ryanrdoherty April 22, 2024 17:25
@dmgaldi dmgaldi merged commit e927376 into master Apr 23, 2024
1 check passed
@dmgaldi dmgaldi deleted the migrate-analyses-vdi-ids branch April 23, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants