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

Ensure "lstm" Folder exists #2913

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,20 @@
*/
public static void save(HyperParameters hyperParameters) {
String modelName = hyperParameters.getModelName();
String filePath = Paths.get(MODEL_DIRECTORY, MODEL_FOLDER, modelName)//
String directoryPath = Paths.get(MODEL_DIRECTORY, MODEL_FOLDER) //

Check warning on line 47 in io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java

View check run for this annotation

Codecov / codecov/patch

io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java#L47

Added line #L47 was not covered by tests
.toString();
String filePath = Paths.get(directoryPath, modelName)//
.toString();

Check warning on line 50 in io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java

View check run for this annotation

Codecov / codecov/patch

io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java#L49-L50

Added lines #L49 - L50 were not covered by tests

// Ensure the directory exists
File directory = new File(directoryPath);

Check warning on line 53 in io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java

View check run for this annotation

Codecov / codecov/patch

io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java#L53

Added line #L53 was not covered by tests
if (!directory.exists()) {
boolean dirCreated = directory.mkdirs();

Check warning on line 55 in io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java

View check run for this annotation

Codecov / codecov/patch

io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java#L55

Added line #L55 was not covered by tests
if (!dirCreated) {
System.err.println("Failed to create directory: " + directoryPath);
return;

Check warning on line 58 in io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java

View check run for this annotation

Codecov / codecov/patch

io.openems.edge.predictor.lstm/src/io/openems/edge/predictor/lstm/common/ReadAndSaveModels.java#L57-L58

Added lines #L57 - L58 were not covered by tests
}
}

Gson gson = new GsonBuilder()//
.registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeAdapter())//
Expand Down
Loading