mirror of
https://github.com/floci-io/floci.git
synced 2026-12-02 01:43:02 -05:00
fix(emr): preserve millisecond timestamp precision (#6149)
This commit is contained in:
1 parent
f4a9b15ced
commit
ac7371fb33
3 files changed
+77
-7
No files matched your search
@@ -22,6 +22,7 @@ import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
@@ -879,13 +880,13 @@ public class EmrHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private long epoch(Instant instant) {
|
||||
return instant == null ? 0L : instant.getEpochSecond();
|
||||
private BigDecimal epoch(Instant instant) {
|
||||
return instant == null ? BigDecimal.ZERO : BigDecimal.valueOf(instant.toEpochMilli(), 3);
|
||||
}
|
||||
|
||||
private void putEpoch(ObjectNode node, String field, Instant instant) {
|
||||
if (instant != null) {
|
||||
node.put(field, instant.getEpochSecond());
|
||||
node.put(field, epoch(instant));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import jakarta.inject.Inject;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -95,7 +96,7 @@ public class EmrService {
|
||||
? "INSTANCE_GROUP" : "INSTANCE_FLEET");
|
||||
cluster.setAutoTerminate(!cluster.isKeepJobFlowAliveWhenNoSteps());
|
||||
cluster.setMasterPublicDnsName(masterDnsName(region));
|
||||
cluster.setCreationDateTime(Instant.now());
|
||||
cluster.setCreationDateTime(Instant.now().truncatedTo(ChronoUnit.MILLIS));
|
||||
for (EmrInstanceGroup g : cluster.getInstanceGroups()) {
|
||||
g.setId("ig-" + randomId(13));
|
||||
g.setRunningInstanceCount(g.getRequestedInstanceCount());
|
||||
@@ -137,6 +138,9 @@ public class EmrService {
|
||||
continue;
|
||||
}
|
||||
Instant createdAt = c.getCreationDateTime();
|
||||
if (createdAt != null) {
|
||||
createdAt = createdAt.truncatedTo(ChronoUnit.MILLIS);
|
||||
}
|
||||
if (createdAfter != null && (createdAt == null || !createdAt.isAfter(createdAfter))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user