Skip to content

azure-mgmt-appcontainers: ContainerAppsAPIClient.job_execution is missing some properties #34445

Closed
@anthonychu

Description

@anthonychu
  • Package Name: azure-mgmt-appcontainers
  • Package Version: 3.0.0
  • Operating System: macOS Ventura 13.6.4
  • Python Version: 3.11.7

Describe the bug
When retrieving a Container Apps job using ContainerAppsAPIClient.job_execution(), some properties are empty. Instead, they need to be accessed using additional_properties.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Container Apps environment and job using Azure CLI:
    az containerapp env create -n test-jobs -g test-jobs -l northcentralus
    az containerapp job create -n test -g test-jobs --environment test-jobs --image mcr.microsoft.com/k8se/quickstart-jobs:latest --trigger manual
  2. Start a job execution:
    az containerapp job start -n test -g test-jobs
  3. Retrieve the job using the SDK:
    import os
    from azure.identity import DefaultAzureCredential
    from azure.mgmt.appcontainers import ContainerAppsAPIClient
    
    
    credential = DefaultAzureCredential()
    client = ContainerAppsAPIClient(credential, os.environ['AZURE_SUBSCRIPTION_ID'])
    
    job_execution = client.job_execution("test-jobs", "test", "ENTER_JOB_EXECUTION_ID_HERE")
    
    print(job_execution)
    This prints (reformatted for readability):
    {
        "additional_properties": {
            "properties": {
                "status": "Succeeded",
                "startTime": "2024-02-24T00:09:17+00:00",
                "endTime": "2024-02-24T00:09:37+00:00",
                "template": {
                    "containers": [
                        {
                            "image": "mcr.microsoft.com/k8se/quickstart-jobs:latest",
                            "name": "test",
                            "env": [
                                {
                                    "name": "CONTAINER_APP_JOB_NAME",
                                    "value": "test"
                                },
                                {
                                    "name": "CONTAINER_APP_JOB_EXECUTION_NAME",
                                    "value": ""
                                },
                                {
                                    "name": "CONTAINER_APP_REPLICA_NAME",
                                    "value": ""
                                }
                            ],
                            "resources": {
                                "cpu": 0.5,
                                "memory": "1Gi",
                                "ephemeralStorage": ""
                            }
                        }
                    ],
                    "initContainers": []
                }
            }
        },
        "name": "test-g4y3l32",
        "id": "/subscriptions/****/resourceGroups/test-jobs/providers/Microsoft.App/jobs/test/executions/test-****",
        "type": "Microsoft.App/jobs/executions",
        "status": None,
        "start_time": None,
        "end_time": None,
        "template": None
    }
    Notice that status, start_time, end_time, and template at the root of the job are None. The actual values are tucked under additional_properties.properties.

Expected behavior

  1. status, start_time, end_time, and template should be filled in.
  2. additional_properties don't need to be included.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

MgmtThis issue is related to a management-plane library.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions