Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 214
Expand and upload local wheel libraries for all task types#1649
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -27,8 +27,13 @@ func (*fromLibraries) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnost | ||
| return nil | ||
| } | ||
| tasks := libraries.FindAllWheelTasksWithLocalLibraries(b) | ||
| tasks := libraries.FindTasksWithLocalLibraries(b) | ||
andrewnester marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| for _, task := range tasks { | ||
| // Skip tasks that are not PythonWheelTasks for now, we can later support Jars too | ||
| if task.PythonWheelTask == nil { | ||
| continue | ||
| } | ||
| for _, lib := range task.Libraries { | ||
| matchAndAdd(ctx, lib.Whl, b) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -44,29 +44,25 @@ func isEnvsWithLocalLibraries(envs []jobs.JobEnvironment) bool { | ||
| return false | ||
| } | ||
| func FindAllWheelTasksWithLocalLibraries(b *bundle.Bundle) []*jobs.Task { | ||
| func FindTasksWithLocalLibraries(b *bundle.Bundle) []jobs.Task { | ||
| tasks := findAllTasks(b) | ||
| envs := FindAllEnvironments(b) | ||
| wheelTasks := make([]*jobs.Task, 0) | ||
| allTasks := make([]jobs.Task, 0) | ||
| for k, jobTasks := range tasks { | ||
| for i := range jobTasks { | ||
| task := &jobTasks[i] | ||
| if task.PythonWheelTask == nil { | ||
| continue | ||
| } | ||
| if isTaskWithLocalLibraries(*task) { | ||
| wheelTasks = append(wheelTasks, task) | ||
| task := jobTasks[i] | ||
| if isTaskWithLocalLibraries(task) { | ||
| allTasks = append(allTasks, task) | ||
| } | ||
andrewnester marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
| if envs[k] != nil && isEnvsWithLocalLibraries(envs[k]) { | ||
| wheelTasks = append(wheelTasks, task) | ||
| } | ||
| if envs[k] != nil && isEnvsWithLocalLibraries(envs[k]) { | ||
| allTasks = append(allTasks, jobTasks...) | ||
| } | ||
| } | ||
| return wheelTasks | ||
| return allTasks | ||
| } | ||
| func isTaskWithLocalLibraries(task jobs.Task) bool { | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| build/ | ||
| *.egg-info | ||
| .databricks |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| bundle: | ||
| name: python-wheel-notebook | ||
Contributor 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. Directory names are flipped between this and the ContributorAuthor 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. Good catch! :) | ||
| resources: | ||
| jobs: | ||
| test_job: | ||
| name: "[${bundle.environment}] My Wheel Job" | ||
| tasks: | ||
| - task_key: TestTask | ||
| existing_cluster_id: "0717-aaaaa-bbbbbb" | ||
| notebook_task: | ||
| notebook_path: "/notebook.py" | ||
| libraries: | ||
| - whl: ./dist/*.whl | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| __version__ = "0.0.1" | ||
| __author__ = "Databricks" |
| 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() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Databricks notebook source | ||
| print("Hello, World!") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 test wheel", | ||
| packages=find_packages(include=["my_test_code"]), | ||
| entry_points={"group_1": "run=my_test_code.__main__:main"}, | ||
| install_requires=["setuptools"], | ||
| ) |
Uh oh!
There was an error while loading. Please reload this page.