-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
HLRC: Adding ML Job stats #33183
HLRC: Adding ML Job stats #33183
Changes from 1 commit
e2d0daa
cefe9d3
8a7feb4
f55e01e
cc602fe
de52ab2
54d56a7
c8d3f5a
da0c1bd
5254cc1
55f543d
79dd816
9f2bc9e
a6512a4
2c9e231
b761884
a45fbec
fdf2aa0
401223b
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 |
---|---|---|
|
@@ -37,10 +37,10 @@ public class ForecastStats implements ToXContentObject { | |
|
||
public static final ParseField TOTAL = new ParseField("total"); | ||
public static final ParseField FORECASTED_JOBS = new ParseField("forecasted_jobs"); | ||
public static final ParseField MEMORY = new ParseField("memory_bytes"); | ||
public static final ParseField RUNTIME = new ParseField("processing_time_ms"); | ||
public static final ParseField MEMORY_BYTES = new ParseField("memory_bytes"); | ||
public static final ParseField PROCESSING_TIME_MS = new ParseField("processing_time_ms"); | ||
public static final ParseField RECORDS = new ParseField("records"); | ||
public static final ParseField STATUSES = new ParseField("status"); | ||
public static final ParseField STATUS = new ParseField("status"); | ||
|
||
@SuppressWarnings("unchecked") | ||
public static final ConstructingObjectParser<ForecastStats, Void> PARSER = | ||
|
@@ -58,19 +58,19 @@ public class ForecastStats implements ToXContentObject { | |
|
||
static { | ||
PARSER.declareLong(ConstructingObjectParser.constructorArg(), TOTAL); | ||
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), SimpleStats.PARSER, MEMORY); | ||
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), SimpleStats.PARSER, MEMORY_BYTES); | ||
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), SimpleStats.PARSER, RECORDS); | ||
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), SimpleStats.PARSER, RUNTIME); | ||
PARSER.declareObject(ConstructingObjectParser.optionalConstructorArg(), SimpleStats.PARSER, PROCESSING_TIME_MS); | ||
PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(), | ||
p -> { | ||
Map<String, Long> counts = new HashMap<>(); | ||
p.map().forEach((key, value) -> counts.put(key, ((Number)value).longValue())); | ||
return counts; | ||
}, STATUSES, ObjectParser.ValueType.OBJECT); | ||
}, STATUS, ObjectParser.ValueType.OBJECT); | ||
} | ||
|
||
private long total; | ||
private long forecastedJobs; | ||
private final long total; | ||
private final long forecastedJobs; | ||
private SimpleStats memoryStats; | ||
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. The rest could be 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. @dimitris-athanasiou No, because they are optionally set in the constructor if the total is 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. This just means we need to explicitly set them to |
||
private SimpleStats recordStats; | ||
private SimpleStats runtimeStats; | ||
|
@@ -140,10 +140,10 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws | |
builder.field(FORECASTED_JOBS.getPreferredName(), forecastedJobs); | ||
|
||
if (total > 0) { | ||
builder.field(MEMORY.getPreferredName(), memoryStats); | ||
builder.field(MEMORY_BYTES.getPreferredName(), memoryStats); | ||
builder.field(RECORDS.getPreferredName(), recordStats); | ||
builder.field(RUNTIME.getPreferredName(), runtimeStats); | ||
builder.field(STATUSES.getPreferredName(), statusCounts); | ||
builder.field(PROCESSING_TIME_MS.getPreferredName(), runtimeStats); | ||
builder.field(STATUS.getPreferredName(), statusCounts); | ||
} | ||
return builder.endObject(); | ||
} | ||
|
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 name of this and the
GetJobRequest
needs to be consistent. Not sure if plural or singular is best. Potentially should also be consistent with the results (where I've been using plural). @droberts195 Any preference?