Create the webservice's MyMDC client in a non-blocking thread
Description
This fixes blocking the event loop by creating the MyMDC client in another thread.
How Has This Been Tested?
This was tested on xcaltst@max-exfl017
to ensure that the web service starts correctly, the client is correctly created, and that jobs can be submitted as usual.
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist:
- My code follows the code style of this project.
- My change requires a change to the documentation.
- I have updated the documentation accordingly.
Reviewers
Merge request reports
Activity
60 60 """ 61 # FIXME: this blocks the even loop, should use asyncio.Task 62 # FIXME: calls to this coro should be shielded 63 61 # TODO: could the client be a global? This would recuce passing it around 64 mdconf = config['metadata-client'] 65 client_conn = MetadataClient(client_id=mdconf['user-id'], 66 client_secret=mdconf['user-secret'], 67 user_email=mdconf['user-email'], 68 token_url=mdconf['token-url'], 69 refresh_url=mdconf['refresh-url'], 70 auth_url=mdconf['auth-url'], 71 scope=mdconf['scope'], 72 base_api_url=mdconf['base-api-url']) 73 return client_conn 62 63 # During MetadataClient initialisation, the object does requests to MyMDC - Edited by Karim Ahmed
changed this line in version 3 of the diff
- Resolved by Cyril Danilevski
added 1 commit
- fb184ff1 - Apply suggestion to webservice/webservice.py
added 1 commit
- 1ddee74a - Apply suggestion to webservice/webservice.py
Technically this looks good to me, but as we discussed in chat, I'm not sure about the direction. We have quite a lot of blocking calls and not a lot of concurrency, especially at initialisation (just two tasks). Wrapping everything in thread executors to make it async seems a bit ugly when it could be simple blocking calls in a couple of threads.
The bit I'm not sure about is the secondary tasks we create on requests to wait for migration to complete. Maybe it's worth using asyncio for those.
mentioned in commit e16be648