serve icon indicating copy to clipboard operation
serve copied to clipboard

Updating workers after starting models doesn't reflect changes using Management API

Open mohammedayub44 opened this issue 6 years ago • 2 comments

Hi,

Python: 3.8.3 Cudatoolkit: 10.1.243 pytorch: 1.5.0

I'm testing batching using the provided resnet152 batch scripts and commands. I'm using the config.properties to start the server on different ports using the below command:

torchserve --ts-config ./config.properties --start --ncs --model-store ./torchserve_model_store --models resnet152=resnet-152-batch.mar > /home/ubuntu/mayub/Github/resnet_batch_log.txt

Config.properties file is as follows:

inference_address=http://0.0.0.0:8443
management_address=http://0.0.0.0:8444
default_workers_per_model=1
cors_allowed_origin=*
cors_allowed_methods=GET, POST, PUT, OPTIONS
cors_allowed_headers=X-Custom-Header

I try to scale the workers using the management API by giving the max_batch_size and max_batch_delay arguments. It says "workers are scaled", but it doesn't seem to work and it still shows me the old model configs:

image

Any reason for this ?

Thanks !

mohammedayub44 avatar May 27 '20 18:05 mohammedayub44

Tried following and workers are getting scaled -

curl -k -X POST "https://localhost:8444/models?url=resnet-152-batch.mar&batch_size=8&max_batch_delay=10&initial_workers=1"
{
  "status": "Workers scaled"
}

curl -k "https://localhost:8444/models/resnet-152-batch"
[
  {
    "modelName": "resnet-152-batch",
    "modelVersion": "1.0",
    "modelUrl": "resnet-152-batch.mar",
    "runtime": "python",
    "minWorkers": 1,
    "maxWorkers": 1,
    "batchSize": 8,
    "maxBatchDelay": 10,
    "loadedAtStartup": false,
    "workers": [
      {
        "id": "9004",
        "startTime": "2020-05-28T01:23:32.063Z",
        "status": "READY",
        "gpu": false,
        "memoryUsage": 312107008
      }
    ]
  }
]

Now the scaling request----

curl -k -X PUT "https://localhost:8444/models/resnet-152-batch?min_worker=2"
{
  "status": "Processing worker updates..."
}

curl -k "https://localhost:8444/models/resnet-152-batch"
[
  {
    "modelName": "resnet-152-batch",
    "modelVersion": "1.0",
    "modelUrl": "resnet-152-batch.mar",
    "runtime": "python",
    "minWorkers": 2,
    "maxWorkers": 2,
    "batchSize": 8,
    "maxBatchDelay": 10,
    "loadedAtStartup": false,
    "workers": [
      {
        "id": "9004",
        "startTime": "2020-05-28T01:23:32.063Z",
        "status": "READY",
        "gpu": false,
        "memoryUsage": 312107008
      },
      {
        "id": "9005",
        "startTime": "2020-05-28T01:27:51.833Z",
        "status": "READY",
        "gpu": false,
        "memoryUsage": 0
      }
    ]
  }
]

codinnvrends avatar May 27 '20 20:05 codinnvrends

@dhaniram-kshirsagar my bad, my curl command URL was incorrect, it needs a model name. It works fine now. Thanks for confirming.

mohammedayub44 avatar May 27 '20 21:05 mohammedayub44