databricks-cli/bundle/config/mutator
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
..
default_target.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
default_target_test.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
default_workspace_paths.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
default_workspace_paths_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
default_workspace_root.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
default_workspace_root_test.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
expand_workspace_root.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
expand_workspace_root_test.go Extend deployment mode support (#577) 2023-07-30 07:19:49 +00:00
load_git_details.go Fix bundle git branch validation (#645) 2023-08-07 17:29:02 +00:00
mutator.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
override_compute.go Support cluster overrides with cluster_key and compute_key (#696) 2023-08-28 07:51:35 +00:00
override_compute_test.go Support cluster overrides with cluster_key and compute_key (#696) 2023-08-28 07:51:35 +00:00
populate_current_user.go Extend deployment mode support (#577) 2023-07-30 07:19:49 +00:00
populate_current_user_test.go Extend deployment mode support (#577) 2023-07-30 07:19:49 +00:00
process_include.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
process_include_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
process_root_includes.go Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
process_root_includes_test.go Initialise a empty default bundle if BUNDLE_ROOT and DATABRICKS_BUNDLE_INCLUDES env vars are present (#604) 2023-08-02 17:22:47 +00:00
process_target_mode.go Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
process_target_mode_test.go Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
run_as.go Added run_as section for bundle configuration (#692) 2023-08-23 16:47:07 +00:00
select_default_target.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
select_default_target_test.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
select_target.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
select_target_test.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
set_variables.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
set_variables_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
trampoline.go Added transformation mutator for Python wheel task for them to work on DBR <13.1 (#635) 2023-08-30 12:21:39 +00:00
trampoline_test.go Added transformation mutator for Python wheel task for them to work on DBR <13.1 (#635) 2023-08-30 12:21:39 +00:00
translate_paths.go Disallow notebooks in paths where files are expected (#573) 2023-07-12 12:25:00 +00:00
translate_paths_test.go Disallow notebooks in paths where files are expected (#573) 2023-07-12 12:25:00 +00:00
validate_git_details.go Add validation for Git settings in bundles (#578) 2023-07-30 12:44:33 +00:00
validate_git_details_test.go Add validation for Git settings in bundles (#578) 2023-07-30 12:44:33 +00:00