org.apache.ignite.ml.inference.builder

## Class IgniteDistributedModelBuilder

- java.lang.Object
- - org.apache.ignite.ml.inference.builder.IgniteDistributedModelBuilder

- All Implemented Interfaces:
    AsyncModelBuilder

      public class IgniteDistributedModelBuilder
      extends Object
      implements AsyncModelBuilder

  Builder that allows to start Apache Ignite services for distributed inference and get a facade that allows to work with this distributed inference infrastructure as with a single inference model (see `Model`). The common workflow is based on a request/response queues and multiple workers represented by Apache Ignite services. When the `build(ModelReader, ModelParser)` method is called Apache Ignite starts the specified number of service instances and request/response queues. Each service instance reads request queue, processes inbound requests and writes responses to response queue. The facade returned by the `build(ModelReader, ModelParser)` method operates with request/response queues. When the `Model.predict(Object)` method is called the argument is sent as a request to the request queue. When the response is appeared in the response queue the `Future` correspondent to the previously sent request is completed and the processing finishes. Be aware that `Model.close()` method must be called to clear allocated resources, stop services and remove queues.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IgniteDistributedModelBuilder(Ignite ignite, int instances, int maxPerNode)` Constructs a new instance of Ignite distributed inference model builder.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<I extends Serializable,O extends Serializable> Model<I,Future<O>>` | `build(ModelReader reader, ModelParser<I,O,?> parser)` Starts the specified in constructor number of service instances and request/response queues.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IgniteDistributedModelBuilder

          public IgniteDistributedModelBuilder(Ignite ignite,
                                               int instances,
                                               int maxPerNode)

      Constructs a new instance of Ignite distributed inference model builder.
      Parameters:
        `ignite` - Ignite instance.
        `instances` - Number of service instances maintaining to make distributed inference.
        `maxPerNode` - Max per node number of instances.

  - ### Method Detail

    - #### build

          public <I extends Serializable,O extends Serializable> Model<I,Future<O>> build(ModelReader reader,
                                                                                          ModelParser<I,O,?> parser)

      Starts the specified in constructor number of service instances and request/response queues. Each service instance reads request queue, processes inbound requests and writes responses to response queue. The returned facade is represented by the `Model` operates with request/response queues, but hides these details behind `Model.predict(Object)` method of `Model`. Be aware that `Model.close()` method must be called to clear allocated resources, stop services and remove queues.
      Specified by:
        `build` in interface `AsyncModelBuilder`
      Type Parameters:
        `I` - Type of model input.
        `O` - Type of model output.
      Parameters:
        `reader` - Inference model reader.
        `parser` - Inference model parser.
      Returns:
        Facade represented by `Model`.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022