-
Notifications
You must be signed in to change notification settings - Fork 73
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
Remove rcf jar and fix zip fetching for AD and JS #497
Changes from all commits
75c37bd
cde2f39
90f99b7
f216a98
c0fb117
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,13 +34,16 @@ | |
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.nio.charset.Charset; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
import java.security.AccessController; | ||
import java.security.PrivilegedAction; | ||
import java.time.Clock; | ||
import java.time.Instant; | ||
import java.time.Month; | ||
import java.time.OffsetDateTime; | ||
import java.time.ZoneOffset; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
|
@@ -109,7 +112,7 @@ | |
import com.amazon.randomcutforest.parkservices.ThresholdedRandomCutForest; | ||
import com.amazon.randomcutforest.parkservices.state.ThresholdedRandomCutForestMapper; | ||
import com.amazon.randomcutforest.parkservices.state.ThresholdedRandomCutForestState; | ||
import com.amazon.randomcutforest.serialize.json.v1.V1JsonToV2StateConverter; | ||
import com.amazon.randomcutforest.serialize.json.v1.V1JsonToV3StateConverter; | ||
import com.amazon.randomcutforest.state.RandomCutForestMapper; | ||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
|
@@ -154,7 +157,7 @@ public class CheckpointDaoTests extends OpenSearchTestCase { | |
private GenericObjectPool<LinkedBuffer> serializeRCFBufferPool; | ||
private RandomCutForestMapper mapper; | ||
private ThresholdedRandomCutForestMapper trcfMapper; | ||
private V1JsonToV2StateConverter converter; | ||
private V1JsonToV3StateConverter converter; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is also a V2StateToV3ForestConverter. We need to convert from v1 to v3, v2 to v3. If v2 and v3 are incompatible, we need to add a field modelV3 in checkpoint. |
||
double anomalyRate; | ||
|
||
@Before | ||
|
@@ -180,7 +183,7 @@ public void setup() { | |
.getSchema(ThresholdedRandomCutForestState.class) | ||
); | ||
|
||
converter = new V1JsonToV2StateConverter(); | ||
converter = new V1JsonToV3StateConverter(); | ||
|
||
serializeRCFBufferPool = spy(AccessController.doPrivileged(new PrivilegedAction<GenericObjectPool<LinkedBuffer>>() { | ||
@Override | ||
|
@@ -1000,4 +1003,14 @@ private double[] getPoint(int dimensions, Random random) { | |
} | ||
return point; | ||
} | ||
// .parseReader(new FileReader(new File(getClass().getResource(labalFileName).toURI()), Charset.defaultCharset())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will remove |
||
|
||
public void testDeserializeRCFModel() throws Exception { | ||
// Model in file 1_3_0_rcf_model.json not passed initialization yet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it means the model is empty? If yes, have you tested model fully initialized? |
||
String filePath = getClass().getResource("1_3_0_rcf_model.json").getPath(); | ||
String json = Files.readString(Paths.get(filePath), Charset.defaultCharset()); | ||
Map map = gson.fromJson(json, Map.class); | ||
String model = (String) ((Map) ((Map) ((ArrayList) ((Map) map.get("hits")).get("hits")).get(0)).get("_source")).get("modelV2"); | ||
ThresholdedRandomCutForest forest = checkpointDao.toTrcf(model); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add checks on the specific fields of trcf. Please check my other tests. |
||
} | ||
} |
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you list the tests you have done to upgrade to rc2? What I can think of:
V1 refers to the checkpoint version we have used until #149. v2 is what we have until your PR. v3 is what your PR tries to bring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested single stream real time and historical, I'll do the same for HCAD right now. BWC test were the test added based on Yaliang's code to check deserialize model from 1.3. And converting test to v1 to v3, I didn't add v2 to v3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unit tests for bwc is not enough. It just checks the conversion has no exception. We will need to do some e2e testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I manually tested that after starting both single and HCAD (both real time and historical) with current RCF and getting results, I can switch to RCF 3.0-rc2 and there is no issues, detectors continue to run the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After letting the detector run for longer I do get one issue,
Failed to generate checkpoint, java.lang.IllegalStateException: There is discepancy in indices