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

auto detect latest ARDC versions #170

Merged
merged 8 commits into from
Dec 10, 2024
Merged

Conversation

vietnguyengit
Copy link
Contributor

No description provided.

@vietnguyengit vietnguyengit marked this pull request as draft December 3, 2024 02:48
@vietnguyengit
Copy link
Contributor Author

put back to draft: try to implement this for other ticket:

If there are version change, download it else do not need to evict cache

https://github.com/aodn/backlog/issues/6029

@vietnguyengit vietnguyengit marked this pull request as ready for review December 3, 2024 05:18
@vietnguyengit vietnguyengit force-pushed the features/6028-versioning branch from 02d0756 to 137366b Compare December 9, 2024 05:17
Comment on lines +7 to +10
"/aodn-parameter-category-vocabulary/%s/concept.json",
"/aodn-parameter-category-vocabulary/%s/resource.json?uri=%s",
"/aodn-discovery-parameter-vocabulary/%s/concept.json",
"/aodn-discovery-parameter-vocabulary/%s/resource.json?uri=%s"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

although I could replace version directly with current, writing tests is a bit headache, after debugging I found that links like this for example:

https://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-vocabulary/current/concept.json
or
https://vocabs.ardc.edu.au/repository/api/lda/aodn/aodn-platform-vocabulary/current/concept.json?_page=1

the next and prev fields refer to paths with specific version instead of current.

So less complex tests and later on ... check if there are versions change to update caches, I keep this template enum, and have separate method for extracting latest specific versions from current, current is just a starting point wrapper.

Comment on lines +66 to +69
synchronized (this) {
storedResolvedPathCollection = latestResolvedPathCollection;
log.info("Updated storedResolvedPathCollection with the latest data.");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I attempted to update each vocabulary with the associated specific version, but it seems unnecessary for the purpose of checking if there are version changes from the current context.

This one works with similar logic: upon bean creation, the initial collection of versions is gathered. The cron job will then scan and check if the initial collection of versions has changed. If so, it will make the latest versions the head (update storedResolvedPathCollection), repopulate the vocabularies, and update the associated caches.

Copy link
Contributor

@utas-raymondng utas-raymondng left a comment

Choose a reason for hiding this comment

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

LGTM

for (ArdcRootPaths rootPath : ArdcRootPaths.values()) {
try {
// Fetch HTML contents for category and vocab
String categoryRootHtmlContent = fetchHtmlContent(rootPath.getCategoryRoot());
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a json version instead of HTML?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just for recording purpose which I mentioned to @vietnguyengit , you can use the word "current" instead of version in the restapi, so it points to the latest, from the you can check the json's version and decide if you need to download a new one

@utas-raymondng utas-raymondng merged commit 91b1b11 into main Dec 10, 2024
2 checks passed
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