in src/main/java/org/opensearch/ad/model/ADTaskProfile.java [265:372]
public static ADTaskProfile parse(XContentParser parser) throws IOException {
ADTask adTask = null;
Integer shingleSize = null;
Long rcfTotalUpdates = null;
Boolean thresholdModelTrained = null;
Integer thresholdModelTrainingDataSize = null;
Long modelSizeInBytes = null;
String nodeId = null;
String taskId = null;
String taskType = null;
Integer detectorTaskSlots = null;
Boolean totalEntitiesInited = null;
Integer totalEntitiesCount = null;
Integer pendingEntitiesCount = null;
Integer runningEntitiesCount = null;
List<String> runningEntities = null;
List<ADEntityTaskProfile> entityTaskProfiles = null;
Long latestHCTaskRunTime = null;
ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser);
while (parser.nextToken() != XContentParser.Token.END_OBJECT) {
String fieldName = parser.currentName();
parser.nextToken();
switch (fieldName) {
case AD_TASK_FIELD:
adTask = ADTask.parse(parser);
break;
case SHINGLE_SIZE_FIELD:
shingleSize = parser.intValue();
break;
case RCF_TOTAL_UPDATES_FIELD:
rcfTotalUpdates = parser.longValue();
break;
case THRESHOLD_MODEL_TRAINED_FIELD:
thresholdModelTrained = parser.booleanValue();
break;
case THRESHOLD_MODEL_TRAINING_DATA_SIZE_FIELD:
thresholdModelTrainingDataSize = parser.intValue();
break;
case MODEL_SIZE_IN_BYTES:
modelSizeInBytes = parser.longValue();
break;
case NODE_ID_FIELD:
nodeId = parser.text();
break;
case TASK_ID_FIELD:
taskId = parser.text();
break;
case AD_TASK_TYPE_FIELD:
taskType = parser.text();
break;
case DETECTOR_TASK_SLOTS_FIELD:
detectorTaskSlots = parser.intValue();
break;
case TOTAL_ENTITIES_INITED_FIELD:
totalEntitiesInited = parser.booleanValue();
break;
case TOTAL_ENTITIES_COUNT_FIELD:
totalEntitiesCount = parser.intValue();
break;
case PENDING_ENTITIES_COUNT_FIELD:
pendingEntitiesCount = parser.intValue();
break;
case RUNNING_ENTITIES_COUNT_FIELD:
runningEntitiesCount = parser.intValue();
break;
case RUNNING_ENTITIES_FIELD:
runningEntities = new ArrayList<>();
ensureExpectedToken(XContentParser.Token.START_ARRAY, parser.currentToken(), parser);
while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
runningEntities.add(parser.text());
}
break;
case ENTITY_TASK_PROFILE_FIELD:
entityTaskProfiles = new ArrayList<>();
ensureExpectedToken(XContentParser.Token.START_ARRAY, parser.currentToken(), parser);
while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
entityTaskProfiles.add(ADEntityTaskProfile.parse(parser));
}
break;
case LATEST_HC_TASK_RUN_TIME_FIELD:
latestHCTaskRunTime = parser.longValue();
break;
default:
parser.skipChildren();
break;
}
}
return new ADTaskProfile(
adTask,
shingleSize,
rcfTotalUpdates,
thresholdModelTrained,
thresholdModelTrainingDataSize,
modelSizeInBytes,
nodeId,
taskId,
taskType,
detectorTaskSlots,
totalEntitiesInited,
totalEntitiesCount,
pendingEntitiesCount,
runningEntitiesCount,
runningEntities,
latestHCTaskRunTime
);
}