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

EVA-3227 Match metadata files info with uploaded files #15

Merged
merged 3 commits into from
Jul 16, 2024

Conversation

nitin-ebi
Copy link
Collaborator

No description provided.

@nitin-ebi nitin-ebi self-assigned this Jul 15, 2024
Copy link
Member

@tcezard tcezard left a comment

Choose a reason for hiding this comment

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

Looks good, left some optional comments

System.out.printf("Directory %s listed successfully%n", submissionDirPath);
return response.getBody();
} else {
System.out.printf("Failed to retrieve directory '%s': %s", submissionDirPath, response.getStatusCode());
Copy link
Member

Choose a reason for hiding this comment

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

Should we not log rather than print out ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

apologies copy paste mistake.. updated

Comment on lines +114 to +131
String uploadedFilesInfo = globusDirectoryProvisioner.listSubmittedFiles(directoryToList);
if (uploadedFilesInfo.isEmpty()) {
throw new MetadataFileInfoMismatchException("Failed to retrieve any file info from submission directory.");
} else {
Map<String, Long> globusFileInfo = new HashMap<>();
try {
ObjectMapper mapper = new ObjectMapper();
ObjectNode globusFileInfoJson = (ObjectNode) mapper.readTree(uploadedFilesInfo);
if (globusFileInfoJson.get(GLOBUS_FILES_TAG) != null) {
globusFileInfo = StreamSupport.stream(globusFileInfoJson.get(GLOBUS_FILES_TAG).spliterator(), false)
.collect(Collectors.toMap(
dataNode -> dataNode.get(GLOBUS_FILE_NAME).asText(),
dataNode -> dataNode.get(GLOBUS_FILE_SIZE).asLong()
));
}
} catch (JsonProcessingException ex) {
throw new MetadataFileInfoMismatchException("Error parsing fileInfo from Submission Directory");
}
Copy link
Member

Choose a reason for hiding this comment

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

Opinion: I feel like this code should be in GlobusDirectoryProvisioner.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IMHO this is not the core responsibility of GlobusDirectoryProvisioner. It should just be responsible for retrieving the dir/file details. The checking of missing files or file size mismatches should be done outside.

@nitin-ebi nitin-ebi merged commit 5c99a98 into EBIvariation:main Jul 16, 2024
1 check 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.

3 participants