Skip to content

Commit 9c3ccc3

Browse files
arulajmaniMukul Murthy
authored andcommitted
Add support for wheels when deploying pipelines (#249)
* add support for wheels * linter
1 parent fddead5 commit 9c3ccc3

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

databricks_cli/pipelines/api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
BUFFER_SIZE = 1024 * 64
4040
base_pipelines_dir = 'dbfs:/pipelines/code'
41+
supported_lib_types = {'jar', 'whl'}
4142

4243

4344
class PipelinesApi(object):
@@ -73,9 +74,9 @@ def _identify_local_libraries(lib_objects):
7374
local_lib_objects, external_lib_objects = [], []
7475
for lib_object in lib_objects:
7576
parsed_uri = urllib.parse.urlparse(lib_object.path)
76-
if lib_object.lib_type == 'jar' and parsed_uri.scheme == '':
77+
if lib_object.lib_type in supported_lib_types and parsed_uri.scheme == '':
7778
local_lib_objects.append(lib_object)
78-
elif lib_object.lib_type == 'jar' and parsed_uri.scheme.lower() == 'file':
79+
elif lib_object.lib_type in supported_lib_types and parsed_uri.scheme.lower() == 'file':
7980
# exactly 1 or 3
8081
if parsed_uri.path.startswith('//') or parsed_uri.netloc != '':
8182
raise RuntimeError('invalid file uri scheme, '

tests/pipelines/test_api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,31 +151,31 @@ def test_partition_local_remote(pipelines_api):
151151
LibraryObject('jar', 'FILE:/all/caps.ext'),
152152
LibraryObject('jar', 'FiLe:/weird/case.ext'),
153153
LibraryObject('jar', 'file.ext'),
154+
LibraryObject('whl', 'rel/path.ext'),
154155
# shouldn't be uploaded
155156
LibraryObject('jar', 'dbfs:/absolute/path/abc.ext'),
156157
LibraryObject('jar', 's3:file:/file/scheme/abs/path.ext'),
157158
LibraryObject('jar', 'scheme:file.ext'),
158159
LibraryObject('jar', 'scheme:/abs/path.ext'),
159160
LibraryObject('jar', 'scheme://abs/path.ext'),
160-
LibraryObject('egg', 'file:/abs/path.ext'),
161-
LibraryObject('whl', 'rel/path.ext')
161+
LibraryObject('egg', 'file:/abs/path.ext')
162162
]
163163
expected_llo = [
164164
LibraryObject('jar', '/absolute/path/abc.ext'),
165165
LibraryObject('jar', 'relative/path.ext'),
166166
LibraryObject('jar', '/file/scheme/abs/path.ext'),
167167
LibraryObject('jar', '/all/caps.ext'),
168168
LibraryObject('jar', '/weird/case.ext'),
169-
LibraryObject('jar', 'file.ext')
169+
LibraryObject('jar', 'file.ext'),
170+
LibraryObject('whl', 'rel/path.ext')
170171
]
171172
expected_external = [
172173
LibraryObject('jar', 'dbfs:/absolute/path/abc.ext'),
173174
LibraryObject('jar', 's3:file:/file/scheme/abs/path.ext'),
174175
LibraryObject('jar', 'scheme:file.ext'),
175176
LibraryObject('jar', 'scheme:/abs/path.ext'),
176177
LibraryObject('jar', 'scheme://abs/path.ext'),
177-
LibraryObject('egg', 'file:/abs/path.ext'),
178-
LibraryObject('whl', 'rel/path.ext')
178+
LibraryObject('egg', 'file:/abs/path.ext')
179179
]
180180
llo, external = pipelines_api._identify_local_libraries(libraries)
181181
assert llo == expected_llo
@@ -207,4 +207,4 @@ def test_library_object_serialization_deserialization():
207207
assert llo == library_objects
208208

209209
libs = LibraryObject.to_json(library_objects)
210-
assert libs == libraries
210+
assert libs == libraries

0 commit comments

Comments
 (0)