Skip to content
Snippets Groups Projects
Commit 032c9a56 authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

handle gmm priming

parent a8d423b1
No related branches found
No related tags found
1 merge request!816GMM Services
......@@ -57,36 +57,40 @@ public class PrimingResource implements OrderedResource {
@Value("${nshmp-haz.model-path}")
private Path modelPath;
@Value("${nshmp-haz.gmm}")
private boolean gmmDeploy;
@Override
public void beforeCheckpoint(Context<? extends Resource> context) throws Exception {
var model = ServletUtil.loadModel(modelPath);
ServletUtil.model(model);
updateParameter();
if (!gmmDeploy) {
var region = Regions.createRectangular("Bounds", model.bounds().min, model.bounds().max);
var region = Regions.createRectangular("Bounds", model.bounds().min, model.bounds().max);
try (MicronautLambdaHandler handler = new MicronautLambdaHandler()) {
var paths = List.of("/hazard", "/disagg");
try (MicronautLambdaHandler handler = new MicronautLambdaHandler()) {
var paths = List.of("/hazard", "/disagg");
paths.forEach(path -> {
handler.handleRequest(
getAwsProxyRequest(path, Optional.empty()),
new MockLambdaContext());
});
paths.forEach(path -> {
LOCATIONS.forEach(namedLocation -> {
var location = namedLocation.location();
paths.forEach(path -> {
handler.handleRequest(
getAwsProxyRequest(path, Optional.empty()),
new MockLambdaContext());
});
if (region.contains(location)) {
handler.handleRequest(
getAwsProxyRequest(
String.format("%s/%f/%f/760", path, location.longitude, location.latitude),
Optional.of(Imt.PGA)),
new MockLambdaContext());
}
paths.forEach(path -> {
LOCATIONS.forEach(namedLocation -> {
var location = namedLocation.location();
if (region.contains(location)) {
handler.handleRequest(
getAwsProxyRequest(
String.format("%s/%f/%f/760", path, location.longitude, location.latitude),
Optional.of(Imt.PGA)),
new MockLambdaContext());
}
});
});
});
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment