databricks-cli/bundle
Andrew Nester 12368e3382
Added transformation mutator for Python wheel task for them to work on DBR <13.1 (#635)
## Changes
***Note: this PR relies on sync.include functionality from here:
https://github.com/databricks/cli/pull/671***

Added transformation mutator for Python wheel task for them to work on
DBR <13.1

Using wheels upload to Workspace file system as cluster libraries is not
supported in DBR < 13.1

In order to make Python wheel work correctly on DBR < 13.1 we do the
following:
1. Build and upload python wheel as usual
2. Transform python wheel task into special notebook task which does the
following
a. Installs all necessary wheels with %pip magic
b. Executes defined entry point with all provided parameters
3. Upload this notebook file to workspace file system
4. Deploy transformed job task

This is also beneficial for executing on existing clusters because this
notebook always reinstall wheels so if there are any changes to the
wheel package, they are correctly picked up

## Tests
bundle.yml

```yaml
bundle:
  name: wheel-task

workspace:
  host: ****

resources:
  jobs:
    test_job:
      name: "[${bundle.environment}] My Wheel Job"
      tasks:
        - task_key: TestTask
          existing_cluster_id: "***"
          python_wheel_task:
            package_name: "my_test_code"
            entry_point: "run"
            parameters: ["first argument","first value","second argument","second value"]
          libraries:
          - whl: ./dist/*.whl
```

Output
```
andrew.nester@HFW9Y94129 wheel % databricks bundle run test_job
Run URL: ***

2023-08-03 15:58:04 "[default] My Wheel Job" TERMINATED SUCCESS 
Output:
=======
Task TestTask:
Hello from my func
Got arguments v1:
['python', 'first argument', 'first value', 'second argument', 'second value']

```
2023-08-30 12:21:39 +00:00
..
artifacts Allow referencing local Python wheels without artifacts section defined (#703) 2023-08-28 16:29:04 +00:00
config Added transformation mutator for Python wheel task for them to work on DBR <13.1 (#635) 2023-08-30 12:21:39 +00:00
deploy Added support for sync.include and sync.exclude sections (#671) 2023-08-18 08:07:25 +00:00
deployer Fix locker unlock for destroy (#492) 2023-06-19 15:57:25 +02:00
internal/tf Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
libraries Correctly identify local paths in libraries section (#702) 2023-08-29 08:26:09 +00:00
phases Added transformation mutator for Python wheel task for them to work on DBR <13.1 (#635) 2023-08-30 12:21:39 +00:00
python Added transformation mutator for Python wheel task for them to work on DBR <13.1 (#635) 2023-08-30 12:21:39 +00:00
run Add development runs (#522) 2023-07-12 08:51:54 +02:00
schema Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
tests Allow referencing local Python wheels without artifacts section defined (#703) 2023-08-28 16:29:04 +00:00
bundle.go Added support for sync.include and sync.exclude sections (#671) 2023-08-18 08:07:25 +00:00
bundle_test.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
context.go Make sync command work in bundle context; reorder args (#207) 2023-02-20 11:33:30 +01:00
context_test.go Add command that writes the materialized bundle configuration to stdout (#95) 2022-11-21 15:39:53 +01:00
deferred.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
deferred_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
mutator.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
mutator_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
root.go First look for databricks.yml before falling back to bundle.yml (#580) 2023-07-18 12:16:34 +02:00
root_test.go Log the bundle root configuration file if applicable (#657) 2023-08-11 12:28:05 +00:00
seq.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
seq_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00