Skip to content

Commit

Permalink
minor fix to attribute retrieval in scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-super committed Nov 27, 2024
1 parent 50488d1 commit a69ea0c
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1193,18 +1193,11 @@ private List<ExternalEvent> parseExternalEvents(final JsonArray eventsJson, fina
);
final var end = start.plus(Duration.fromString(e.getString("duration")));

// TODO: all of the properties of eventJson are strings. Including things (like attributes, source_range, etc.) that should be objects
// find a better way to handle this
// final var eventAttributesJson = e.getJsonObject("attributes");
// final var eventAttributes = new HashMap<String, SerializedValue>();
// for (final var attributeJson: eventAttributesJson.entrySet()) {
// eventAttributes.put(
// attributeJson.getKey(),
// serializedValueP.parse(attributeJson.getValue()).getSuccessOrThrow()
// );
// }
// TODO: all of the properties of eventJson are strings, except attributes. Including things like source_range, etc.,
// that should be objects...find a better way to handle this
final var eventAttributes = SchedulerParsers
.parseJson(e.getString("attributes"), new SerializedValueJsonParser()).asMap().get();
.parseJson(e.getJsonObject("attributes").toString(), new SerializedValueJsonParser()).asMap().get();
// convert eventAttributes to a Map<String, SerializedValue)

// final var sourceAttributesJson = e.getJsonObject("external_source").getJsonObject("attributes");
// final var sourceAttributes = new HashMap<String, SerializedValue>();
Expand All @@ -1215,7 +1208,7 @@ private List<ExternalEvent> parseExternalEvents(final JsonArray eventsJson, fina
// );
// }
final var sourceAttributes = SchedulerParsers
.parseJson(e.getJsonObject("external_source").getString("attributes"), new SerializedValueJsonParser()).asMap().get();
.parseJson(e.getJsonObject("external_source").getJsonObject("attributes").toString(), new SerializedValueJsonParser()).asMap().get();

result.add(new ExternalEvent(
e.getString("event_key"),
Expand Down

0 comments on commit a69ea0c

Please sign in to comment.