use of com.hortonworks.streamline.registries.model.data.MLModel in project streamline by hortonworks.
the class MLModelRegistryService method removeModelInfo.
public MLModel removeModelInfo(Long modelId) {
MLModel modelInfo = new MLModel();
modelInfo.setId(modelId);
MLModel removedModelInfo = this.storageManager.remove(modelInfo.getStorableKey());
if (removedModelInfo == null) {
throw EntityNotFoundException.byId(modelId.toString());
}
return removedModelInfo;
}
use of com.hortonworks.streamline.registries.model.data.MLModel in project streamline by hortonworks.
the class MLModelRegistryService method getModelInfo.
public MLModel getModelInfo(String name) {
List<QueryParam> queryParams = Collections.singletonList(new QueryParam(MLModel.NAME, name));
Collection<MLModel> modelInfos = this.storageManager.find(ML_MODEL_NAME_SPACE, queryParams);
if (modelInfos.size() == 0) {
throw EntityNotFoundException.byName(name);
}
return modelInfos.iterator().next();
}
use of com.hortonworks.streamline.registries.model.data.MLModel in project streamline by hortonworks.
the class MLModelRegistryResource method getModelOutputFieldsById.
/**
* Get model fields by id
* <p>
* curl -sS -X GET http://localhost:8080/api/v1/catalog/ml/models/1/fields/output
* </p>
* <pre>
*{
* "responseCode":1000,
* "responseMessage":"Success",
* "entities":[
* {"name": "fieldName", "type": "fieldType"}
* ...
* ]
*}
* </pre>
*/
@GET
@Path("ml/models/{id}/fields/output")
@Produces(MediaType.APPLICATION_JSON)
@Timed
public Response getModelOutputFieldsById(@PathParam("id") final Long modelId) throws Exception {
MLModel modelInfo = modelRegistryService.getModelInfo(modelId);
final List<MLModelField> fieldNames = modelRegistryService.getModelOutputFields(modelInfo);
return WSUtils.respondEntity(fieldNames, OK);
}
use of com.hortonworks.streamline.registries.model.data.MLModel in project streamline by hortonworks.
the class MLModelRegistryResource method getModelInputFieldsById.
/**
* Get model fields by id
* <p>
* curl -sS -X GET http://localhost:8080/api/v1/catalog/ml/models/1/fields/input
* </p>
* <pre>
*{
* "responseCode":1000,
* "responseMessage":"Success",
* "entities":[
* {"name": "fieldName", "type": "fieldType"}
* ...
* ...
* ]
*}
* </pre>
*/
@GET
@Path("ml/models/{id}/fields/input")
@Produces(MediaType.APPLICATION_JSON)
@Timed
public Response getModelInputFieldsById(@PathParam("id") final Long modelId) throws Exception {
MLModel modelInfo = modelRegistryService.getModelInfo(modelId);
final List<MLModelField> fieldNames = modelRegistryService.getModelInputFields(modelInfo);
return WSUtils.respondEntity(fieldNames, OK);
}
use of com.hortonworks.streamline.registries.model.data.MLModel in project streamline by hortonworks.
the class MLModelRegistryService method getModelInfo.
public MLModel getModelInfo(Long modelId) {
MLModel modelInfo = new MLModel();
modelInfo.setId(modelId);
MLModel storedModelInfo = this.storageManager.get(modelInfo.getStorableKey());
if (storedModelInfo == null) {
throw EntityNotFoundException.byId(modelId.toString());
}
return storedModelInfo;
}