MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.01k stars 21k forks source link

Adding tags to existing jobs #122250

Closed thegitofdaniel closed 1 week ago

thegitofdaniel commented 1 week ago

Hello team,

Is there documentation on how to use the Python-SDK to add tags to existing jobs?

I have the following snippet that works for existing models:

# https://learn.microsoft.com/en-us/azure/machine-learning/how-to-manage-models?view=azureml-api-2&tabs=python%2Cuse-local
model = ml_client.models.get(name=model_name, version=model_version)
print(model.tags)
model.tags = {'hello': 'world'}
ml_client.models.create_or_update(model) # prints { }
model = ml_client.models.get(name=model_name, version=model_version)
print(model.tags) # prints {'hello': 'world'}

However, a similar implementation for jobs returns an error:

job = ml_client.jobs.get(name=job_id)
print(job.tags) # prints tags
job.tags = {'hello': 'world'}
ml_client.jobs.create_or_update(job) # raises error
job = ml_client.jobs.get(name=job_id)
print(job.tags)

The error is:

HttpResponseError: (UserError) A job with this name already exists. If you are trying to create a new job, use a different name. If you are trying to update an existing job, the existing job's Settings,  Inputs,  Outputs,  Jobs,  InputBindings,  OutputBindings cannot be changed. Only description, tags, displayName, properties, and isArchived can be updated.
Code: UserError
Message: A job with this name already exists. If you are trying to create a new job, use a different name. If you are trying to update an existing job, the existing job's Settings,  Inputs,  Outputs,  Jobs,  InputBindings,  OutputBindings cannot be changed. Only description, tags, displayName, properties, and isArchived can be updated.
Additional Information:Type: ComponentName
Info: {
    "value": "managementfrontend"
}Type: Correlation
Info: {
    "value": {
        "operation": "d73798c94b1ea7ff12610979d5739cfe",
        "request": "f69a44ecb01fac85"
    }
}Type: Environment
Info: {
    "value": "westeurope"
}Type: Location
Info: {
    "value": "westeurope"
}Type: Time
Info: {
    "value": "2024-05-06T08:52:23.80523+00:00"
}Type: InnerError
Info: {
    "value": {
        "code": "Immutable",
        "innerError": {
            "code": "JobPropertyImmutable",
            "innerError": null
        }
    }
}Type: MessageFormat
Info: {
    "value": "A job with this name already exists. If you are trying to create a new job, use a different name. If you are trying to update an existing job, the existing job's{property} cannot be changed. Only description, tags, displayName, properties, and isArchived can be updated."
}Type: MessageParameters
Info: {
    "value": {
        "property": " Settings,  Inputs,  Outputs,  Jobs,  InputBindings,  OutputBindings"
    }
}

Further info:

I appreaciate your support, Daniel


Document Details

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

TPavanBalaji commented 1 week ago

@thegitofdaniel Thanks for your feedback! We will investigate and update as appropriate.

AjayBathini-MSFT commented 1 week ago

@thegitofdaniel I'd recommend working closer with our support team via an [Azure support request] (https://docs.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request). Or you can leverage our Q&A forum by posting your issue there so our community, and MVPs can further assist you in troubleshooting this issue or finding potential workarounds. [Teams Q&A forum] (https://docs.microsoft.com/en-us/answers/topics/46488/office-teams-windows-itpro.html) for technical questions about the configuration and administration of Microsoft Teams on Windows. [Microsoft Teams Community forum] (https://answers.microsoft.com/en-us/msteams/forum?sort=LastReplyDate&dir=Desc&tab=All&status=all&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=All&isFilterExpanded=false&page=1) Thank you for your time and patience throughout this issue.