Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Make AzureOperationPoller thread a daemon thread #1379

Merged
merged 1 commit into from
Sep 12, 2016
Merged

Python: Make AzureOperationPoller thread a daemon thread #1379

merged 1 commit into from
Sep 12, 2016

Conversation

tjprescott
Copy link
Member

See item #1378. This PR doesn't make the use of daemon threads configurable, but that is an option too. This is the simplest fix.

@azuresdkci
Copy link

Can one of the admins verify this patch?

@azurecla
Copy link

Hi @tjprescott, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!


It looks like you're working at Microsoft (trpresco). If you're full-time, we DON'T require a contribution license agreement.



If you are a vendor, DO please sign the electronic contribution license agreement. It will take 2 minutes and there's no faxing! https://cla.azure.com.

TTYL, AZPRBOT;

@tjprescott tjprescott changed the title Make AzureOperationPoller thread a daemon thread Python: Make AzureOperationPoller thread a daemon thread Aug 29, 2016
@johanste
Copy link
Member

johanste commented Sep 1, 2016

Is http://bugs.python.org/issue1856 of concern with this change (for Python [2.x)?]

@tbombach
Copy link
Member

tbombach commented Sep 1, 2016

@azuresdkci test this please!

@tbombach
Copy link
Member

tbombach commented Sep 8, 2016

@annatisch @lmazuel Is this something we want to add to the python client runtime?

@lmazuel
Copy link
Member

lmazuel commented Sep 9, 2016

Hum.... I see your bug report @tjprescott and it makes senses. Daemon thread cannot prevent the main executable to quit. I think it's relevant. Good point.
@johanste @tjprescott did you update msrestazure on a virtualenv to confirm 100% it solves your Ctrl+C problem?

@lmazuel
Copy link
Member

lmazuel commented Sep 9, 2016

And I'm thinking it's one of the reason I got the test UI in PTVS unable to launch my tests again when I cancel a unittest that use LRO (need to quit PTVS and relaunch it). @zooba what do you think?

@tjprescott
Copy link
Member Author

@lmazuel I tested the fix's ability to break out of our CLI in both Python 2.7 and 3.5 virtual environments and it worked as expected. On Linux you need only press Ctrl+C once and it breaks to command line. On CMD you press it once and you'll get the "Terminate batch operation Y/N" prompt which is much better than before where you had to press it multiple times and still incur a lengthy polling delay before you would get that prompt.

This is the simplest fix but I don't know that there wouldn't be applications that specifically would NOT want daemon threads. If that is the case it might be better to make it an optional parameter when the LRO is created.

@lmazuel
Copy link
Member

lmazuel commented Sep 9, 2016

@annatisch I think it's best to accept the PR, it should be the default. However, we might want to add a configuration item in the azure_configuration object for this. In this case, we create another issue (low priority) like "Add daemon thread LRO parameter to azure_configuration". Thoughts?

@annatisch
Copy link
Member

@lmazuel Sounds good :)

@lmazuel
Copy link
Member

lmazuel commented Sep 9, 2016

Created the issue for conf: #1416
@tbombach you can merge when you want :)
thanks @tjprescott for the PR!

@tbombach tbombach merged commit 13a1e62 into Azure:master Sep 12, 2016
@tbombach
Copy link
Member

Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants