microsoft / SynapseML

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

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

Open kenshinee opened 2 years ago

kenshinee commented 2 years 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 2 years 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 2 years 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 2 years 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 2 years 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 2 years ago

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

kenshinee commented 2 years ago

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