Skip to content
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

Added support for sync.include and sync.exclude sections #671

Merged
merged 9 commits into from
Aug 18, 2023

Conversation

andrewnester
Copy link
Contributor

@andrewnester andrewnester commented Aug 16, 2023

Changes

Added support for sync.include and sync.exclude sections

Tests

Added sample-java folder to gitignore

bundle:
  name: wheel-task

sync:
  include:
    - "./sample-java/*.kts"

Kotlin files were correctly synced.

[DEBUG] Test execution command:  /opt/homebrew/opt/go@1.21/bin/go test ./... -json -timeout 1h -coverpkg=./... -coverprofile=coverage.txt -run ^TestAcc
[DEBUG] Test execution directory:  /Users/andrew.nester/cli
2023/08/17 17:12:10 [INFO] ✅ TestAccAlertsCreateErrWhenNoArguments (2.320s)
2023/08/17 17:12:10 [INFO] ✅ TestAccApiGet (0.650s)
2023/08/17 17:12:12 [INFO] ✅ TestAccClustersList (1.060s)
2023/08/17 17:12:12 [INFO] ✅ TestAccClustersGet (0.760s)
2023/08/17 17:12:26 [INFO] ✅ TestAccFilerWorkspaceFilesReadWrite (13.270s)
2023/08/17 17:12:32 [INFO] ✅ TestAccFilerWorkspaceFilesReadDir (6.860s)
2023/08/17 17:12:46 [INFO] ✅ TestAccFilerDbfsReadWrite (13.380s)
2023/08/17 17:12:53 [INFO] ✅ TestAccFilerDbfsReadDir (7.460s)
2023/08/17 17:13:01 [INFO] ✅ TestAccFilerWorkspaceNotebookConflict (7.920s)
2023/08/17 17:13:10 [INFO] ✅ TestAccFilerWorkspaceNotebookWithOverwriteFlag (9.290s)
2023/08/17 17:13:10 [INFO] ✅ TestAccFilerLocalReadWrite (0.010s)
2023/08/17 17:13:11 [INFO] ✅ TestAccFilerLocalReadDir (0.010s)
2023/08/17 17:13:14 [INFO] ✅ TestAccFsCatForDbfs (3.180s)
2023/08/17 17:13:15 [INFO] ✅ TestAccFsCatForDbfsOnNonExistentFile (0.940s)
2023/08/17 17:13:15 [INFO] ✅ TestAccFsCatForDbfsInvalidScheme (0.560s)
2023/08/17 17:13:18 [INFO] ✅ TestAccFsCatDoesNotSupportOutputModeJson (2.910s)
2023/08/17 17:13:51 [INFO] ✅ TestAccFsCpDir (32.730s)
2023/08/17 17:14:06 [INFO] ✅ TestAccFsCpFileToFile (14.740s)
2023/08/17 17:14:20 [INFO] ✅ TestAccFsCpFileToDir (14.340s)
2023/08/17 17:14:53 [INFO] ✅ TestAccFsCpDirToDirFileNotOverwritten (32.710s)
2023/08/17 17:15:12 [INFO] ✅ TestAccFsCpFileToDirFileNotOverwritten (19.590s)
2023/08/17 17:15:32 [INFO] ✅ TestAccFsCpFileToFileFileNotOverwritten (19.950s)
2023/08/17 17:16:11 [INFO] ✅ TestAccFsCpDirToDirWithOverwriteFlag (38.970s)
2023/08/17 17:16:32 [INFO] ✅ TestAccFsCpFileToFileWithOverwriteFlag (21.040s)
2023/08/17 17:16:52 [INFO] ✅ TestAccFsCpFileToDirWithOverwriteFlag (19.670s)
2023/08/17 17:16:54 [INFO] ✅ TestAccFsCpErrorsWhenSourceIsDirWithoutRecursiveFlag (1.890s)
2023/08/17 17:16:54 [INFO] ✅ TestAccFsCpErrorsOnInvalidScheme (0.690s)
2023/08/17 17:17:10 [INFO] ✅ TestAccFsCpSourceIsDirectoryButTargetIsFile (15.810s)
2023/08/17 17:17:14 [INFO] ✅ TestAccFsLsForDbfs (4.000s)
2023/08/17 17:17:18 [INFO] ✅ TestAccFsLsForDbfsWithAbsolutePaths (4.000s)
2023/08/17 17:17:21 [INFO] ✅ TestAccFsLsForDbfsOnFile (3.140s)
2023/08/17 17:17:23 [INFO] ✅ TestAccFsLsForDbfsOnEmptyDir (2.030s)
2023/08/17 17:17:24 [INFO] ✅ TestAccFsLsForDbfsForNonexistingDir (0.840s)
2023/08/17 17:17:25 [INFO] ✅ TestAccFsLsWithoutScheme (0.590s)
2023/08/17 17:17:27 [INFO] ✅ TestAccFsMkdirCreatesDirectory (2.310s)
2023/08/17 17:17:30 [INFO] ✅ TestAccFsMkdirCreatesMultipleDirectories (2.800s)
2023/08/17 17:17:33 [INFO] ✅ TestAccFsMkdirWhenDirectoryAlreadyExists (2.700s)
2023/08/17 17:17:35 [INFO] ✅ TestAccFsMkdirWhenFileExistsAtPath (2.870s)
2023/08/17 17:17:40 [INFO] ✅ TestAccFsRmForFile (4.030s)
2023/08/17 17:17:43 [INFO] ✅ TestAccFsRmForEmptyDirectory (3.470s)
2023/08/17 17:17:46 [INFO] ✅ TestAccFsRmForNonEmptyDirectory (3.350s)
2023/08/17 17:17:47 [INFO] ✅ TestAccFsRmForNonExistentFile (0.940s)
2023/08/17 17:17:51 [INFO] ✅ TestAccFsRmForNonEmptyDirectoryWithRecursiveFlag (3.570s)
2023/08/17 17:17:52 [INFO] ✅ TestAccGitClone (0.890s)
2023/08/17 17:17:52 [INFO] ✅ TestAccGitCloneWithOnlyRepoNameOnAlternateBranch (0.730s)
2023/08/17 17:17:53 [INFO] ✅ TestAccGitCloneErrorsWhenRepositoryDoesNotExist (0.540s)
2023/08/17 17:18:02 [INFO] ✅ TestAccLock (8.800s)
2023/08/17 17:18:06 [INFO] ✅ TestAccLockUnlockWithoutAllowsLockFileNotExist (3.930s)
2023/08/17 17:18:09 [INFO] ✅ TestAccLockUnlockWithAllowsLockFileNotExist (3.320s)
2023/08/17 17:18:20 [INFO] ✅ TestAccSyncFullFileSync (10.570s)
2023/08/17 17:18:31 [INFO] ✅ TestAccSyncIncrementalFileSync (11.460s)
2023/08/17 17:18:42 [INFO] ✅ TestAccSyncNestedFolderSync (10.850s)
2023/08/17 17:18:53 [INFO] ✅ TestAccSyncNestedFolderDoesntFailOnNonEmptyDirectory (10.650s)
2023/08/17 17:19:04 [INFO] ✅ TestAccSyncNestedSpacePlusAndHashAreEscapedSync (10.930s)
2023/08/17 17:19:11 [INFO] ✅ TestAccSyncIncrementalFileOverwritesFolder (7.010s)
2023/08/17 17:19:18 [INFO] ✅ TestAccSyncIncrementalSyncPythonNotebookToFile (7.380s)
2023/08/17 17:19:24 [INFO] ✅ TestAccSyncIncrementalSyncFileToPythonNotebook (6.220s)
2023/08/17 17:19:30 [INFO] ✅ TestAccSyncIncrementalSyncPythonNotebookDelete (5.530s)
2023/08/17 17:19:32 [INFO] ✅ TestAccSyncEnsureRemotePathIsUsableIfRepoDoesntExist (2.620s)
2023/08/17 17:19:38 [INFO] ✅ TestAccSyncEnsureRemotePathIsUsableIfRepoExists (5.460s)
2023/08/17 17:19:40 [INFO] ✅ TestAccSyncEnsureRemotePathIsUsableInWorkspace (1.850s)
2023/08/17 17:19:40 [INFO] ✅ TestAccWorkspaceList (0.780s)
2023/08/17 17:19:51 [INFO] ✅ TestAccExportDir (10.350s)
2023/08/17 17:19:54 [INFO] ✅ TestAccExportDirDoesNotOverwrite (3.330s)
2023/08/17 17:19:58 [INFO] ✅ TestAccExportDirWithOverwriteFlag (3.770s)
2023/08/17 17:20:07 [INFO] ✅ TestAccImportDir (9.320s)
2023/08/17 17:20:24 [INFO] ✅ TestAccImportDirDoesNotOverwrite (16.950s)
2023/08/17 17:20:35 [INFO] ✅ TestAccImportDirWithOverwriteFlag (10.620s)
2023/08/17 17:20:35 [INFO] ✅ 68/68 passed, 0 failed, 3 skipped

bundle/config/root.go Outdated Show resolved Hide resolved
libs/fileset/glob.go Show resolved Hide resolved
bundle/config/sync.go Outdated Show resolved Hide resolved
libs/fileset/glob.go Show resolved Hide resolved
libs/fileset/glob.go Show resolved Hide resolved
libs/fileset/glob.go Outdated Show resolved Hide resolved
libs/fileset/glob_test.go Outdated Show resolved Hide resolved
libs/sync/sync.go Outdated Show resolved Hide resolved
libs/sync/sync.go Outdated Show resolved Hide resolved
bundle/bundle.go Outdated Show resolved Hide resolved
libs/sync/sync.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Please run integration tests for sync as well before merging.

libs/sync/sync.go Show resolved Hide resolved
libs/sync/sync.go Show resolved Hide resolved
libs/core/set.go Outdated Show resolved Hide resolved
@andrewnester
Copy link
Contributor Author

@pietern added integration test results in description

@andrewnester andrewnester added this pull request to the merge queue Aug 18, 2023
bundle/config/root.go Outdated Show resolved Hide resolved
libs/set/set.go Show resolved Hide resolved
libs/fileset/glob.go Outdated Show resolved Hide resolved
libs/sync/sync.go Show resolved Hide resolved
@pietern pietern removed this pull request from the merge queue due to a manual request Aug 18, 2023
@andrewnester andrewnester added this pull request to the merge queue Aug 18, 2023
Merged via the queue into main with commit e3e9bc6 Aug 18, 2023
4 checks passed
@andrewnester andrewnester deleted the sync-include branch August 18, 2023 08:15
andrewnester added a commit that referenced this pull request Aug 24, 2023
CLI:
 * Added `databricks account o-auth-enrollment enable` command ([#687](#687)).

Bundles:
 * Do not try auto detect Python package if no Python wheel tasks defined ([#674](#674)).
 * Renamed `environments` to `targets` in bundle configuration ([#670](#670)).
 * Rename init project-dir flag to output-dir ([#676](#676)).
 * Added support for sync.include and sync.exclude sections ([#671](#671)).
 * Add template directory flag for bundle templates ([#675](#675)).
 * Never ignore root directory when enumerating files in a repository ([#683](#683)).
 * Improve 'mode' error message ([#681](#681)).
 * Added run_as section for bundle configuration ([#692](#692)).
@andrewnester andrewnester mentioned this pull request Aug 24, 2023
github-merge-queue bot pushed a commit that referenced this pull request Aug 24, 2023
CLI:
* Added `databricks account o-auth-enrollment enable` command
([#687](#687)).

Bundles:
* Do not try auto detect Python package if no Python wheel tasks defined
([#674](#674)).
* Renamed `environments` to `targets` in bundle configuration
([#670](#670)).
* Rename init project-dir flag to output-dir
([#676](#676)).
* Added support for sync.include and sync.exclude sections
([#671](#671)).
* Add template directory flag for bundle templates
([#675](#675)).
* Never ignore root directory when enumerating files in a repository
([#683](#683)).
* Improve 'mode' error message
([#681](#681)).
* Added run_as section for bundle configuration
([#692](#692)).
github-merge-queue bot pushed a commit that referenced this pull request Aug 30, 2023
…on DBR <13.1 (#635)

## Changes
***Note: this PR relies on sync.include functionality from here:
#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']

```
lennartkats-db pushed a commit that referenced this pull request Sep 1, 2023
…on DBR <13.1 (#635)

## Changes
***Note: this PR relies on sync.include functionality from here:
#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']

```
arpitjasa-db pushed a commit to arpitjasa-db/cli that referenced this pull request Sep 7, 2023
)

## Changes
Added support for `sync.include` and `sync.exclude` sections

## Tests
Added `sample-java` folder to gitignore

```
bundle:
  name: wheel-task

sync:
  include:
    - "./sample-java/*.kts"
```

Kotlin files were correctly synced.

```
[DEBUG] Test execution command:  /opt/homebrew/opt/go@1.21/bin/go test ./... -json -timeout 1h -coverpkg=./... -coverprofile=coverage.txt -run ^TestAcc
[DEBUG] Test execution directory:  /Users/andrew.nester/cli
2023/08/17 17:12:10 [INFO] ✅ TestAccAlertsCreateErrWhenNoArguments (2.320s)
2023/08/17 17:12:10 [INFO] ✅ TestAccApiGet (0.650s)
2023/08/17 17:12:12 [INFO] ✅ TestAccClustersList (1.060s)
2023/08/17 17:12:12 [INFO] ✅ TestAccClustersGet (0.760s)
2023/08/17 17:12:26 [INFO] ✅ TestAccFilerWorkspaceFilesReadWrite (13.270s)
2023/08/17 17:12:32 [INFO] ✅ TestAccFilerWorkspaceFilesReadDir (6.860s)
2023/08/17 17:12:46 [INFO] ✅ TestAccFilerDbfsReadWrite (13.380s)
2023/08/17 17:12:53 [INFO] ✅ TestAccFilerDbfsReadDir (7.460s)
2023/08/17 17:13:01 [INFO] ✅ TestAccFilerWorkspaceNotebookConflict (7.920s)
2023/08/17 17:13:10 [INFO] ✅ TestAccFilerWorkspaceNotebookWithOverwriteFlag (9.290s)
2023/08/17 17:13:10 [INFO] ✅ TestAccFilerLocalReadWrite (0.010s)
2023/08/17 17:13:11 [INFO] ✅ TestAccFilerLocalReadDir (0.010s)
2023/08/17 17:13:14 [INFO] ✅ TestAccFsCatForDbfs (3.180s)
2023/08/17 17:13:15 [INFO] ✅ TestAccFsCatForDbfsOnNonExistentFile (0.940s)
2023/08/17 17:13:15 [INFO] ✅ TestAccFsCatForDbfsInvalidScheme (0.560s)
2023/08/17 17:13:18 [INFO] ✅ TestAccFsCatDoesNotSupportOutputModeJson (2.910s)
2023/08/17 17:13:51 [INFO] ✅ TestAccFsCpDir (32.730s)
2023/08/17 17:14:06 [INFO] ✅ TestAccFsCpFileToFile (14.740s)
2023/08/17 17:14:20 [INFO] ✅ TestAccFsCpFileToDir (14.340s)
2023/08/17 17:14:53 [INFO] ✅ TestAccFsCpDirToDirFileNotOverwritten (32.710s)
2023/08/17 17:15:12 [INFO] ✅ TestAccFsCpFileToDirFileNotOverwritten (19.590s)
2023/08/17 17:15:32 [INFO] ✅ TestAccFsCpFileToFileFileNotOverwritten (19.950s)
2023/08/17 17:16:11 [INFO] ✅ TestAccFsCpDirToDirWithOverwriteFlag (38.970s)
2023/08/17 17:16:32 [INFO] ✅ TestAccFsCpFileToFileWithOverwriteFlag (21.040s)
2023/08/17 17:16:52 [INFO] ✅ TestAccFsCpFileToDirWithOverwriteFlag (19.670s)
2023/08/17 17:16:54 [INFO] ✅ TestAccFsCpErrorsWhenSourceIsDirWithoutRecursiveFlag (1.890s)
2023/08/17 17:16:54 [INFO] ✅ TestAccFsCpErrorsOnInvalidScheme (0.690s)
2023/08/17 17:17:10 [INFO] ✅ TestAccFsCpSourceIsDirectoryButTargetIsFile (15.810s)
2023/08/17 17:17:14 [INFO] ✅ TestAccFsLsForDbfs (4.000s)
2023/08/17 17:17:18 [INFO] ✅ TestAccFsLsForDbfsWithAbsolutePaths (4.000s)
2023/08/17 17:17:21 [INFO] ✅ TestAccFsLsForDbfsOnFile (3.140s)
2023/08/17 17:17:23 [INFO] ✅ TestAccFsLsForDbfsOnEmptyDir (2.030s)
2023/08/17 17:17:24 [INFO] ✅ TestAccFsLsForDbfsForNonexistingDir (0.840s)
2023/08/17 17:17:25 [INFO] ✅ TestAccFsLsWithoutScheme (0.590s)
2023/08/17 17:17:27 [INFO] ✅ TestAccFsMkdirCreatesDirectory (2.310s)
2023/08/17 17:17:30 [INFO] ✅ TestAccFsMkdirCreatesMultipleDirectories (2.800s)
2023/08/17 17:17:33 [INFO] ✅ TestAccFsMkdirWhenDirectoryAlreadyExists (2.700s)
2023/08/17 17:17:35 [INFO] ✅ TestAccFsMkdirWhenFileExistsAtPath (2.870s)
2023/08/17 17:17:40 [INFO] ✅ TestAccFsRmForFile (4.030s)
2023/08/17 17:17:43 [INFO] ✅ TestAccFsRmForEmptyDirectory (3.470s)
2023/08/17 17:17:46 [INFO] ✅ TestAccFsRmForNonEmptyDirectory (3.350s)
2023/08/17 17:17:47 [INFO] ✅ TestAccFsRmForNonExistentFile (0.940s)
2023/08/17 17:17:51 [INFO] ✅ TestAccFsRmForNonEmptyDirectoryWithRecursiveFlag (3.570s)
2023/08/17 17:17:52 [INFO] ✅ TestAccGitClone (0.890s)
2023/08/17 17:17:52 [INFO] ✅ TestAccGitCloneWithOnlyRepoNameOnAlternateBranch (0.730s)
2023/08/17 17:17:53 [INFO] ✅ TestAccGitCloneErrorsWhenRepositoryDoesNotExist (0.540s)
2023/08/17 17:18:02 [INFO] ✅ TestAccLock (8.800s)
2023/08/17 17:18:06 [INFO] ✅ TestAccLockUnlockWithoutAllowsLockFileNotExist (3.930s)
2023/08/17 17:18:09 [INFO] ✅ TestAccLockUnlockWithAllowsLockFileNotExist (3.320s)
2023/08/17 17:18:20 [INFO] ✅ TestAccSyncFullFileSync (10.570s)
2023/08/17 17:18:31 [INFO] ✅ TestAccSyncIncrementalFileSync (11.460s)
2023/08/17 17:18:42 [INFO] ✅ TestAccSyncNestedFolderSync (10.850s)
2023/08/17 17:18:53 [INFO] ✅ TestAccSyncNestedFolderDoesntFailOnNonEmptyDirectory (10.650s)
2023/08/17 17:19:04 [INFO] ✅ TestAccSyncNestedSpacePlusAndHashAreEscapedSync (10.930s)
2023/08/17 17:19:11 [INFO] ✅ TestAccSyncIncrementalFileOverwritesFolder (7.010s)
2023/08/17 17:19:18 [INFO] ✅ TestAccSyncIncrementalSyncPythonNotebookToFile (7.380s)
2023/08/17 17:19:24 [INFO] ✅ TestAccSyncIncrementalSyncFileToPythonNotebook (6.220s)
2023/08/17 17:19:30 [INFO] ✅ TestAccSyncIncrementalSyncPythonNotebookDelete (5.530s)
2023/08/17 17:19:32 [INFO] ✅ TestAccSyncEnsureRemotePathIsUsableIfRepoDoesntExist (2.620s)
2023/08/17 17:19:38 [INFO] ✅ TestAccSyncEnsureRemotePathIsUsableIfRepoExists (5.460s)
2023/08/17 17:19:40 [INFO] ✅ TestAccSyncEnsureRemotePathIsUsableInWorkspace (1.850s)
2023/08/17 17:19:40 [INFO] ✅ TestAccWorkspaceList (0.780s)
2023/08/17 17:19:51 [INFO] ✅ TestAccExportDir (10.350s)
2023/08/17 17:19:54 [INFO] ✅ TestAccExportDirDoesNotOverwrite (3.330s)
2023/08/17 17:19:58 [INFO] ✅ TestAccExportDirWithOverwriteFlag (3.770s)
2023/08/17 17:20:07 [INFO] ✅ TestAccImportDir (9.320s)
2023/08/17 17:20:24 [INFO] ✅ TestAccImportDirDoesNotOverwrite (16.950s)
2023/08/17 17:20:35 [INFO] ✅ TestAccImportDirWithOverwriteFlag (10.620s)
2023/08/17 17:20:35 [INFO] ✅ 68/68 passed, 0 failed, 3 skipped
```

Signed-off-by: Arpit Jasapara <arpit.jasapara@databricks.com>
arpitjasa-db pushed a commit to arpitjasa-db/cli that referenced this pull request Sep 7, 2023
CLI:
* Added `databricks account o-auth-enrollment enable` command
([databricks#687](databricks#687)).

Bundles:
* Do not try auto detect Python package if no Python wheel tasks defined
([databricks#674](databricks#674)).
* Renamed `environments` to `targets` in bundle configuration
([databricks#670](databricks#670)).
* Rename init project-dir flag to output-dir
([databricks#676](databricks#676)).
* Added support for sync.include and sync.exclude sections
([databricks#671](databricks#671)).
* Add template directory flag for bundle templates
([databricks#675](databricks#675)).
* Never ignore root directory when enumerating files in a repository
([databricks#683](databricks#683)).
* Improve 'mode' error message
([databricks#681](databricks#681)).
* Added run_as section for bundle configuration
([databricks#692](databricks#692)).

Signed-off-by: Arpit Jasapara <arpit.jasapara@databricks.com>
arpitjasa-db pushed a commit to arpitjasa-db/cli that referenced this pull request Sep 7, 2023
…on DBR <13.1 (databricks#635)

## Changes
***Note: this PR relies on sync.include functionality from here:
databricks#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']

```

Signed-off-by: Arpit Jasapara <arpit.jasapara@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants