azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG]`ContinuousWebJobStatus` Enum values does not cover possible values

Open georgeOsdDev opened this issue 3 years ago • 5 comments
trafficstars

Library name and version

Azure.ResourceManager.AppService 1.0.0

Describe the bug

Currently there are 5 status defined as ContinuousWebJobStatus Enum values. This 5 values does not cover actual status. For example Stopping, Disabling.

https://learn.microsoft.com/ja-jp/dotnet/api/azure.resourcemanager.appservice.models.continuouswebjobstatus?view=azure-dotnet https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContinuousWebJobStatus.cs

I think this code is auto generated so that other language SDK such as python sdk may has same issue. https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_03_01/models/_web_site_management_client_enums.py#L238-L246

I'm not sure that below kudu code is related or not, there are InactiveInstance, Failed,Aborted,Stopping, Disabling. These status are not contained by SDK side. https://github.com/projectkudu/kudu/blob/98ad238b860f81a4cb4e3419c8785a58ba68e661/Kudu.Core/Jobs/JobStatus.cs

I found related closed issues. https://github.com/Azure/azure-sdk-for-net/issues/4269 https://github.com/MicrosoftDocs/azure-docs/issues/32612

Expected behavior

Serialization from api response should be success.

Actual behavior

When responded status was "Stopping", ArgumentOutOfRangeException was thrown.

System.ArgumentOutOfRangeException: Unknown ContinuousWebJobStatus value. (Parameter 'value')
Actual value was Stopping.
   at Azure.ResourceManager.AppService.Models.ContinuousWebJobStatusExtensions.ToContinuousWebJobStatus(String value)
   at Azure.ResourceManager.AppService.ContinuousWebJobData.DeserializeContinuousWebJobData(JsonElement element)
   at Azure.ResourceManager.AppService.WebAppsRestOperations.GetContinuousWebJobAsync(String subscriptionId, String resourceGroupName, String name, String webJobName, CancellationToken cancellationToken)
   at Azure.ResourceManager.AppService.WebSiteContinuousWebJobCollection.GetAsync(String webJobName, CancellationToken cancellationToken)
   at Azure.ResourceManager.AppService.WebSiteResource.GetWebSiteContinuousWebJobAsync(String webJobName, CancellationToken cancellationToken)

Reproduction Steps

  1. Create webjob and run it.

index.js on webJob

while(true){
  setTimeout(() => {
    console.log("WebJob!")
  },10000);
}
  1. Run below code to watch webjob status
ArmClient armClient = new ArmClient(credential);
ResourceGroupResource  resourceGroup = await armClient.GetDefaultSubscription().GetResourceGroupAsync(myResourceGroup);
WebSiteResource website = await resourceGroup.GetWebSiteAsync(myApp);
while (true)
{
        WebSiteContinuousWebJobResource webjob = await website.GetWebSiteContinuousWebJobAsync(myWebJob);
        Console.WriteLine(webjob.Data.Status);
}
  1. Stop webjob from Azure portal

Environment

$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.202
 Commit:    f8a55617d2

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.202/

Host (useful for support):
  Version: 6.0.4
  Commit:  be98e88c76

.NET SDKs installed:
  5.0.102 [/usr/share/dotnet/sdk]
  6.0.202 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.15 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

georgeOsdDev avatar Nov 09 '22 11:11 georgeOsdDev

Label prediction was below confidence level 0.6 for Model:ServiceLabels: 'App Services:0.45673984,ARM:0.24766493,Azure.Identity:0.07017728'

azure-sdk avatar Nov 09 '22 11:11 azure-sdk

I tried Python SDK

resource_client = ResourceManagementClient(credential, subscription_id)
web_client = WebSiteManagementClient(credential, subscription_id)
while True:
    webjob = web_client.web_apps.get_continuous_web_job(GROUP_NAME, SITE_NAME, "myJob2")
    print(webjob.status)

And It work without exception even if responded status was Stopping or Disabling.

I think Python SDK allow if actual status is not contained pre defined ContinuousWebJobStatus Enum https://learn.microsoft.com/ja-jp/python/api/azure-mgmt-web/azure.mgmt.web.v2021_02_01.models.continuouswebjob?view=azure-python image

georgeOsdDev avatar Nov 09 '22 12:11 georgeOsdDev

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Nov 09 '22 13:11 jsquire

@georgeOsdDev based on this swagger definition https://github.com/Azure/azure-rest-api-specs/blob/9918d83b021f4abe956ca3be5df358482f50433a/specification/web/resource-manager/Microsoft.Web/stable/2022-03-01/WebApps.json#L24129 the status only includes:

"Initializing", "Starting", "Running", "PendingRestart", "Stopped"

Service team need update their swagger to adopt new enum value

xboxeer avatar Nov 11 '22 06:11 xboxeer

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @antcp, @AzureAppServiceCLI.

Issue Details

Library name and version

Azure.ResourceManager.AppService 1.0.0

Describe the bug

Currently there are 5 status defined as ContinuousWebJobStatus Enum values. This 5 values does not cover actual status. For example Stopping, Disabling.

https://learn.microsoft.com/ja-jp/dotnet/api/azure.resourcemanager.appservice.models.continuouswebjobstatus?view=azure-dotnet https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContinuousWebJobStatus.cs

I think this code is auto generated so that other language SDK such as python sdk may has same issue. https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2022_03_01/models/_web_site_management_client_enums.py#L238-L246

I'm not sure that below kudu code is related or not, there are InactiveInstance, Failed,Aborted,Stopping, Disabling. These status are not contained by SDK side. https://github.com/projectkudu/kudu/blob/98ad238b860f81a4cb4e3419c8785a58ba68e661/Kudu.Core/Jobs/JobStatus.cs

I found related closed issues. https://github.com/Azure/azure-sdk-for-net/issues/4269 https://github.com/MicrosoftDocs/azure-docs/issues/32612

Expected behavior

Serialization from api response should be success.

Actual behavior

When responded status was "Stopping", ArgumentOutOfRangeException was thrown.

System.ArgumentOutOfRangeException: Unknown ContinuousWebJobStatus value. (Parameter 'value')
Actual value was Stopping.
   at Azure.ResourceManager.AppService.Models.ContinuousWebJobStatusExtensions.ToContinuousWebJobStatus(String value)
   at Azure.ResourceManager.AppService.ContinuousWebJobData.DeserializeContinuousWebJobData(JsonElement element)
   at Azure.ResourceManager.AppService.WebAppsRestOperations.GetContinuousWebJobAsync(String subscriptionId, String resourceGroupName, String name, String webJobName, CancellationToken cancellationToken)
   at Azure.ResourceManager.AppService.WebSiteContinuousWebJobCollection.GetAsync(String webJobName, CancellationToken cancellationToken)
   at Azure.ResourceManager.AppService.WebSiteResource.GetWebSiteContinuousWebJobAsync(String webJobName, CancellationToken cancellationToken)

Reproduction Steps

  1. Create webjob and run it.

index.js on webJob

while(true){
  setTimeout(() => {
    console.log("WebJob!")
  },10000);
}
  1. Run below code to watch webjob status
ArmClient armClient = new ArmClient(credential);
ResourceGroupResource  resourceGroup = await armClient.GetDefaultSubscription().GetResourceGroupAsync(myResourceGroup);
WebSiteResource website = await resourceGroup.GetWebSiteAsync(myApp);
while (true)
{
        WebSiteContinuousWebJobResource webjob = await website.GetWebSiteContinuousWebJobAsync(myWebJob);
        Console.WriteLine(webjob.Data.Status);
}
  1. Stop webjob from Azure portal

Environment

$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.202
 Commit:    f8a55617d2

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.202/

Host (useful for support):
  Version: 6.0.4
  Commit:  be98e88c76

.NET SDKs installed:
  5.0.102 [/usr/share/dotnet/sdk]
  6.0.202 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.15 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
Author: georgeOsdDev
Assignees: xboxeer
Labels:

App Services, Service Attention, Mgmt, customer-reported, question, needs-team-attention, CXP Attention

Milestone: -

ghost avatar Nov 11 '22 06:11 ghost

This issue is related to the service side and not the SDK side, so we are not able to help you with it. Therefore, we are closing this issue for now. If you need more assistance, please open an Azure support request. We apologize for any inconvenience this may cause you.

We value your feedback and we want to make sure that your problem is solved. If you think that we have misunderstood your issue or closed it incorrectly, please feel free to comment on this thread and reopen the issue. We will be happy to assist you further. Thank you for your understanding and cooperation.

ArthurMa1978 avatar Aug 09 '23 10:08 ArthurMa1978