Skip to content

Commit 40f4258

Browse files
Serving sdk changes for supporting snapshot plugins (#778)
* Changes for ddb * Bumped up version to 0.4 Co-authored-by: dhanainme <[email protected]>
1 parent 0eead59 commit 40f4258

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

serving-sdk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>org.pytorch</groupId>
55
<artifactId>torchserve-plugins-sdk</artifactId>
66
<packaging>jar</packaging>
7-
<version>0.0.3</version>
7+
<version>0.0.4</version>
88
<name>torchserve-plugins-sdk</name>
99
<description>
1010
SDK for PyTorch model server plugins
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package org.pytorch.serve.servingsdk.snapshot;
2+
3+
import com.google.gson.JsonObject;
4+
import java.util.Map;
5+
6+
public class Snapshot {
7+
private String name;
8+
private int modelCount;
9+
private long created;
10+
private Map<String, Map<String, JsonObject>> models;
11+
12+
public Snapshot(String snaspshotName, int modelCount) {
13+
this.name = snaspshotName;
14+
this.setModelCount(modelCount);
15+
this.created = System.currentTimeMillis();
16+
}
17+
18+
public String getName() {
19+
return name;
20+
}
21+
22+
public void setName(String name) {
23+
this.name = name;
24+
}
25+
26+
public Map<String, Map<String, JsonObject>> getModels() {
27+
return models;
28+
}
29+
30+
public void setModels(Map<String, Map<String, JsonObject>> models) {
31+
this.models = models;
32+
}
33+
34+
public long getCreated() {
35+
return created;
36+
}
37+
38+
public void setCreated(long created) {
39+
this.created = created;
40+
}
41+
42+
@Override
43+
public String toString() {
44+
return "Checkpoint [name=" + name + ", created=" + created + ", models=" + models + "]";
45+
}
46+
47+
public int getModelCount() {
48+
return modelCount;
49+
}
50+
51+
public void setModelCount(int modelCount) {
52+
this.modelCount = modelCount;
53+
}
54+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.pytorch.serve.servingsdk.snapshot;
2+
3+
import java.io.IOException;
4+
import java.util.Properties;
5+
6+
public interface SnapshotSerializer {
7+
8+
void saveSnapshot(Snapshot snapshot, final Properties prop) throws IOException;
9+
10+
Snapshot getSnapshot(String modelSnapshot) throws IOException;
11+
12+
Properties getLastSnapshot();
13+
}

0 commit comments

Comments
 (0)