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

Correctly identify local paths in libraries section #702

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

andrewnester
Copy link
Contributor

Changes

Fixes #699

Tests

Added unit test

@@ -92,13 +93,13 @@ func findArtifactsAndMarkForUpload(ctx context.Context, lib *compute.Library, b
}

if len(matches) == 0 && isLocalLibrary(lib) {
return fmt.Errorf("no library found for %s", libPath(lib))
return fmt.Errorf("file %s is referenced in libraries section but no such file found on local file system", libPath(lib))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("file %s is referenced in libraries section but no such file found on local file system", libPath(lib))
return fmt.Errorf("file %s is referenced in libraries section but doesn't exist on the local file system", libPath(lib))

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this only happens as part of the deploy, but I suspect we can check that this is all valid during validation if we don't require a build step, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

libraries.MatchWithArtifacts must happen after artifact build and infer steps. Otherwise logic in MatchWithArtifacts becomes to complex and conditional, for example, is there no file locally because it was not yet build, or it really does not exists, or it wasn't infered.

The preferred flow is

  1. Read the config and artifacts section
  2. Infer anything that is missing and we can infer
  3. Build artifacts based on the result configuration
  4. Take the result artifacts configuration and state of the file system and see if libraries used matches the one on FS.

Copy link
Contributor

@pietern pietern Aug 29, 2023

Choose a reason for hiding this comment

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

Thanks, understood. We should capture this somewhere.

}

for _, match := range matches {
af, err := findArtifactFileByLocalPath(match, b)
if err != nil {
cmdio.LogString(ctx, fmt.Sprintf("%s. Skipping %s. In order to use the library upload it manually", err.Error(), match))
cmdio.LogString(ctx, fmt.Sprintf("%s. Skipping uploading. In order to use the define 'artifacts' section", err.Error()))
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

If #703 is merged then will this condition still be valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pietern it will be valid when an user defines and artifact section and then specifies libraries section which points to some different wheel. It might happen in case of monorepo where multiple wheel packages can be in different folder.

Copy link
Contributor

@pietern pietern Aug 29, 2023

Choose a reason for hiding this comment

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

Yeah that's right -- it still feels weird to have to define this section when referring to a file.

Let's keep this in the back of our head when going over these flows again. Can keep as is now.

bundle/libraries/libraries.go Show resolved Hide resolved
bundle/libraries/libraries.go 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.

Does specifying a path with a file:// actually work?

I would expect it to not resolve the local path. There's also no test case for it.

@andrewnester andrewnester added this pull request to the merge queue Aug 29, 2023
@andrewnester
Copy link
Contributor Author

@pietern I’ll verify the behaviour but indeed it’s likely not working as expected

Merged via the queue into main with commit 842cd8b Aug 29, 2023
4 checks passed
@andrewnester andrewnester deleted the whl-better-error-messages branch August 29, 2023 08:33
andrewnester added a commit that referenced this pull request Aug 30, 2023
CLI:
 * Fixed --environment flag ([#705](#705)).

Bundles:
 * Support cluster overrides with cluster_key and compute_key ([#696](#696)).
 * Allow referencing local Python wheels without artifacts section defined ([#703](#703)).
 * Correctly identify local paths in libraries section ([#702](#702)).
 * Fixed path joining in FindFilesWithSuffixInPath ([#704](#704)).
 * Added transformation mutator for Python wheel task for them to work on DBR <13.1 ([#635](#635)).

Internal:
 * Add a foundation for built-in templates ([#685](#685)).
@andrewnester andrewnester mentioned this pull request Aug 30, 2023
andrewnester added a commit that referenced this pull request Aug 30, 2023
Bundles:
 * Support cluster overrides with cluster_key and compute_key ([#696](#696)).
 * Allow referencing local Python wheels without artifacts section defined ([#703](#703)).
 * Fixed --environment flag ([#705](#705)).
 * Correctly identify local paths in libraries section ([#702](#702)).
 * Fixed path joining in FindFilesWithSuffixInPath ([#704](#704)).
 *  Added transformation mutator for Python wheel task for them to work on DBR <13.1 ([#635](#635)).

Internal:
 * Add a foundation for built-in templates ([#685](#685)).
 * Test transform when no Python wheel tasks defined ([#714](#714)).
 * Pin Terraform binary version to 1.5.5 ([#715](#715)).
 * Cleanup after "Add a foundation for built-in templates" ([#707](#707)).
 * Filter down to Python wheel tasks only for trampoline ([#712](#712)).
 * Update Terraform provider schema structs from 1.23.0 ([#713](#713)).
@andrewnester andrewnester mentioned this pull request Aug 30, 2023
github-merge-queue bot pushed a commit that referenced this pull request Aug 30, 2023
Bundles:
* Support cluster overrides with cluster_key and compute_key
([#696](#696)).
* Allow referencing local Python wheels without artifacts section
defined ([#703](#703)).
* Fixed --environment flag
([#705](#705)).
* Correctly identify local paths in libraries section
([#702](#702)).
* Fixed path joining in FindFilesWithSuffixInPath
([#704](#704)).
* Added transformation mutator for Python wheel task for them to work on
DBR <13.1 ([#635](#635)).

Internal:
* Add a foundation for built-in templates
([#685](#685)).
* Test transform when no Python wheel tasks defined
([#714](#714)).
* Pin Terraform binary version to 1.5.5
([#715](#715)).
* Cleanup after "Add a foundation for built-in templates"
([#707](#707)).
* Filter down to Python wheel tasks only for trampoline
([#712](#712)).
* Update Terraform provider schema structs from 1.23.0
([#713](#713)).
lennartkats-db pushed a commit that referenced this pull request Sep 1, 2023
## Changes
Fixes #699

## Tests
Added unit test
lennartkats-db pushed a commit that referenced this pull request Sep 1, 2023
Bundles:
* Support cluster overrides with cluster_key and compute_key
([#696](#696)).
* Allow referencing local Python wheels without artifacts section
defined ([#703](#703)).
* Fixed --environment flag
([#705](#705)).
* Correctly identify local paths in libraries section
([#702](#702)).
* Fixed path joining in FindFilesWithSuffixInPath
([#704](#704)).
* Added transformation mutator for Python wheel task for them to work on
DBR <13.1 ([#635](#635)).

Internal:
* Add a foundation for built-in templates
([#685](#685)).
* Test transform when no Python wheel tasks defined
([#714](#714)).
* Pin Terraform binary version to 1.5.5
([#715](#715)).
* Cleanup after "Add a foundation for built-in templates"
([#707](#707)).
* Filter down to Python wheel tasks only for trampoline
([#712](#712)).
* Update Terraform provider schema structs from 1.23.0
([#713](#713)).
arpitjasa-db pushed a commit to arpitjasa-db/cli that referenced this pull request Sep 7, 2023
## Changes
Fixes databricks#699

## Tests
Added unit test

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
Bundles:
* Support cluster overrides with cluster_key and compute_key
([databricks#696](databricks#696)).
* Allow referencing local Python wheels without artifacts section
defined ([databricks#703](databricks#703)).
* Fixed --environment flag
([databricks#705](databricks#705)).
* Correctly identify local paths in libraries section
([databricks#702](databricks#702)).
* Fixed path joining in FindFilesWithSuffixInPath
([databricks#704](databricks#704)).
* Added transformation mutator for Python wheel task for them to work on
DBR <13.1 ([databricks#635](databricks#635)).

Internal:
* Add a foundation for built-in templates
([databricks#685](databricks#685)).
* Test transform when no Python wheel tasks defined
([databricks#714](databricks#714)).
* Pin Terraform binary version to 1.5.5
([databricks#715](databricks#715)).
* Cleanup after "Add a foundation for built-in templates"
([databricks#707](databricks#707)).
* Filter down to Python wheel tasks only for trampoline
([databricks#712](databricks#712)).
* Update Terraform provider schema structs from 1.23.0
([databricks#713](databricks#713)).

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.

Error deploying task with library dependency in object storage
2 participants