[Openstack cloud provider] Improvements on the floating ip logic#455
[Openstack cloud provider] Improvements on the floating ip logic#455armagankaratosun wants to merge 1 commit intodask:mainfrom
Conversation
| async def create_and_assign_floating_ip(self, conn): | ||
| """Create and assign a floating IP to the instance.""" | ||
| try: | ||
| loop = asyncio.get_event_loop() |
There was a problem hiding this comment.
We shouldn't be grabbing the loop here like this. Why are we changing from the standard call_async mechanism that Dask uses internally?
There was a problem hiding this comment.
Well, you are right. Let me give you a recap on why I implemented this in the first place;
I wanted to use OpenStackScheduler/OpenStackWorker on their own (without spinning up a full OpenStackCluster), but I realized that if I use cluster.call_async without a cluster, Python quite naturally complains about “different event loop.” 😄
I completely understand that this workaround (grabbing the loop and running it directly in an executor) is a bit of a hack—please let me know if you’d prefer a different approach.
There was a problem hiding this comment.
We don't really support using ProcessInterface subclasses outside of a Cluster. What is your use case for doing this?
There was a problem hiding this comment.
I have a use case where I have to provision a Dask cluster on two different OpenStack infrastructures (and they will communicate over the floating IPs). The trick here is that I only want to provision one scheduler on one of these clouds, and the workers should enroll themselves to it.
There was a problem hiding this comment.
I see. Instead of changing this logic for everyone I've opened #456 which means that you could subclass OpenStackInstance in your code and just override call_async with your own logic here. That way you have the flexibility to do what you need, but without changing this functionality for all users.
Hey all
I improved the floating ip logic by using asyncio since the create_vm function itself runs on the same event loop.
Cheers!