Method: Elasticsearch::API::MachineLearning::Actions#start_trained_model_deployment

Defined in:
lib/elasticsearch/api/actions/machine_learning/start_trained_model_deployment.rb

#start_trained_model_deployment(arguments = {}) ⇒ Object

Start a trained model deployment.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :model_id (String)

    The unique identifier of the trained model. (Required)

  • :cache_size (String)

    A byte-size value for configuring the inference cache size. For example, 20mb.

  • :deployment_id (String)

    The Id of the new deployment. Defaults to the model_id if not set.

  • :number_of_allocations (Integer)

    The total number of allocations this model is assigned across machine learning nodes.

  • :threads_per_allocation (Integer)

    The number of threads used by each model allocation during inference.

  • :priority (String)

    The deployment priority.

  • :queue_capacity (Integer)

    Controls how many inference requests are allowed in the queue at a time.

  • :timeout (Time)

    Controls the amount of time to wait for the model to deploy.

  • :wait_for (String)

    The allocation status for which to wait (options: starting, started, fully_allocated)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/elasticsearch/api/actions/machine_learning/start_trained_model_deployment.rb', line 40

def start_trained_model_deployment(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ml.start_trained_model_deployment' }

  defined_params = [:model_id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  raise ArgumentError, "Required argument 'model_id' missing" unless arguments[:model_id]

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = nil

  _model_id = arguments.delete(:model_id)

  method = Elasticsearch::API::HTTP_POST
  path   = "_ml/trained_models/#{Utils.__listify(_model_id)}/deployment/_start"
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end