Skip to content

Commit

Permalink
Fix filename resolve (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: LCW <[email protected]>
  • Loading branch information
jackkkkklee and LCW committed Oct 22, 2023
1 parent 5a65fd5 commit ccc928e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class ObjectStorageConfig {
private String serviceAccountPath;

// Endpoint of OSS.
@SerializedName("end_point")
@SerializedName("endpoint")
private String endPoint;

// Access key ID of OSS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ private void initConfig() {
if (configPath == null) {
String osType = System.getProperty("os.name").toUpperCase();
if (osType.contains("LINUX")) {
configPath = linuxDefaultConfigPath ;
configPath = linuxDefaultConfigPath + "/" + configFileName ;
} else if (osType.contains("MAC")) {
configPath = System.getProperty("user.home") + darwinDefaultConfigPath ;
configPath = System.getProperty("user.home") + darwinDefaultConfigPath + "/" + configFileName ;
} else {
logger.error("do not support os type :" + osType);
}
}
try {
Gson gson = new Gson();
JsonReader reader = new JsonReader(new FileReader(configPath + "/" + configFileName));
JsonReader reader = new JsonReader(new FileReader(configPath));
dragonflyEndpointConfig = gson.fromJson(reader, DragonflyEndpointConfig.class);
objectStorageConfig = dragonflyEndpointConfig.getObjectStorageConfig();
} catch (JsonParseException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ public StatusResponse downLoadAndRegisterModel(DragonflyModelRequest dragonflyMo
if (modelStore == null) {
throw new ModelNotFoundException("Model store has not been configured.");
}
File modelLocation = new File(modelStore, fileName);
// download file by dragonfly
//download file by dragonfly
String[] nameArray = fileName.split("/");
String stripedFileName = nameArray[nameArray.length - 1];
File modelLocation = new File(modelStore, stripedFileName);
fileLoadUtil.copyURLToFile(fileName, modelLocation);

// register model
//register model
String modelName = dragonflyModelRequest.getModelName();
String runtime = dragonflyModelRequest.getRuntime();
String handler = dragonflyModelRequest.getHandler();
Expand Down

0 comments on commit ccc928e

Please sign in to comment.