azure-docs icon indicating copy to clipboard operation
azure-docs copied to clipboard

Azure Spot maxPrice integer with decimal places

Open mweibel opened this issue 2 years ago • 3 comments

MaxPrice is everywhere specified as an integer but it seems to allow decimal places. Looking at the datatype for integers it does not specify anything about being able to use decimal places. Is an integer actually a floating point type? Is this documented somewhere?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

mweibel avatar Aug 12 '22 12:08 mweibel

@mweibel Thank you for bringing this to our attention! We are reviewing the documentation and will get back to you shortly.

kobulloc-MSFT avatar Aug 12 '22 21:08 kobulloc-MSFT

VM ARM template example: https://docs.microsoft.com/en-us/azure/templates/microsoft.compute/virtualmachines?pivots=deployment-language-arm-template

image

Red Hat OpenShift documentation: https://docs.openshift.com/container-platform/4.7/machine_management/creating_machinesets/creating-machineset-azure.html

image

kobulloc-MSFT avatar Aug 12 '22 21:08 kobulloc-MSFT

@mweibel As an update, I'd like to confirm that decimals are currently allowed for maxPrice. We are waiting for confirmation on future behavior and the documentation will be updated accordingly.

kobulloc-MSFT avatar Aug 16 '22 15:08 kobulloc-MSFT

@mweibel Edit: Although described in some places as accepting an int, maxPrice can be set in US dollars using up to 5 decimal places as outlined in this document:

You have option to set a max price you are willing to pay, per hour, for the VM. The max price for a Azure Spot Virtual Machine can be set in US dollars (USD), using up to 5 decimal places. For example, the value 0.98765would be a max price of $0.98765 USD per hour. If you set the max price to be -1, the VM won't be evicted based on price. The price for the VM will be the current price for Azure Spot Virtual Machines or the price for a standard VM, which ever is less, as long as there is capacity and quota available. For more information about setting the max price, see Azure Spot Virtual Machines - Pricing.

What is actually going on as far as ARM data types are concerned is a bit unintuitive as it appears to involve a workaround which I've described in my comment below (decimal-as-string) and that is going to be outside of the scope of this document.

Thank you for helping to improve the Azure docs! We are going to close this thread as resolved but if there are any further questions regarding the documentation, please tag me in your reply and we will be happy to continue the conversation.

kobulloc-MSFT avatar Aug 17 '22 16:08 kobulloc-MSFT

@mweibel Decimal values are allowed for maxPrice and as such, it should not be considered an integer. Looking at the ARM data types documentation that you linked however, it's unclear exactly what the correct update should be to properly reflect decimal values being accepted. This is being further reviewed.

kobulloc-MSFT avatar Aug 29 '22 19:08 kobulloc-MSFT

how about documenting a float? :)

mweibel avatar Aug 30 '22 04:08 mweibel

@mweibel I believe that's the idea however we would need to confirm that there isn't language specific nuance that would make this inaccurate (as float describes a degree of precision in some cases).

kobulloc-MSFT avatar Aug 30 '22 07:08 kobulloc-MSFT

@mweibel Digging into this further, it appears that floats are a bit more complicated in the context of an ARM template. Since int is supported but float is not, there is a workaround that allows a string to be accepted as a float and a similar technique appears to be used here. This is not terribly intuitive, however, and may distract from the goal of describing what value to use for maxPrice. I've notified the document author but for the context of this document, the initial description is correct:

You have option to set a max price you are willing to pay, per hour, for the VM. The max price for a Azure Spot Virtual Machine can be set in US dollars (USD), using up to 5 decimal places. For example, the value 0.98765would be a max price of $0.98765 USD per hour. If you set the max price to be -1, the VM won't be evicted based on price. The price for the VM will be the current price for Azure Spot Virtual Machines or the price for a standard VM, which ever is less, as long as there is capacity and quota available. For more information about setting the max price, see Azure Spot Virtual Machines - Pricing.

Example of decimal-as-string https://docs.microsoft.com/en-us/azure/templates/microsoft.sql/servers/databases?pivots=deployment-language-bicep

kobulloc-MSFT avatar Aug 30 '22 19:08 kobulloc-MSFT