Skip to content

Commit

Permalink
fixed yet another set of linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
armagankaratosun committed Aug 29, 2024
1 parent 1e79dca commit cc7f275
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dask_cloudprovider/openstack/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
)
raise ImportError(msg) from e


class OpenStackInstance(VMInterface):
def __init__(
self,
Expand Down Expand Up @@ -175,6 +176,7 @@ async def stop_vm(self):
# Code to stop the instance
pass # Placeholder to ensure correct indentation


class OpenStackScheduler(SchedulerMixin, OpenStackInstance):
"""Scheduler running on an OpenStack Instance."""

Expand Down Expand Up @@ -212,9 +214,11 @@ async def start_scheduler(self):
self.cluster.scheduler_external_ip = self.external_ip
self.cluster.scheduler_port = self.port


class OpenStackWorker(WorkerMixin, OpenStackInstance):
"""Worker running on a OpenStack Instance."""


class OpenStackCluster(VMCluster):
"""Cluster running on Openstack VM Instances
Expand Down Expand Up @@ -316,8 +320,8 @@ class OpenStackCluster(VMCluster):
Security Group: all-open
Creating scheduler instance
dask-9b85a5f8-scheduler
Internal IP: 10.0.30.148
External IP: None
Internal IP: 10.0.30.148
External IP: None
Waiting for scheduler to run at 10.0.30.148:8786
Scheduler is running
Creating worker instance
Expand Down
10 changes: 10 additions & 0 deletions dask_cloudprovider/openstack/tests/test_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from distributed.core import Status

# Optional: Skips tests if OpenStack credentials are not set


async def skip_without_credentials(config):
if (
config.get("auth_url") is None
Expand All @@ -25,22 +27,28 @@ async def skip_without_credentials(config):
"""
)


@pytest.fixture
async def config():

return dask.config.get("cloudprovider.openstack", {})


@pytest.fixture
@pytest.mark.external
async def cluster(config):
await skip_without_credentials(config)

async with OpenStackCluster(asynchronous=True) as cluster:
yield cluster


@pytest.mark.asyncio
async def test_init():
cluster = OpenStackCluster(asynchronous=True)
assert cluster.status == Status.created


@pytest.mark.asyncio
@pytest.mark.timeout(600)
async def test_create_cluster(cluster):
Expand All @@ -52,10 +60,12 @@ async def test_create_cluster(cluster):
async with Client(cluster, asynchronous=True) as client:

def inc(x):

return x + 1

assert await client.submit(inc, 10).result() == 11


@pytest.mark.asyncio
async def test_get_cloud_init():
cloud_init = OpenStackCluster.get_cloud_init(
Expand Down

0 comments on commit cc7f275

Please sign in to comment.