Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure-mgmt-batch Pool create incorrect API version #19224

Closed
m-credera opened this issue Jun 11, 2021 · 10 comments
Closed

azure-mgmt-batch Pool create incorrect API version #19224

m-credera opened this issue Jun 11, 2021 · 10 comments
Assignees
Labels
Batch bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@m-credera
Copy link

  • Package Name: azure-mgmt-batch
  • Package Version: 15.0.0
  • Operating System: MacOS
  • Python Version: 3.8

Describe the bug
azure-mgmt-batch PoolOperations.create references a Batch Management REST API version that does not exist yet:

References 2021-01-01: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_pool_operations.py#L192

Latest available is 2020-09-01.12.0 at the time of writing: https://docs.microsoft.com/en-us/rest/api/batchservice/batch-service-rest-api-versioning

This causes the error:

HttpResponseError: (InvalidQueryParameterValue) {'lang': 'en-US', 'value': 'Value for one of the query parameters specified in the request URI is invalid.\nRequestId:c56f5616-7008-4b66-af1d-8c1294d096d7\nTime:2021-06-11T20:41:40.1708298Z'}
Code: InvalidQueryParameterValue
Message: {'lang': 'en-US', 'value': 'Value for one of the query parameters specified in the request URI is invalid.\nRequestId:c56f5616-7008-4b66-af1d-8c1294d096d7\nTime:2021-06-11T20:41:40.1708298Z'}

(side note - HttpResponseError could be improved to include response.body() as the body is the only place where the actual invalid parameter is specified :)

To Reproduce
Steps to reproduce the behavior:

  1. Create a batch account
  2. Attempt to create a pool inside that batch account using the latest azure-mgmt-batch version
credentials = azure.identity.DefaultAzureCredential()
cli = azure.mgmt.batch.BatchManagement(
    credential=credentials,
    subscription_id=subscription_id,
    base_url=base_url,
)
cli.pool.create(
    resource_group_name=resource_group_name,
    account_name=batch_account_name,
    pool_name=pool_id,
    parameters=azure.mgmt.batch.models.Pool(...),
)

Expected behavior
The pool is created without errors from the HTTP request being invalid.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 11, 2021
@xiangyan99 xiangyan99 added Batch bug This issue requires a change to an existing behavior in the product in order to be resolved. Mgmt This issue is related to a management-plane library. Service Attention Workflow: This issue is responsible by Azure service team. labels Jun 14, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jun 14, 2021
@ghost
Copy link

ghost commented Jun 14, 2021

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @mksuni, @bgklein, @mscurrell, @cRui861, @paterasMSFT, @gingi, @dpwatrous.

Issue Details
  • Package Name: azure-mgmt-batch
  • Package Version: 15.0.0
  • Operating System: MacOS
  • Python Version: 3.8

Describe the bug
azure-mgmt-batch PoolOperations.create references a Batch Management REST API version that does not exist yet:

References 2021-01-01: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/batch/azure-mgmt-batch/azure/mgmt/batch/operations/_pool_operations.py#L192

Latest available is 2020-09-01.12.0 at the time of writing: https://docs.microsoft.com/en-us/rest/api/batchservice/batch-service-rest-api-versioning

This causes the error:

HttpResponseError: (InvalidQueryParameterValue) {'lang': 'en-US', 'value': 'Value for one of the query parameters specified in the request URI is invalid.\nRequestId:c56f5616-7008-4b66-af1d-8c1294d096d7\nTime:2021-06-11T20:41:40.1708298Z'}
Code: InvalidQueryParameterValue
Message: {'lang': 'en-US', 'value': 'Value for one of the query parameters specified in the request URI is invalid.\nRequestId:c56f5616-7008-4b66-af1d-8c1294d096d7\nTime:2021-06-11T20:41:40.1708298Z'}

(side note - HttpResponseError could be improved to include response.body() as the body is the only place where the actual invalid parameter is specified :)

To Reproduce
Steps to reproduce the behavior:

  1. Create a batch account
  2. Attempt to create a pool inside that batch account using the latest azure-mgmt-batch version
credentials = azure.identity.DefaultAzureCredential()
cli = azure.mgmt.batch.BatchManagement(
    credential=credentials,
    subscription_id=subscription_id,
    base_url=base_url,
)
cli.pool.create(
    resource_group_name=resource_group_name,
    account_name=batch_account_name,
    pool_name=pool_id,
    parameters=azure.mgmt.batch.models.Pool(...),
)

Expected behavior
The pool is created without errors from the HTTP request being invalid.

Author: michaelcredera
Assignees: -
Labels:

Batch, Mgmt, Service Attention, bug, customer-reported, needs-triage, question

Milestone: -

@xiangyan99 xiangyan99 removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Jun 14, 2021
@xiangyan99
Copy link
Member

Thanks for the feedback, we’ll investigate asap.

@RAY-316
Copy link
Contributor

RAY-316 commented Jun 22, 2021

hi @michaelcredera I have used the 15.0.0 package to create a pool inside the batch account, it seems that everything is all right. Can you provide more detailed examples or try again?

def test_mgmt_batch_pools(self, resource_group, location, batch_account):

@RAY-316 RAY-316 self-assigned this Jun 22, 2021
@m-credera
Copy link
Author

Sure, here's the code I'm calling that leads to the above error. What's interesting to me is that the error I post above is coming directly from the HTTP API due to the API version, not from the code. I'll test again, maybe they just updated the HTTP API in the server lol!

import azure.mgmt.batch as az_batch
import azure.mgmt.batch.operations as az_batch_ops
import azure.mgmt.batch.models as az_batch_models

vm_cfg = az_batch_models.VirtualMachineConfiguration(
            image_reference=az_batch_models.ImageReference(
            publisher="microsoft-azure-batch", offer="ubuntu-server-container", version="20-04-lts",
        ),
            node_agent_sku_id="batch.node.ubuntu 20.04",
            container_configuration=az_batch_models.ContainerConfiguration(
                container_image_names=["container_name"],
                container_registries=[
                az_batch_models.ContainerRegistry(
                    user_name="user",
                    password="pass",
                    registry_server="host",
                )
            ],
            ),
        )

identity_arm = "user identity arm"
pool = az_batch_models.Pool(
            identity=az_batch_models.BatchPoolIdentity(
                type=az_batch_models.PoolIdentityType.USER_ASSIGNED,
                user_assigned_identities={
                    identity_arm: az_batch_models.Components81XseeSchemasBatchpoolidentityPropertiesUserassignedidentitiesAdditionalproperties()
                },
            ),
            display_name="pool name",
            vm_size=1,
            deployment_configuration=az_batch_models.DeploymentConfiguration(
                virtual_machine_configuration=vm_cfg,
            ),
            scale_settings=az_batch_models.ScaleSettings(
                fixed_scale=az_batch_models.FixedScaleSettings(
                    target_dedicated_nodes=0,
                    target_low_priority_nodes=1,
                )
            ),
            task_slots_per_node=8,
            start_task=None,
        )

credentials = azure.identity.DefaultAzureCredential()
pool_client = az_batch.BatchManagement(
            credential=credentials,
            subscription_id="subscription_id",
        )

pool_client.pool.create(
                resource_group_name="resource_group_name",
                account_name="batch_account_name",
                pool_name="pool name",
                parameters=pool,
            )

@m-credera
Copy link
Author

@m-credera
Copy link
Author

Improvement! Backend must've added the 2021 API version, but now I get a 500 error:

HttpResponseError: (InternalServerError) Encountered internal server error. Diagnostic information: timestamp '20210622T132304Z', subscription id 'x', tracking id 'e2ce0f0e-ddb5-48da-8273-b366465c1b30', request correlation id 'e2ce0f0e-ddb5-48da-8273-b366465c1b30'.
Code: InternalServerError
Message: Encountered internal server error. Diagnostic information: timestamp '20210622T132304Z', subscription id 'x', tracking id 'e2ce0f0e-ddb5-48da-8273-b366465c1b30', request correlation id 'e2ce0f0e-ddb5-48da-8273-b366465c1b30'.

@m-credera
Copy link
Author

Confirmed that it's the identity that's causing the 500 error:

            identity=az_batch_models.BatchPoolIdentity(
                type=az_batch_models.PoolIdentityType.USER_ASSIGNED,
                user_assigned_identities={
                    identity_arm: az_batch_models.Components81XseeSchemasBatchpoolidentityPropertiesUserassignedidentitiesAdditionalproperties()
                },
            ),

Removing this makes things work - anyone have any idea why using a user identity would cause 500 errors?

@m-credera
Copy link
Author

And now it seems to work without 500 errors... Not sure what happened, but I think things are working now. I'll run some tests to confirm and close this ticket if all is well.

@xiangyan99 xiangyan99 added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Dec 2, 2021
@ghost
Copy link

ghost commented Dec 2, 2021

Hi @michaelcredera. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

@ghost
Copy link

ghost commented Dec 9, 2021

Hi @michaelcredera, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

@ghost ghost closed this as completed Dec 9, 2021
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this issue Jun 6, 2022
Add managedServerDnsAlias to readme file (Azure#19224)

Co-authored-by: Stefan Krivokapic <[email protected]>
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this issue Jun 6, 2022
Revert "Add managedServerDnsAlias to readme file (Azure#19224)" (Azure#19333)

This reverts commit fada264d1744483dff8242026ed0984ccaa4ae5b.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Batch bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants