Search in sources :

Example 1 with DeploymentSpec

use of io.seldon.protos.DeploymentProtos.DeploymentSpec in project seldon-core by SeldonIO.

the class SeldonGrpcServer method getChannel.

/**
 * Using the principal from authorization return a client gRPC channel to connect to the engine running the prediction graph.
 * @return ManagedChannel
 */
public ManagedChannel getChannel() {
    final String principal = getPrincipal();
    if (principal == null) {
        throw new SeldonAPIException(SeldonAPIException.ApiExceptionType.APIFE_GRPC_NO_PRINCIPAL_FOUND, "");
    }
    final DeploymentSpec deploymentSpec = deploymentStore.getDeployment(principal);
    if (deploymentSpec == null) {
        throw new SeldonAPIException(SeldonAPIException.ApiExceptionType.APIFE_NO_RUNNING_DEPLOYMENT, "Principal is " + principal);
    }
    ManagedChannel channel = channelStore.get(principal);
    if (channel == null) {
        throw new SeldonAPIException(SeldonAPIException.ApiExceptionType.APIFE_GRPC_NO_GRPC_CHANNEL_FOUND, "Principal is " + principal);
    }
    return channel;
}
Also used : SeldonAPIException(io.seldon.apife.exception.SeldonAPIException) DeploymentSpec(io.seldon.protos.DeploymentProtos.DeploymentSpec) ManagedChannel(io.grpc.ManagedChannel)

Example 2 with DeploymentSpec

use of io.seldon.protos.DeploymentProtos.DeploymentSpec in project seldon-core by SeldonIO.

the class DeploymentStore method deploymentAdded.

@Override
public void deploymentAdded(SeldonDeployment mlDep) {
    final DeploymentSpec deploymentDef = mlDep.getSpec();
    deploymentStore.put(deploymentDef.getOauthKey(), deploymentDef);
    clientDetailsService.addClient(deploymentDef.getOauthKey(), deploymentDef.getOauthSecret());
    logger.info("Succesfully added or updated deployment " + deploymentDef.getName());
}
Also used : DeploymentSpec(io.seldon.protos.DeploymentProtos.DeploymentSpec)

Example 3 with DeploymentSpec

use of io.seldon.protos.DeploymentProtos.DeploymentSpec in project seldon-core by SeldonIO.

the class DeploymentStore method deploymentRemoved.

@Override
public void deploymentRemoved(SeldonDeployment mlDep) {
    final DeploymentSpec deploymentDef = mlDep.getSpec();
    deploymentStore.remove(deploymentDef.getOauthKey());
    clientDetailsService.removeClient(deploymentDef.getOauthKey());
    logger.info("Removed deployment " + deploymentDef.getName());
}
Also used : DeploymentSpec(io.seldon.protos.DeploymentProtos.DeploymentSpec)

Aggregations

DeploymentSpec (io.seldon.protos.DeploymentProtos.DeploymentSpec)3 ManagedChannel (io.grpc.ManagedChannel)1 SeldonAPIException (io.seldon.apife.exception.SeldonAPIException)1