softlayer / softlayer-python

A set of Python libraries that assist in calling the SoftLayer API.
http://softlayer.github.io/softlayer-python/
MIT License
152 stars 195 forks source link

The slcli returns only gpu0 items when there are already gpu1 items #983

Closed acamacho82 closed 6 years ago

acamacho82 commented 6 years ago

This is for baremetal servers which have GPU support.

Expected Behavior

The slcli should list gpu0 and gpu1 items

Actual Behavior

The slcli returns only gpu0 items when there are already gpu1 items

$ slcli order item-list DUAL_E52600_V4_12_DRIVES

: gpu0 :        GPU_NVIDIA_TESLA_K80      :                                                  NVIDIA Tesla K80 Graphic Card                                                   :
: gpu0 : GPU_NVIDIA_TESLA_M60_ACCELERATOR : NVIDIA Tesla M60 GPU Accelerator - Software may be required (Product is subject to availability - Please contact Sales to order) :
: gpu0 :       GPU_NVIDIA_TESLA_V100      :                                                  NVIDIA Tesla V100 Graphic Card                                                  :
: gpu0 :       GPU_NVIDIA_TESLA_P100      :                                                  NVIDIA Tesla P100 Graphic Card                                                  :

Here the REST call to get the gpu1 items

https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/553/getItemPrices?objectMask=mask[categories,pricingLocationGroup[locations],item[itemCategory]]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"gpu1"}}}}

         {
        "id": 141767,
        "itemId": 6072,
        "locationGroupId": 507,
        "categories": [
            {
                "categoryCode": "gpu1",
                "id": 327,
                "name": "Secondary Graphics Processing Unit",
                "quantityLimit": 0,
                }
        ],
        "item": {
            "capacity": "4992",
            "description": "NVIDIA Tesla K80 Graphic Card",
            "id": 6072,
            "itemTaxCategoryId": 166,
            "keyName": "GPU_NVIDIA_TESLA_K80",
            "units": "Cuda_Core",       
            "itemCategory": {
                "categoryCode": "gpu0",
                "id": 326,
                "name": "Graphics Processing Unit",
                "quantityLimit": 0,
                "sortOrder": null
            }
        }

Environment Information

Operating System: Linux softlayer-python version (slcli --version): 5.4.4

acamacho82 commented 6 years ago

The client calls to getItems instead of getItemPrices to list the available items of package, and to add gpu1 it will be necessary to retrieve all categories of the item, for example, the item GPU_NVIDIA_TESLA_V100 has two categories gpu0 and gpu1.

Now, if gpu1 category will be displayed then there will be 4 new rows in the list, but the keyName and description will be the same than gpu0, this does not seem like much but this change will affect to all retrieved items, so the categories of items like the disks, which have more than 20 categories, will be displayed in the list too.

With this in mind, I don't think that displaying all those categories will be helpful, the list will be so big that it'd lose the objective of being simple.

allmightyspiff commented 6 years ago

agreed, listing all variations, like gpuX and diskX would make this list pretty long. If i remember correctly the priceIds are the same across the numbered items, so we shouldn't really need to print out everything. Going to close this issue.