Skip to content

[Openstack cloud provider] Improvements on the floating ip logic#455

Closed
armagankaratosun wants to merge 1 commit intodask:mainfrom
armagankaratosun:main
Closed

[Openstack cloud provider] Improvements on the floating ip logic#455
armagankaratosun wants to merge 1 commit intodask:mainfrom
armagankaratosun:main

Conversation

@armagankaratosun
Copy link
Contributor

Hey all

I improved the floating ip logic by using asyncio since the create_vm function itself runs on the same event loop.

Cheers!

async def create_and_assign_floating_ip(self, conn):
"""Create and assign a floating IP to the instance."""
try:
loop = asyncio.get_event_loop()
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't be grabbing the loop here like this. Why are we changing from the standard call_async mechanism that Dask uses internally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

We don't really support using ProcessInterface subclasses outside of a Cluster. What is your use case for doing this?

Copy link
Contributor Author

@armagankaratosun armagankaratosun Jun 6, 2025

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

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.

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.

2 participants