microsoft / SynapseML

Simple and Distributed Machine Learning
http://aka.ms/spark
MIT License
5.04k stars 830 forks source link

[BUG] Azure Synapse Analytics throwing AttributeError: 'TextSentiment' object has no attribute 'setLinkedService' error #1661

Open kenshinee opened 1 year ago

kenshinee commented 1 year ago

SynapseML version

Azure Synapse Analytics Spark Pool 3.1

System information

Describe the problem

On Azure Synapse Analytics running Spark Pool 3.1

# Initialise SynapseML and Cognitive Services AnalyticsTS = (TextSentiment() .setLinkedService(CogSvcLinked) .setLanguage(_Language) .setOutputCol(_PredictionCol) .setErrorCol(_ErrorCol) .setTextCol("Comments"))

Code was running well until about 3 weeks ago when it starts throwing an error AttributeError: 'TextSentiment' object has no attribute 'setLinkedService'

Code to reproduce issue

AnalyticsTS = (TextSentiment()
    .setLinkedService(CogSvcLinked)
    .setLanguage(_Language)
    .setOutputCol(_PredictionCol)
    .setErrorCol(_ErrorCol)
    .setTextCol("Comments"))     

Other info / logs

No response

What component(s) does this bug affect?

What language(s) does this bug affect?

What integration(s) does this bug affect?

AB#2001078

github-actions[bot] commented 1 year ago

Hey @kenshinee :wave:! Thank you so much for reporting the issue/feature request :rotating_light:. Someone from SynapseML Team will be looking to triage this issue soon. We appreciate your patience.

JessicaXYWang commented 1 year ago

Hi @kenshinee, can you try

AnalyticsTS = (TextSentiment()
    .setLanguage(_Language)
    .setOutputCol(_PredictionCol)
    .setErrorCol(_ErrorCol)
    .setTextCol("Comments")
    .setLocation(service_loc) #your service location, eg "eastus"
    .setSubscriptionKey(service_key))

and see if it works?

kenshinee commented 1 year ago

@JessicaXYWang thanks for the update, I'll try that and update here.

One thing for using Subscription/Service_Key on Synapse is we may have to (powershell) map it across CI/CD process, since the key changes across Dev/Tst and Prod. The previous configuration to allow setLinkedService is a way to get around this problem as we can retain the same Link Service name across Dev/Tst and Prod.

Is setLinkedService going for good or will it return in some form in a future roadmap?

kenshinee commented 1 year ago

Tested with setLocation and SetSibscriptionKey, it is working for Text Sentiments, Key Phrase, NER and Opinion Mining.

Also, the CI/CD problem can be solved using TokenLibrary.

Thank you @JessicaXYWang, this can be close now.

mhamilton723 commented 1 year ago

This is actually our fault, ive queued up a PR to fix this #1685

kenshinee commented 1 year ago

Awesome! That's really good to know. Will keep an eye on the PR and patch.