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

Final Review #6

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

Final Review #6

wants to merge 33 commits into from

Conversation

axlbonnet
Copy link
Contributor

No description provided.

sandepat and others added 30 commits July 19, 2023 09:28
1. Insert data into workflowdb dabatase
2. Create output directory (with date/time stamp)
3. Several imrpvements on json and xml parsing.
4. Updated job monitoring
5. Updated iteration strategies
6. Updated arguments to include and workflowId and match with the command line arguments
Updated Moteurlite.java for the review comments
1. Combined setter methods into corresponding getter methods, eliminating the need for class-level variables.
2. The class now directly returns the parsed values when needed.
1. Modified the constructor to directly use the refactored getter methods of BoutiquesService.
2. This makes the class more streamlined by fetching values directly without maintaining class-level variables.
3. createJob method - Instead of passing arguments to this method, created class level fields and used inside the method.
1. Updated the boutiques parsing classes.
2. Updated moteurlite class
3. Updated InputFileParser class
Copy link
Contributor Author

@axlbonnet axlbonnet left a comment

Choose a reason for hiding this comment

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

Here is a new review.
Please do a new PR on develop taking it into account.

*
*/

public class InputDownloads {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Merge the 3 files :

  • InputDownloads
  • InputParser
  • InputsFileParser

into a single Class InputsFileService

}
}
} catch (Exception e) {
e.printStackTrace();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do not catch all Exception, only the ones necessary.
Either :

  • log with a logger and rethrow a custom Exception
  • do not catch it and let it bubble up

* This method parses the types of inputs from the XML file and returns a Map where the key is
* the source name and the value is the type of the input (e.g., String, URI).
*/
public static Map<String, String> parseInputType(String fileName) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not used, can be deleted

return inputsMap;
}

public Map<String, String> getInputTypeMap() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The 3 last methods are not used and can be deleted.

}

// Fetch download files using InputsFileParser
List<URI> downloads = InputsFileParser.getDownloadFiles(inputsMap);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of parsing each value for a specific regex, we should rely on the File types in the boutiques files to build the list of downloads.

value = new File(System.getProperty("user.dir")).toURI().relativize(new File(value).toURI()).getPath();
URI uri = new URI(value);
String basename = Paths.get(uri.getPath()).getFileName().toString();
jsonNode.put(key, basename);
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 get that we want to extract the filename from value.
I would do Paths.get(new URI(value).getPath()).getFileName(). To test

else {
URI uri = new URI(value);
String basename = Paths.get(uri.getPath()).getFileName().toString();
jsonNode.put(key, basename);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Normally the else case here is for simple Strings. Why not put the value in the jsonNode ?

String type = map2.get(key);

if ("Integer".equals(type) || "Number".equals(type)) {
jsonNode.put(key, Integer.parseInt(value));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Boutiques only support Number, and that can be a float.

URI resultsDirectoryURI = new URI(inputsMap.get("results-directory"));

// Use BoutiquesService to fetch the input types
String invocationString = CreateInvocation.convertMapToJson(invocation, boutiquesService.getInputType(descriptor));
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 think we can move the convertMapToJson method in this class. It will be short.

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