Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new: dev: ACM-6382: Added for parent cluster label in hs2 clusters #301

Merged
merged 3 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions qds_sdk/clusterv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def set_cluster_info_from_arguments(self, arguments):
disable_autoscale_node_pause=arguments.disable_autoscale_node_pause,
paused_autoscale_node_timeout_mins=arguments.paused_autoscale_node_timeout_mins,
parent_cluster_id=arguments.parent_cluster_id,
parent_cluster_label=arguments.parent_cluster_label,
image_version=arguments.image_version)

def set_cluster_info(self,
Expand Down Expand Up @@ -227,6 +228,7 @@ def set_cluster_info(self,
disable_autoscale_node_pause=None,
paused_autoscale_node_timeout_mins=None,
parent_cluster_id=None,
parent_cluster_label=None,
image_version=None):
"""
Args:
Expand Down Expand Up @@ -366,6 +368,7 @@ def set_cluster_info(self,
self.cluster_info['rootdisk'] = {}
self.cluster_info['rootdisk']['size'] = root_disk_size
self.cluster_info['parent_cluster_id'] = parent_cluster_id
self.cluster_info['parent_cluster_label'] = parent_cluster_label
self.cluster_info['cluster_image_version'] = image_version

self.set_spot_instance_settings(maximum_bid_price_percentage, timeout_for_request,
Expand Down Expand Up @@ -529,6 +532,9 @@ def cluster_info_parser(argparser, action):
dest="parent_cluster_id",
type=int,
help="Id of the parent cluster this hs2 cluster is attached to")
cluster_info.add_argument("--parent-cluster-label",
dest="parent_cluster_label",
help="Label of the parent cluster this hs2 cluster is attached to")
cluster_info.add_argument("--image-version",
dest="image_version",
help="cluster image version")
Expand Down
18 changes: 18 additions & 0 deletions tests/test_clusterv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,24 @@ def test_hs2_engine_config(self):
'min_nodes': 3,
'node_bootstrap': 'test_file_name',
'slave_instance_type': 'c1.xlarge' }})
def test_hs2_parent_cluster_label(self):
with tempfile.NamedTemporaryFile() as temp:
temp.write("config.properties:\na=1\nb=2".encode("utf8"))
temp.flush()
sys.argv = ['qds.py', '--version', 'v2', 'cluster', 'create', '--label',
'test_label', '--flavour', 'hs2', '--node-bootstrap-file', 'test_file_name', '--slave-instance-type', 'c1.xlarge', '--min-nodes', '3', '--parent-cluster-label', 'parent_cluster_label']
Qubole.cloud = None
print_command()
Connection._api_call = Mock(return_value={})
qds.main()
Connection._api_call.assert_called_with('POST', 'clusters',
{'engine_config':
{'flavour': 'hs2'},
'cluster_info': {'label': ['test_label'],
'parent_cluster_label': 'parent_cluster_label',
'min_nodes': 3,
'node_bootstrap': 'test_file_name',
'slave_instance_type': 'c1.xlarge' }})

def test_spark_engine_config(self):
with tempfile.NamedTemporaryFile() as temp:
Expand Down