-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
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"); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
No description provided.