Replies: 4 comments
-
Hello, we have the same issue: With dbx execute ... --pip-install-extras="test,other-extra,one-more-extra" https://dbx.readthedocs.io/en/latest/guides/general/dependency_management/ However, with dbx deploy/launch as suggested for integration tests (https://dbx.readthedocs.io/en/latest/guides/python/integration_tests/, https://dbx.readthedocs.io/en/latest/guides/python/devops/package/) this does not seem to be possible. |
Beta Was this translation helpful? Give feedback.
-
We found a workaround for that issue, but official support by Add this cluster settings to tasks:
- task_key: "test"
new_cluster:
...
spark_env_vars:
WORKSPACE_DIST_DIR: "file:fuse://dist/.gitkeep"
init_scripts:
- dbfs:
destination: "file://test-init-script.sh"
... Add an empty #!/bin/bash
WHEEL_FILE=$(ls ${WORKSPACE_DIST_DIR%/*}/*.whl)
echo "Installing test dependencies from $WHEEL_FILE[test]..."
/databricks/python/bin/pip install $WHEEL_FILE[test] With the env var Thus, the |
Beta Was this translation helpful? Give feedback.
-
I think this is an actual bug that should be reported as an issue rather than a discussion.. |
Beta Was this translation helpful? Give feedback.
-
Another way to run integration test is to create a new job dedicated to integration test by dbx deploy, and then run it by dbx launch, write some tests in the end of the job itself. Dbx launch will fail if any error raised from the job. pytest and other dev requirements are not used here. Hope this could give you some ideas. |
Beta Was this translation helpful? Give feedback.
-
I was scratching my head today about the integration-test that dbx provides in their examples (when you set up a project using
dbx init
). It suggests that you can run an integration test on Databricks using pytest.In your project you will find an entrypoint (
tests/entrypoint.py
) that runspytest.main
on a directory (set inconf/deployment.yml
).Then in
conf/deployment.yml
there is a workflow with aspark_python_task
, which refers to the entrypoint as python file.In my project I listed all the typical test-related dependencies under my dev-dependencies and are therefore not listed in the wheel file (this is by design, we don't want these in a wheel). This results in my integration test failing (cannot import pytest). I tried running the test using
poetry run dbx deploy
followed bypoetry run dbx launch <workflow name>
.My question: How can I run my integration test with the dev-dependencies, without having these be part of my wheel. I somehow need to let dbx know these also need to be installed on the cluster before running. Is there already such an option?
Beta Was this translation helpful? Give feedback.
All reactions