Skip to content

Commit

Permalink
Allowing explicit passing of the resource group for VNET (#117)
Browse files Browse the repository at this point in the history
* If the resource group name for VNET is mentioned then that should be used while creating the VNET. If resource group name is not passed, but the names for VNET and SUBNET are passed, then resource group for the workspace will be used while creating the VNET.

* Correcting the directory name for flake-8 check

* Reverting back the change related to flake8

Co-authored-by: Arnab Biswas <arnab.biswas@carrier.com>
  • Loading branch information
arnabbiswas1 and Arnab Biswas committed Aug 6, 2020
1 parent 4a1349d commit 4b211ef
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion dask_cloudprovider/providers/azure/azureml.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ class AzureMLCluster(Cluster):
Defaults to ``""``.
vnet: str (optional)
Name of the virtual network.
subnet: str (optional)
Name of the subnet inside the virtual network ``vnet``.
vnet_resource_group: str (optional)
Name of the resource group where the virtual network ``vnet``
is located. If not passed, but names for ``vnet`` and ``subnet`` are
passed, ``vnet_resource_group`` is assigned with the name of resource
group associted with ``workspace``
telemetry_opt_out: bool (optional)
A boolean parameter. Defaults to logging a version of AzureMLCluster
with Microsoft. Set this flag to False if you do not want to share this
Expand Down Expand Up @@ -147,6 +159,7 @@ def __init__(
admin_ssh_key=None,
datastores=None,
code_store=None,
vnet_resource_group=None,
vnet=None,
subnet=None,
show_output=False,
Expand Down Expand Up @@ -179,6 +192,7 @@ def __init__(
## CREATE COMPUTE TARGET
self.admin_username = admin_username
self.admin_ssh_key = admin_ssh_key
self.vnet_resource_group = vnet_resource_group
self.vnet = vnet
self.subnet = subnet
self.compute_target_set = True
Expand Down Expand Up @@ -465,9 +479,12 @@ def __create_compute_target(self):
ssh_key_pub, self.admin_ssh_key = self.__get_ssh_keys()

if self.vnet and self.subnet:
vnet_rg = self.workspace.resource_group
vnet_name = self.vnet
subnet_name = self.subnet
if self.vnet_resource_group:
vnet_rg = self.vnet_resource_group
else:
vnet_rg = self.workspace.resource_group

try:
if ct_name not in self.workspace.compute_targets:
Expand Down Expand Up @@ -975,3 +992,4 @@ def close(self):
return to its minimum number of nodes after its idle time before scaledown.
"""
return self.sync(self._close)

0 comments on commit 4b211ef

Please sign in to comment.