acc: Simplify integration_whl tests (#2479)

## Changes
Instead of full templates, only template databricks.yml and use envsubst
for that.
This commit is contained in:
Denis Bilenko 2025-03-14 09:52:20 +01:00 committed by GitHub
parent 036061f8b5
commit b2c87ae5d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 80 additions and 201 deletions

View File

@ -2,25 +2,23 @@ bundle:
name: wheel-task name: wheel-task
workspace: workspace:
root_path: "~/.bundle/{{.unique_id}}" root_path: "~/.bundle/$UNIQUE_NAME"
{{if .python_wheel_wrapper}} include:
experimental: - $EXTRA_CONFIG
python_wheel_wrapper: true
{{end}}
resources: resources:
jobs: jobs:
some_other_job: some_other_job:
name: "[${bundle.target}] Test Wheel Job {{.unique_id}}" name: "[${bundle.target}] Test Wheel Job $UNIQUE_NAME"
tasks: tasks:
- task_key: TestTask - task_key: TestTask
new_cluster: new_cluster:
num_workers: 1 num_workers: 1
spark_version: "{{.spark_version}}" spark_version: $DEFAULT_SPARK_VERSION
node_type_id: "{{.node_type_id}}" node_type_id: $NODE_TYPE_ID
data_security_mode: USER_ISOLATION data_security_mode: USER_ISOLATION
instance_pool_id: "{{.instance_pool_id}}" instance_pool_id: $TEST_INSTANCE_POOL_ID
python_wheel_task: python_wheel_task:
package_name: my_test_code package_name: my_test_code
entry_point: run entry_point: run

View File

@ -1,29 +0,0 @@
{
"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"
},
"python_wheel_wrapper": {
"type": "boolean",
"description": "Whether or not to enable python wheel wrapper"
},
"instance_pool_id": {
"type": "string",
"description": "Instance pool id for job cluster"
}
}
}

View File

@ -1,15 +1,4 @@
>>> cat input.json
{
"project_name": "my_test_code",
"spark_version": "13.3.x-snapshot-scala2.12",
"node_type_id": "[NODE_TYPE_ID]",
"unique_id": "[UNIQUE_NAME]",
"python_wheel_wrapper": false,
"instance_pool_id": "[TEST_INSTANCE_POOL_ID]"
}
✨ Successfully initialized template
>>> cat databricks.yml >>> cat databricks.yml
bundle: bundle:
name: wheel-task name: wheel-task
@ -17,7 +6,8 @@ bundle:
workspace: workspace:
root_path: "~/.bundle/[UNIQUE_NAME]" root_path: "~/.bundle/[UNIQUE_NAME]"
include:
- empty.yml
resources: resources:
jobs: jobs:
@ -27,10 +17,10 @@ resources:
- task_key: TestTask - task_key: TestTask
new_cluster: new_cluster:
num_workers: 1 num_workers: 1
spark_version: "13.3.x-snapshot-scala2.12" spark_version: 13.3.x-snapshot-scala2.12
node_type_id: "[NODE_TYPE_ID]" node_type_id: [NODE_TYPE_ID]
data_security_mode: USER_ISOLATION data_security_mode: USER_ISOLATION
instance_pool_id: "[TEST_INSTANCE_POOL_ID]" instance_pool_id: [TEST_INSTANCE_POOL_ID]
python_wheel_task: python_wheel_task:
package_name: my_test_code package_name: my_test_code
entry_point: run entry_point: run

View File

@ -0,0 +1,2 @@
experimental:
python_wheel_wrapper: true

View File

@ -1,8 +1,5 @@
export SPARK_VERSION=$DEFAULT_SPARK_VERSION export EXTRA_CONFIG=empty.yml
export PYTHON_WHEEL_WRAPPER=false envsubst < databricks.yml.tmpl > databricks.yml
envsubst < input.json.tmpl > input.json
trace cat input.json
$CLI bundle init . --config-file input.json
trace cat databricks.yml trace cat databricks.yml
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
trace $CLI bundle deploy trace $CLI bundle deploy

View File

@ -0,0 +1,15 @@
from setuptools import setup, find_packages
import my_test_code
setup(
name="my_test_code",
version=my_test_code.__version__,
author=my_test_code.__author__,
url="https://databricks.com",
author_email="john.doe@databricks.com",
description="my example wheel",
packages=find_packages(include=["my_test_code"]),
entry_points={"group1": "run=my_test_code.__main__:main"},
install_requires=["setuptools"],
)

View File

@ -1,15 +0,0 @@
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"],
)

View File

@ -1,15 +1,4 @@
>>> cat input.json
{
"project_name": "my_test_code",
"spark_version": "13.3.x-snapshot-scala2.12",
"node_type_id": "[NODE_TYPE_ID]",
"unique_id": "[UNIQUE_NAME]",
"python_wheel_wrapper": false,
"instance_pool_id": "[TEST_INSTANCE_POOL_ID]"
}
✨ Successfully initialized template
>>> cat databricks.yml >>> cat databricks.yml
bundle: bundle:
name: wheel-task name: wheel-task
@ -17,7 +6,8 @@ bundle:
workspace: workspace:
root_path: "~/.bundle/[UNIQUE_NAME]" root_path: "~/.bundle/[UNIQUE_NAME]"
include:
- empty.yml
resources: resources:
jobs: jobs:
@ -27,10 +17,10 @@ resources:
- task_key: TestTask - task_key: TestTask
new_cluster: new_cluster:
num_workers: 1 num_workers: 1
spark_version: "13.3.x-snapshot-scala2.12" spark_version: 13.3.x-snapshot-scala2.12
node_type_id: "[NODE_TYPE_ID]" node_type_id: [NODE_TYPE_ID]
data_security_mode: USER_ISOLATION data_security_mode: USER_ISOLATION
instance_pool_id: "[TEST_INSTANCE_POOL_ID]" instance_pool_id: [TEST_INSTANCE_POOL_ID]
python_wheel_task: python_wheel_task:
package_name: my_test_code package_name: my_test_code
entry_point: run entry_point: run

View File

@ -1,8 +1,6 @@
export SPARK_VERSION=$DEFAULT_SPARK_VERSION export EXTRA_CONFIG=empty.yml
export PYTHON_WHEEL_WRAPPER=false envsubst < $TESTDIR/../base/databricks.yml.tmpl > databricks.yml
envsubst < $TESTDIR/../base/input.json.tmpl > input.json cp -r $TESTDIR/../base/{$EXTRA_CONFIG,setup.py,my_test_code} .
trace cat input.json
$CLI bundle init $TESTDIR/../base --config-file input.json
trace cat databricks.yml trace cat databricks.yml
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
trace $CLI bundle deploy trace $CLI bundle deploy

View File

@ -2,20 +2,20 @@ bundle:
name: wheel-task name: wheel-task
workspace: workspace:
root_path: "~/.bundle/{{.unique_id}}" root_path: "~/.bundle/$UNIQUE_NAME"
resources: resources:
clusters: clusters:
test_cluster: test_cluster:
cluster_name: "test-cluster-{{.unique_id}}" cluster_name: "test-cluster-$UNIQUE_NAME"
spark_version: "{{.spark_version}}" spark_version: "$DEFAULT_SPARK_VERSION"
node_type_id: "{{.node_type_id}}" node_type_id: "$NODE_TYPE_ID"
num_workers: 1 num_workers: 1
data_security_mode: USER_ISOLATION data_security_mode: USER_ISOLATION
jobs: jobs:
some_other_job: some_other_job:
name: "[${bundle.target}] Test Wheel Job {{.unique_id}}" name: "[${bundle.target}] Test Wheel Job $UNIQUE_NAME"
tasks: tasks:
- task_key: TestTask - task_key: TestTask
existing_cluster_id: "${resources.clusters.test_cluster.cluster_id}" existing_cluster_id: "${resources.clusters.test_cluster.cluster_id}"

View File

@ -1,25 +0,0 @@
{
"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"
}
}
}

View File

@ -1,15 +1,4 @@
>>> cat input.json
{
"project_name": "my_test_code",
"spark_version": "13.3.x-snapshot-scala2.12",
"node_type_id": "[NODE_TYPE_ID]",
"unique_id": "[UNIQUE_NAME]",
"python_wheel_wrapper": false,
"instance_pool_id": "[TEST_INSTANCE_POOL_ID]"
}
✨ Successfully initialized template
>>> cat databricks.yml >>> cat databricks.yml
bundle: bundle:
name: wheel-task name: wheel-task

View File

@ -1,8 +1,4 @@
export SPARK_VERSION=$DEFAULT_SPARK_VERSION envsubst < databricks.yml.tmpl > databricks.yml
export PYTHON_WHEEL_WRAPPER=false
envsubst < $TESTDIR/../base/input.json.tmpl > input.json
trace cat input.json
$CLI bundle init . --config-file input.json
trace cat databricks.yml trace cat databricks.yml
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
trace $CLI bundle deploy trace $CLI bundle deploy

View File

@ -0,0 +1,15 @@
from setuptools import setup, find_packages
import my_test_code
setup(
name="my_test_code",
version=my_test_code.__version__,
author=my_test_code.__author__,
url="https://databricks.com",
author_email="john.doe@databricks.com",
description="my example wheel",
packages=find_packages(include=["my_test_code"]),
entry_points={"group1": "run=my_test_code.__main__:main"},
install_requires=["setuptools"],
)

View File

@ -1,15 +0,0 @@
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"],
)

View File

@ -7,8 +7,9 @@ Ignore = [
"my_test_code", "my_test_code",
"my_test_code.egg-info", "my_test_code.egg-info",
"setup.py", "setup.py",
"input.json",
"databricks.yml", "databricks.yml",
"python_wheel_wrapper.yml",
"empty.yml",
] ]
[[Repls]] [[Repls]]

View File

@ -1,15 +1,4 @@
>>> cat input.json
{
"project_name": "my_test_code",
"spark_version": "12.2.x-scala2.12",
"node_type_id": "[NODE_TYPE_ID]",
"unique_id": "[UNIQUE_NAME]",
"python_wheel_wrapper": true,
"instance_pool_id": "[TEST_INSTANCE_POOL_ID]"
}
✨ Successfully initialized template
>>> cat databricks.yml >>> cat databricks.yml
bundle: bundle:
name: wheel-task name: wheel-task
@ -17,10 +6,8 @@ bundle:
workspace: workspace:
root_path: "~/.bundle/[UNIQUE_NAME]" root_path: "~/.bundle/[UNIQUE_NAME]"
include:
experimental: - python_wheel_wrapper.yml
python_wheel_wrapper: true
resources: resources:
jobs: jobs:
@ -30,10 +17,10 @@ resources:
- task_key: TestTask - task_key: TestTask
new_cluster: new_cluster:
num_workers: 1 num_workers: 1
spark_version: "12.2.x-scala2.12" spark_version: 12.2.x-scala2.12
node_type_id: "[NODE_TYPE_ID]" node_type_id: [NODE_TYPE_ID]
data_security_mode: USER_ISOLATION data_security_mode: USER_ISOLATION
instance_pool_id: "[TEST_INSTANCE_POOL_ID]" instance_pool_id: [TEST_INSTANCE_POOL_ID]
python_wheel_task: python_wheel_task:
package_name: my_test_code package_name: my_test_code
entry_point: run entry_point: run

View File

@ -2,11 +2,10 @@
# But before users used older DBRs and python wheel tasks but installed it from DBFS. # But before users used older DBRs and python wheel tasks but installed it from DBFS.
# We still want to support older DBRs and did the trampoline workaround (https://github.com/databricks/cli/pull/635) # We still want to support older DBRs and did the trampoline workaround (https://github.com/databricks/cli/pull/635)
# Hence this is to test that python wheel tasks in DABs are working for older DBRs # Hence this is to test that python wheel tasks in DABs are working for older DBRs
export SPARK_VERSION=12.2.x-scala2.12 export DEFAULT_SPARK_VERSION=12.2.x-scala2.12
export PYTHON_WHEEL_WRAPPER=true export EXTRA_CONFIG=python_wheel_wrapper.yml
envsubst < $TESTDIR/../base/input.json.tmpl > input.json envsubst < $TESTDIR/../base/databricks.yml.tmpl > databricks.yml
trace cat input.json cp -r $TESTDIR/../base/{$EXTRA_CONFIG,setup.py,my_test_code} .
$CLI bundle init $TESTDIR/../base --config-file input.json
trace cat databricks.yml trace cat databricks.yml
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
trace $CLI bundle deploy trace $CLI bundle deploy

View File

@ -1,15 +1,4 @@
>>> cat input.json
{
"project_name": "my_test_code",
"spark_version": "12.2.x-scala2.12",
"node_type_id": "[NODE_TYPE_ID]",
"unique_id": "[UNIQUE_NAME]",
"python_wheel_wrapper": true,
"instance_pool_id": "[TEST_INSTANCE_POOL_ID]"
}
✨ Successfully initialized template
>>> cat databricks.yml >>> cat databricks.yml
bundle: bundle:
name: wheel-task name: wheel-task
@ -17,10 +6,8 @@ bundle:
workspace: workspace:
root_path: "~/.bundle/[UNIQUE_NAME]" root_path: "~/.bundle/[UNIQUE_NAME]"
include:
experimental: - python_wheel_wrapper.yml
python_wheel_wrapper: true
resources: resources:
jobs: jobs:
@ -30,10 +17,10 @@ resources:
- task_key: TestTask - task_key: TestTask
new_cluster: new_cluster:
num_workers: 1 num_workers: 1
spark_version: "12.2.x-scala2.12" spark_version: 12.2.x-scala2.12
node_type_id: "[NODE_TYPE_ID]" node_type_id: [NODE_TYPE_ID]
data_security_mode: USER_ISOLATION data_security_mode: USER_ISOLATION
instance_pool_id: "[TEST_INSTANCE_POOL_ID]" instance_pool_id: [TEST_INSTANCE_POOL_ID]
python_wheel_task: python_wheel_task:
package_name: my_test_code package_name: my_test_code
entry_point: run entry_point: run

View File

@ -1,8 +1,7 @@
export SPARK_VERSION=12.2.x-scala2.12 export DEFAULT_SPARK_VERSION=12.2.x-scala2.12
export PYTHON_WHEEL_WRAPPER=true export EXTRA_CONFIG=python_wheel_wrapper.yml
envsubst < $TESTDIR/../base/input.json.tmpl > input.json envsubst < $TESTDIR/../base/databricks.yml.tmpl > databricks.yml
trace cat input.json cp -r $TESTDIR/../base/{$EXTRA_CONFIG,setup.py,my_test_code} .
$CLI bundle init $TESTDIR/../base --config-file input.json
trace cat databricks.yml trace cat databricks.yml
trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT
trace $CLI bundle deploy trace $CLI bundle deploy