refactor(core): remove Lambda and SageMaker epoch forwarders (#7207)

This commit is contained in:
Jimmy Liu Jia authored and GitHub committed 2026-11-01 14:57:34 -04:00
1 parent a712e5123b
commit 3a35ce5799
3 files changed
+37 -32

No files matched your search

@@ -27,7 +27,6 @@ import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import java.time.Instant;
import java.util.List;
import java.util.Map;
@@ -336,7 +335,7 @@ public class LambdaMicrovmsController {
ObjectNode node = objectMapper.createObjectNode();
node.put("name", image.name);
node.put("imageArn", image.imageArn);
node.put("createdAt", epoch(image.createdAt));
node.put("createdAt", EpochSeconds.fromInstant(image.createdAt));
boolean detail = shape == ImageShape.CREATE || shape == ImageShape.UPDATE;
// A mutation reports the state it is entering, not the one it left.
@@ -368,7 +367,7 @@ public class LambdaMicrovmsController {
// updatedAt is on everything but the list item.
if (shape != ImageShape.LIST) {
node.put("updatedAt", epoch(image.updatedAt));
node.put("updatedAt", EpochSeconds.fromInstant(image.updatedAt));
}
if (detail) {
@@ -409,8 +408,8 @@ public class LambdaMicrovmsController {
node.put("imageVersion", version.imageVersion);
node.put("state", version.state);
node.put("status", version.status);
node.put("createdAt", epoch(version.createdAt));
node.put("updatedAt", epoch(image.updatedAt));
node.put("createdAt", EpochSeconds.fromInstant(version.createdAt));
node.put("updatedAt", EpochSeconds.fromInstant(image.updatedAt));
node.put("baseImageArn", image.baseImageArn);
node.put("baseImageVersion", image.baseImageVersion);
node.put("buildRoleArn", image.buildRoleArn);
@@ -447,7 +446,7 @@ public class LambdaMicrovmsController {
node.put("chipsetGeneration", build.chipsetGeneration);
node.put("imageArn", image.imageArn);
node.put("imageVersion", version.imageVersion);
node.put("createdAt", epoch(build.createdAt));
node.put("createdAt", EpochSeconds.fromInstant(build.createdAt));
node.putNull("stateReason");
node.putNull("terminationReasonCode");
if (withSnapshot) {
@@ -480,7 +479,7 @@ public class LambdaMicrovmsController {
node.put("state", vm.state);
node.put("imageArn", vm.imageArn);
node.put("imageVersion", vm.imageVersion);
node.put("startedAt", epoch(vm.startedAt));
node.put("startedAt", EpochSeconds.fromInstant(vm.startedAt));
return node;
}
@@ -508,11 +507,11 @@ public class LambdaMicrovmsController {
} else {
node.put("stateReason", vm.stateReason);
}
node.put("startedAt", epoch(vm.startedAt));
node.put("startedAt", EpochSeconds.fromInstant(vm.startedAt));
if (vm.terminatedAt == null) {
node.putNull("terminatedAt");
} else {
node.put("terminatedAt", epoch(vm.terminatedAt));
node.put("terminatedAt", EpochSeconds.fromInstant(vm.terminatedAt));
}
return node;
}
@@ -534,10 +533,6 @@ public class LambdaMicrovmsController {
return root;
}
private double epoch(Instant instant) {
return EpochSeconds.fromInstant(instant);
}
private JsonNode parse(String body) {
try {
return objectMapper.readTree(body == null || body.isBlank() ? "{}" : body);
@@ -132,7 +132,7 @@ public class SageMakerService {
if (m.executionRoleArn != null) {
out.put("ExecutionRoleArn", m.executionRoleArn);
}
out.put("CreationTime", epoch(m.creationTime));
out.put("CreationTime", EpochSeconds.fromMillis(m.creationTime));
return out;
}
@@ -160,7 +160,7 @@ public class SageMakerService {
m -> modelAnchor(m, sortBy), comparator, (m, n) -> {
n.put("ModelName", m.modelName);
n.put("ModelArn", m.modelArn);
n.put("CreationTime", epoch(m.creationTime));
n.put("CreationTime", EpochSeconds.fromMillis(m.creationTime));
}, "Models");
}
@@ -204,7 +204,7 @@ public class SageMakerService {
out.put("EndpointConfigName", cfg.endpointConfigName);
out.put("EndpointConfigArn", cfg.endpointConfigArn);
out.set("ProductionVariants", mapper.valueToTree(cfg.productionVariants));
out.put("CreationTime", epoch(cfg.creationTime));
out.put("CreationTime", EpochSeconds.fromMillis(cfg.creationTime));
return out;
}
@@ -228,7 +228,7 @@ public class SageMakerService {
c -> endpointConfigAnchor(c, sortBy), comparator, (c, n) -> {
n.put("EndpointConfigName", c.endpointConfigName);
n.put("EndpointConfigArn", c.endpointConfigArn);
n.put("CreationTime", epoch(c.creationTime));
n.put("CreationTime", EpochSeconds.fromMillis(c.creationTime));
}, "EndpointConfigs");
}
@@ -289,8 +289,8 @@ public class SageMakerService {
if (ep.failureReason != null) {
out.put("FailureReason", ep.failureReason);
}
out.put("CreationTime", epoch(ep.creationTime));
out.put("LastModifiedTime", epoch(ep.lastModifiedTime));
out.put("CreationTime", EpochSeconds.fromMillis(ep.creationTime));
out.put("LastModifiedTime", EpochSeconds.fromMillis(ep.lastModifiedTime));
return out;
}
@@ -323,8 +323,8 @@ public class SageMakerService {
n.put("EndpointName", e.endpointName);
n.put("EndpointArn", e.endpointArn);
n.put("EndpointStatus", e.endpointStatus);
n.put("CreationTime", epoch(e.creationTime));
n.put("LastModifiedTime", epoch(e.lastModifiedTime));
n.put("CreationTime", EpochSeconds.fromMillis(e.creationTime));
n.put("LastModifiedTime", EpochSeconds.fromMillis(e.lastModifiedTime));
}, "Endpoints");
}
@@ -381,13 +381,13 @@ public class SageMakerService {
"OutputDataConfig", job.outputDataConfig,
"ResourceConfig", job.resourceConfig,
"StoppingCondition", job.stoppingCondition,
"CreationTime", epoch(job.creationTime)
"CreationTime", EpochSeconds.fromMillis(job.creationTime)
));
if (job.trainingStartTime > 0) {
out.put("TrainingStartTime", epoch(job.trainingStartTime));
out.put("TrainingStartTime", EpochSeconds.fromMillis(job.trainingStartTime));
}
if (job.trainingEndTime > 0) {
out.put("TrainingEndTime", epoch(job.trainingEndTime));
out.put("TrainingEndTime", EpochSeconds.fromMillis(job.trainingEndTime));
}
if (job.failureReason != null) {
out.put("FailureReason", job.failureReason);
@@ -425,7 +425,7 @@ public class SageMakerService {
n.put("TrainingJobName", j.trainingJobName);
n.put("TrainingJobArn", j.trainingJobArn);
n.put("TrainingJobStatus", j.trainingJobStatus);
n.put("CreationTime", epoch(j.creationTime));
n.put("CreationTime", EpochSeconds.fromMillis(j.creationTime));
}, "TrainingJobSummaries");
}
@@ -567,10 +567,6 @@ public class SageMakerService {
return clock.millis();
}
static double epoch(long millis) {
return EpochSeconds.fromMillis(millis);
}
static AwsException validation(String message) {
return new AwsException("ValidationException", message, 400);
}