Skip to content

Commit 2a97dca

Browse files
authored
Raise an error when there are multiple local libraries with the same basename used (#2297)
## Changes Raise an error when there are multiple local libraries with the same basename used Fixes #1674 ## Tests Added an unit test
1 parent 6d83ffd commit 2a97dca

File tree

14 files changed

+366
-1
lines changed

14 files changed

+366
-1
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
bundle:
2+
name: same_name_libraries
3+
4+
variables:
5+
cluster:
6+
default:
7+
spark_version: 15.4.x-scala2.12
8+
node_type_id: i3.xlarge
9+
data_security_mode: SINGLE_USER
10+
num_workers: 0
11+
spark_conf:
12+
spark.master: "local[*, 4]"
13+
spark.databricks.cluster.profile: singleNode
14+
custom_tags:
15+
ResourceClass: SingleNode
16+
17+
artifacts:
18+
whl1:
19+
type: whl
20+
path: ./whl1
21+
whl2:
22+
type: whl
23+
path: ./whl2
24+
25+
resources:
26+
jobs:
27+
test:
28+
name: "test"
29+
tasks:
30+
- task_key: task1
31+
new_cluster: ${var.cluster}
32+
python_wheel_task:
33+
entry_point: main
34+
package_name: my_default_python
35+
libraries:
36+
- whl: ./whl1/dist/*.whl
37+
- task_key: task2
38+
new_cluster: ${var.cluster}
39+
python_wheel_task:
40+
entry_point: main
41+
package_name: my_default_python
42+
libraries:
43+
- whl: ./whl2/dist/*.whl
44+
- task_key: task3
45+
new_cluster: ${var.cluster}
46+
python_wheel_task:
47+
entry_point: main
48+
package_name: my_default_python
49+
libraries:
50+
- whl: ./whl1/dist/*.whl
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
>>> errcode [CLI] bundle deploy
3+
Building whl1...
4+
Building whl2...
5+
Error: Duplicate local library name my_default_python-0.0.1-py3-none-any.whl
6+
at resources.jobs.test.tasks[0].libraries[0].whl
7+
resources.jobs.test.tasks[1].libraries[0].whl
8+
in databricks.yml:36:15
9+
databricks.yml:43:15
10+
11+
Local library names must be unique
12+
13+
14+
Exit code: 1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
trace errcode $CLI bundle deploy
2+
rm -rf whl1 whl2

acceptance/bundle/artifacts/same_name_libraries/test.toml

Whitespace-only changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""
2+
setup.py configuration script describing how to build and package this project.
3+
4+
This file is primarily used by the setuptools library and typically should not
5+
be executed directly. See README.md for how to deploy, test, and run
6+
the my_default_python project.
7+
"""
8+
9+
from setuptools import setup, find_packages
10+
11+
import sys
12+
13+
sys.path.append("./src")
14+
15+
import my_default_python
16+
17+
setup(
18+
name="my_default_python",
19+
version=my_default_python.__version__,
20+
url="https://databricks.com",
21+
author="[USERNAME]",
22+
description="wheel file based on my_default_python/src",
23+
packages=find_packages(where="./src"),
24+
package_dir={"": "src"},
25+
entry_points={
26+
"packages": [
27+
"main=my_default_python.main:main",
28+
],
29+
},
30+
install_requires=[
31+
# Dependencies in case the output wheel file is used as a library dependency.
32+
# For defining dependencies, when this package is used in Databricks, see:
33+
# https://docs.databricks.com/dev-tools/bundles/library-dependencies.html
34+
"setuptools"
35+
],
36+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.0.1"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("hello")
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""
2+
setup.py configuration script describing how to build and package this project.
3+
4+
This file is primarily used by the setuptools library and typically should not
5+
be executed directly. See README.md for how to deploy, test, and run
6+
the my_default_python project.
7+
"""
8+
9+
from setuptools import setup, find_packages
10+
11+
import sys
12+
13+
sys.path.append("./src")
14+
15+
import my_default_python
16+
17+
setup(
18+
name="my_default_python",
19+
version=my_default_python.__version__,
20+
url="https://databricks.com",
21+
author="[USERNAME]",
22+
description="wheel file based on my_default_python/src",
23+
packages=find_packages(where="./src"),
24+
package_dir={"": "src"},
25+
entry_points={
26+
"packages": [
27+
"main=my_default_python.main:main",
28+
],
29+
},
30+
install_requires=[
31+
# Dependencies in case the output wheel file is used as a library dependency.
32+
# For defining dependencies, when this package is used in Databricks, see:
33+
# https://docs.databricks.com/dev-tools/bundles/library-dependencies.html
34+
"setuptools"
35+
],
36+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.0.1"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("hello")

0 commit comments

Comments
 (0)