-
Notifications
You must be signed in to change notification settings - Fork 2
feat: get diff between latest recommendation and cluster schema [PROD-1686] #103
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
Conversation
88e815c to
9a6a51b
Compare
9a6a51b to
c0510ce
Compare
c0510ce to
138add5
Compare
moving methods to projects.py finalizing changes for tests
…code/syncsparkpy into PROD-1686/get_diff
sync/models.py
Outdated
| spark_conf: Dict | ||
| spark_version: str | ||
| runtime_engine: str | ||
| aws_attributes: Dict |
There was a problem hiding this comment.
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?
sync/api/projects.py
Outdated
| response_str = json.dumps(recommendation_response.result) | ||
| return Response( | ||
| result={ | ||
| "cluster_recommendations": json.loads(response_str), |
There was a problem hiding this comment.
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"?
sync/api/projects.py
Outdated
| def get_updated_cluster_defintion( | ||
| project_id: str, cluster_spec_str: str | ||
| ) -> Response[Union[AWSProjectConfiguration, AzureProjectConfiguration]]: | ||
| """Print Cluster Definition merged with Project Configuration Recommendations. |
There was a problem hiding this comment.
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
sync/api/projects.py
Outdated
| # 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} |
There was a problem hiding this comment.
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:
syncsparkpy/sync/_databricks.py
Line 633 in dc7a217
| def get_recommendation_cluster( |
There was a problem hiding this comment.
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:
syncsparkpy/sync/_databricks.py
Line 524 in dc7a217
| def apply_project_recommendation( |
I think we are rewriting logic that exists already
| .PHONY: test | ||
| test: | ||
| pytest | ||
| pytest -vv |
There was a problem hiding this comment.
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
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:
Related Jira Ticket (PROD-1686)
Add any relevant testing examples or screenshots.