Skip to content

Conversation

@eheinlein-sync
Copy link
Contributor

@eheinlein-sync eheinlein-sync commented Mar 4, 2024

Summary

We're adding functionality to display cluster recommendations, as well as a side by side comparison and a merged cluster definition.

Checklist

Before formally opening this PR, please adhere to the following standards:

  • Branch/PR names begin with the related Jira ticket id (ie PROD-31) for Jira integration
  • File names are lower_snake_case
  • Relevant unit tests have been added or not applicable
  • Relevant documentation has been added or not applicable
  • Mark yourself as the assignee (makes it easier to scan the PR list)

Related Jira Ticket (PROD-1686)

Add any relevant testing examples or screenshots.

@taylorgaw taylorgaw force-pushed the PROD-1686/get_diff branch from 88e815c to 9a6a51b Compare March 6, 2024 21:41
@taylorgaw taylorgaw marked this pull request as ready for review March 6, 2024 21:41
@taylorgaw taylorgaw changed the title WIP: get diff between latest recommendation and cluster schema feat: get diff between latest recommendation and cluster schema [PROD-1686] Mar 6, 2024
@taylorgaw taylorgaw force-pushed the PROD-1686/get_diff branch from 9a6a51b to c0510ce Compare March 6, 2024 21:43
@taylorgaw taylorgaw force-pushed the PROD-1686/get_diff branch from c0510ce to 138add5 Compare March 6, 2024 21:52
sync/models.py Outdated
spark_conf: Dict
spark_version: str
runtime_engine: str
aws_attributes: Dict
Copy link
Contributor

@singhals singhals Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aws_attributes in the azure config?

response_str = json.dumps(recommendation_response.result)
return Response(
result={
"cluster_recommendations": json.loads(response_str),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its one recommendation, no? "cluster_recommendations" -> "cluster_recommendation"?

def get_updated_cluster_defintion(
project_id: str, cluster_spec_str: str
) -> Response[Union[AWSProjectConfiguration, AzureProjectConfiguration]]:
"""Print Cluster Definition merged with Project Configuration Recommendations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant "Return" and not "Print" here

Comment on lines 467 to 479
# Convert Response result object to str
latest_rec_str = json.dumps(rec_response.result)
# Convert json string to json
latest_recommendation = json.loads(latest_rec_str)
cluster_definition = json.loads(cluster_spec_str)
for key in latest_recommendation.keys():
cluster_definition[key] = latest_recommendation[key]

# instance_source and driver_instance_source are not
# included in recommendation and need to be updated as well
driver_recommendation = cluster_definition["node_type_id"]
cluster_definition["instance_source"] = {"node_type_id": driver_recommendation}
cluster_definition["driver_instance_source"] = {"node_type_id": driver_recommendation}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do a deep merge here like we do when we apply a recommendation from the library:

def get_recommendation_cluster(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be good to review this pathway before merging this:

def apply_project_recommendation(

I think we are rewriting logic that exists already

.PHONY: test
test:
pytest
pytest -vv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is consistent across our other repos for make test

@taylorgaw taylorgaw requested a review from singhals March 11, 2024 22:14
@taylorgaw taylorgaw merged commit 12ad132 into main Mar 11, 2024
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.

6 participants