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

Fix filename resolve #11

Merged
merged 7 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
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 @@ -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 @@ -54,7 +54,7 @@ public class DragonflyUtils implements FileLoadUtils {

private static final Logger logger = LoggerFactory.getLogger(DragonflyUtils.class);

private static final String configFileName = "dragonfly_endpoint.json";
private static final String configFileName = "config.json";

private String configPath;

Expand Down 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
Loading