Skip to content

Remove calls to self.cluster.call_async()#456

Merged
jacobtomlinson merged 2 commits intodask:mainfrom
jacobtomlinson:vm-call-async
Jun 7, 2025
Merged

Remove calls to self.cluster.call_async()#456
jacobtomlinson merged 2 commits intodask:mainfrom
jacobtomlinson:vm-call-async

Conversation

@jacobtomlinson
Copy link
Member

Currently the implementations of VMInterface call self.cluster.call_async() when they want to run a synchronous function. This reference to the parent cluster instance means that VMInterface instances can't exist outside of a cluster.

This PR adds a VMInterface.call_async method which encapsulates the call to self.cluster.call_async(). This allows others to override this method if they wish more easily.

@jacobtomlinson jacobtomlinson merged commit 67d693d into dask:main Jun 7, 2025
5 of 7 checks passed
@jacobtomlinson jacobtomlinson deleted the vm-call-async branch June 7, 2025 14:19
@armagankaratosun
Copy link
Contributor

Hey again @jacobtomlinson 👋 ,

Sorry for commenting on a merged PR, but after trying out this change in the Openstack provider, I found out that VMInterface.call_async method recursively calls itself for the floating IP creation, eventually throwing an error;

maximum recursion depth exceeded in comparison

I quickly tried to use asyncio.to_thread instead;

    async def call_async(self, f, *args, **kwargs):
        """Run a blocking function in a thread as a coroutine."""
        return await asyncio.to_thread(f, *args, **kwargs)

and it seems to be working, but since I'm no expert on this topic, I wanted to know what you might think about this issue.

@jacobtomlinson
Copy link
Member Author

Ah ok, can you open a new issue to track this?

@armagankaratosun
Copy link
Contributor

Here; #460

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