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

PLAT-10695 AsyncIO/Proxy usage on Windows #184

Merged
merged 6 commits into from
May 12, 2021

Conversation

symphony-mariacristina
Copy link
Contributor

@symphony-mariacristina symphony-mariacristina commented May 10, 2021

Ticket

PLAT-10695

Description

Default event loop policy has to be changed on Windows + Python 3.8 if a proxy is used. Goal of this PR is to make sure that if these conditions applies our BDK 2.0 examples will still be workingas expected, by setting the event loop policy correctly.

Seems like the init.py is executed only once https://stackoverflow.com/questions/39452319/at-which-moment-and-how-often-are-executed-the-init-py-files-by-python

Checklist

  • Referenced a ticket in the PR title and in the corresponding section
  • Filled properly the description and dependencies, if any
  • Unit tests updated or added
  • Docstrings added or updated
  • Updated the documentation in docs folder

Default event loop policy has to be changed on Windows + Python 3.8 if a proxy is used. Goal of this PR is to make sure that if these conditions applies our BDK 2.0 examples will still be workingas expected, by setting the event loop policy correctly.
@symphony-mariacristina symphony-mariacristina requested a review from a team May 10, 2021 14:19
Copy link
Contributor

@symphony-youri symphony-youri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we could have this automatically?

like making it part of the imported module definition? so that it runs before starting the event loop but automatically

@symphony-youri
Copy link
Contributor

Is there a way we could have this automatically?

like making it part of the imported module definition? so that it runs before starting the event loop but automatically

that's tricky because we have to load the proxy first
is there a risk in using this event loop all the time on Windows? (so we drop the dependency on the configuration)

@symphony-mariacristina
Copy link
Contributor Author

is there a risk in using this event loop all the time on Windows? (so we drop the dependency on the configuration)

I tested by always using asyncio.WindowsSelectorEventLoopPolicy() on windows and without a proxy seems like everything is working fine. I'll remove the config.proxy is not None condition.

@symphony-youri
Copy link
Contributor

is there a risk in using this event loop all the time on Windows? (so we drop the dependency on the configuration)

I tested by always using asyncio.WindowsSelectorEventLoopPolicy() on windows and without a proxy seems like everything is working fine. I'll remove the config.proxy is not None condition.

I remember that I tried to understand the difference between the 2 policies but could not find something very interesting, IMHO Windows is (should?) mostly used for dev so we should be good 🤞

@@ -51,3 +52,4 @@ ssl:
trustStore:
path: /path/to/cert.pem
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in finos/generator-symphony#115, it could be great to have a point mentioning the windows + proxy case, the error and the fix.

Copy link
Contributor

@symphony-youri symphony-youri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed right now, let's drop the FAQ part since the workaround is embedded now
and add a comment in init.py to explain why we do that

@symphony-mariacristina symphony-mariacristina merged commit 6ca96a6 into finos:2.0 May 12, 2021
symphony-elias added a commit that referenced this pull request May 24, 2021
* Updated documentation about slash commands (#181)

* PLAT-10817: documented how to solve self signed certificate issues (#182)

* PLAT-10817: documented how to solve self signed certificate issues

* Updated poetry deps

* PLAT-10564: Documentation of User Joined Room activity (#183)

* Added missing user joined room activity

* Updated links to the developers documentation in markdown doc

* PLAT-10710: Implement the retry mechanism (#180)

* PLAT-10710 Add global and Datafeed retry configuration

* PLAT-10710 Add modified implementation of tenacity.AsyncRetrying handling asynchronously defined retry callbacks

* PLAT-10710 Create a custom retry decorator to fetch the retry configuration from each service instance

* PLAT-10710 Add retry decorator to services

* PLAT-10695 AsyncIO/Proxy usage on Windows (#184)

* PLAT-10695 AsyncIO/Proxy usage on Windows

Default event loop policy has to be changed on Windows + Python 3.8 if a proxy is used. Goal of this PR is to make sure that if these conditions applies our BDK 2.0 examples will still be working as expected, by setting the event loop policy correctly.

* Security review fixes for Python BDK 2.0 (#185)

* PLAT-10870 removed useless self assigment

* PLAT-10867 removed Potential Leak of sensitive information on logs

* PLAT-10862 removed Useless self assigment

* PLAT-10885: removed legacy folder from 2.0 branch (#190)

* PLAT-10829: Added a Message class to make the sending of message easier (#187)

* Updated poetry deps

* PLAT-10829: Added Message class to ease message sending

* PLAT-10866 PLAT-10869 (#191)

* PLAT-10866: Replaced native xml lib by defusedxml

* PLAT-10869: Improved conditional structure in model_utils

* PLAT-10789 Make bot username and appId mandatory in configuration (#189)

* PLAT-10789 Make Bot username and appId mandatory in configuation

Goal of this PR is to make the bot username field mandatory in the configuration file while trying to configure a bot.
Same behaviour is been implemented for the appId when app is found in the config

* PLAT-10698: Bumped version to 2.0b3

Co-authored-by: symphony-youness <76746033+symphony-youness@users.noreply.github.com>
Co-authored-by: Mariacristina De Dominicis <65179248+symphony-mariacristina@users.noreply.github.com>
Co-authored-by: Soufiane Aourinmouche <52406574+symphony-soufiane@users.noreply.github.com>
symphony-youness added a commit to symphony-youness/symphony-api-client-python that referenced this pull request Jun 4, 2021
* Updated documentation about slash commands (finos#181)

* PLAT-10817: documented how to solve self signed certificate issues (finos#182)

* PLAT-10817: documented how to solve self signed certificate issues

* Updated poetry deps

* PLAT-10564: Documentation of User Joined Room activity (finos#183)

* Added missing user joined room activity

* Updated links to the developers documentation in markdown doc

* PLAT-10710: Implement the retry mechanism (finos#180)

* PLAT-10710 Add global and Datafeed retry configuration

* PLAT-10710 Add modified implementation of tenacity.AsyncRetrying handling asynchronously defined retry callbacks

* PLAT-10710 Create a custom retry decorator to fetch the retry configuration from each service instance

* PLAT-10710 Add retry decorator to services

* PLAT-10695 AsyncIO/Proxy usage on Windows (finos#184)

* PLAT-10695 AsyncIO/Proxy usage on Windows

Default event loop policy has to be changed on Windows + Python 3.8 if a proxy is used. Goal of this PR is to make sure that if these conditions applies our BDK 2.0 examples will still be working as expected, by setting the event loop policy correctly.

* Security review fixes for Python BDK 2.0 (finos#185)

* PLAT-10870 removed useless self assigment

* PLAT-10867 removed Potential Leak of sensitive information on logs

* PLAT-10862 removed Useless self assigment

* PLAT-10885: removed legacy folder from 2.0 branch (finos#190)

* PLAT-10829: Added a Message class to make the sending of message easier (finos#187)

* Updated poetry deps

* PLAT-10829: Added Message class to ease message sending

* PLAT-10866 PLAT-10869 (finos#191)

* PLAT-10866: Replaced native xml lib by defusedxml

* PLAT-10869: Improved conditional structure in model_utils

* PLAT-10789 Make bot username and appId mandatory in configuration (finos#189)

* PLAT-10789 Make Bot username and appId mandatory in configuation

Goal of this PR is to make the bot username field mandatory in the configuration file while trying to configure a bot.
Same behaviour is been implemented for the appId when app is found in the config

* PLAT-10698: Bumped version to 2.0b3

Co-authored-by: symphony-youness <76746033+symphony-youness@users.noreply.github.com>
Co-authored-by: Mariacristina De Dominicis <65179248+symphony-mariacristina@users.noreply.github.com>
Co-authored-by: Soufiane Aourinmouche <52406574+symphony-soufiane@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants