-
Notifications
You must be signed in to change notification settings - Fork 57
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
Added E2E test to run Python wheels on interactive cluster created in bundle #1864
Merged
+102
−4
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
internal/bundle/bundles/python_wheel_task_with_cluster/databricks_template_schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"properties": { | ||
"project_name": { | ||
"type": "string", | ||
"default": "my_test_code", | ||
"description": "Unique name for this project" | ||
}, | ||
"spark_version": { | ||
"type": "string", | ||
"description": "Spark version used for job cluster" | ||
}, | ||
"node_type_id": { | ||
"type": "string", | ||
"description": "Node type id for job cluster" | ||
}, | ||
"unique_id": { | ||
"type": "string", | ||
"description": "Unique ID for job name" | ||
}, | ||
"instance_pool_id": { | ||
"type": "string", | ||
"description": "Instance pool id for job cluster" | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
internal/bundle/bundles/python_wheel_task_with_cluster/template/databricks.yml.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
bundle: | ||
name: wheel-task | ||
|
||
workspace: | ||
root_path: "~/.bundle/{{.unique_id}}" | ||
|
||
resources: | ||
clusters: | ||
test_cluster: | ||
cluster_name: "test-cluster-{{.unique_id}}" | ||
spark_version: "{{.spark_version}}" | ||
node_type_id: "{{.node_type_id}}" | ||
num_workers: 1 | ||
data_security_mode: USER_ISOLATION | ||
|
||
jobs: | ||
some_other_job: | ||
name: "[${bundle.target}] Test Wheel Job {{.unique_id}}" | ||
tasks: | ||
- task_key: TestTask | ||
existing_cluster_id: "${resources.clusters.test_cluster.cluster_id}" | ||
python_wheel_task: | ||
package_name: my_test_code | ||
entry_point: run | ||
parameters: | ||
- "one" | ||
- "two" | ||
libraries: | ||
- whl: ./dist/*.whl |
15 changes: 15 additions & 0 deletions
15
internal/bundle/bundles/python_wheel_task_with_cluster/template/setup.py.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from setuptools import setup, find_packages | ||
|
||
import {{.project_name}} | ||
|
||
setup( | ||
name="{{.project_name}}", | ||
version={{.project_name}}.__version__, | ||
author={{.project_name}}.__author__, | ||
url="https://databricks.com", | ||
author_email="john.doe@databricks.com", | ||
description="my example wheel", | ||
packages=find_packages(include=["{{.project_name}}"]), | ||
entry_points={"group1": "run={{.project_name}}.__main__:main"}, | ||
install_requires=["setuptools"], | ||
) |
2 changes: 2 additions & 0 deletions
2
...rnal/bundle/bundles/python_wheel_task_with_cluster/template/{{.project_name}}/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__version__ = "0.0.1" | ||
__author__ = "Databricks" |
16 changes: 16 additions & 0 deletions
16
...rnal/bundle/bundles/python_wheel_task_with_cluster/template/{{.project_name}}/__main__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
The entry point of the Python Wheel | ||
""" | ||
|
||
import sys | ||
|
||
|
||
def main(): | ||
# This method will print the provided arguments | ||
print("Hello from my func") | ||
print("Got arguments:") | ||
print(sys.argv) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,18 @@ import ( | |
|
||
"github.com/databricks/cli/internal" | ||
"github.com/databricks/cli/internal/acc" | ||
"github.com/databricks/cli/internal/testutil" | ||
"github.com/databricks/cli/libs/env" | ||
"github.com/google/uuid" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func runPythonWheelTest(t *testing.T, sparkVersion string, pythonWheelWrapper bool) { | ||
func runPythonWheelTest(t *testing.T, templateName string, sparkVersion string, pythonWheelWrapper bool) { | ||
ctx, _ := acc.WorkspaceTest(t) | ||
|
||
nodeTypeId := internal.GetNodeTypeId(env.Get(ctx, "CLOUD_ENV")) | ||
instancePoolId := env.Get(ctx, "TEST_INSTANCE_POOL_ID") | ||
bundleRoot, err := initTestTemplate(t, ctx, "python_wheel_task", map[string]any{ | ||
bundleRoot, err := initTestTemplate(t, ctx, templateName, map[string]any{ | ||
"node_type_id": nodeTypeId, | ||
"unique_id": uuid.New().String(), | ||
"spark_version": sparkVersion, | ||
|
@@ -45,9 +46,19 @@ func runPythonWheelTest(t *testing.T, sparkVersion string, pythonWheelWrapper bo | |
} | ||
|
||
func TestAccPythonWheelTaskDeployAndRunWithoutWrapper(t *testing.T) { | ||
runPythonWheelTest(t, "13.3.x-snapshot-scala2.12", false) | ||
runPythonWheelTest(t, "python_wheel_task", "13.3.x-snapshot-scala2.12", false) | ||
} | ||
|
||
func TestAccPythonWheelTaskDeployAndRunWithWrapper(t *testing.T) { | ||
runPythonWheelTest(t, "12.2.x-scala2.12", true) | ||
runPythonWheelTest(t, "python_wheel_task", "12.2.x-scala2.12", true) | ||
} | ||
|
||
func TestAccPythonWheelTaskDeployAndRunOnInteractiveCluster(t *testing.T) { | ||
_, wt := acc.WorkspaceTest(t) | ||
|
||
if testutil.IsAWSCloud(wt.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can create clusters on AWS right? Does the test runner not have enough permissions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a permission issue, yes |
||
t.Skip("Skipping test for AWS cloud because it is not permitted to create clusters") | ||
} | ||
|
||
runPythonWheelTest(t, "python_wheel_task_with_cluster", defaultSparkVersion, false) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 not being used in the test, should we use it in the cluster specification to reduce the time this test takes to run?
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 create an interactive cluster as part of this test, so instance_pool_id needs to be removed