def test(): cluster = GatewayCluster( address=gateway_proc.public_urls.connect_url, proxy_address=gateway_proc.gateway_urls.connect_url, ) assert cluster.shutdown_on_close assert cluster in GatewayCluster._instances
async def test_create_cluster_with_GatewayCluster_constructor(tmpdir): async with temp_gateway(cluster_manager_class=InProcessClusterManager, temp_dir=str(tmpdir)) as gateway_proc: async with GatewayCluster( address=gateway_proc.public_urls.connect_url, proxy_address=gateway_proc.gateway_urls.connect_url, asynchronous=True, ) as cluster: # Cluster is now present in list clusters = await cluster.gateway.list_clusters() assert len(clusters) assert clusters[0].name == cluster.name await cluster.scale(1) with cluster.get_client(set_as_default=False) as client: res = await client.submit(lambda x: x + 1, 1) assert res == 2 assert cluster.status == "closed" async with Gateway( address=gateway_proc.public_urls.connect_url, proxy_address=gateway_proc.gateway_urls.connect_url, asynchronous=True, ) as gateway: # No cluster running clusters = await gateway.list_clusters() assert not clusters
def test(): with GatewayCluster(address=g.address, proxy_address=g.proxy_address) as cluster: # Smoke test widget cluster._widget() template = "<tr><th>Workers</th> <td>%d</td></tr>" assert (template % 0) in cluster._widget_status() cluster.scale(1) timeout = time.time() + 30 while time.time() < timeout: if cluster.scheduler_info.get("workers"): break time.sleep(0.25) else: assert False, "didn't scale up in time" assert (template % 1) in cluster._widget_status()
async def test_create_cluster_with_GatewayCluster_constructor(): async with temp_gateway() as g: async with GatewayCluster(address=g.address, proxy_address=g.proxy_address, asynchronous=True) as cluster: # Cluster is now present in list clusters = await cluster.gateway.list_clusters() assert len(clusters) assert clusters[0].name == cluster.name await cluster.scale(1) async with cluster.get_client(set_as_default=False) as client: res = await client.submit(lambda x: x + 1, 1) assert res == 2 assert cluster.status == "closed" async with g.gateway_client() as gateway: # No cluster running clusters = await gateway.list_clusters() assert not clusters
def test(): return GatewayCluster(address=g.address, proxy_address=g.proxy_address)
def test(): cluster = GatewayCluster(address=g.address, proxy_address=g.proxy_address) assert cluster.shutdown_on_close assert cluster in GatewayCluster._instances
def test(): return GatewayCluster( address=gateway_proc.public_urls.connect_url, proxy_address=gateway_proc.gateway_urls.connect_url, )