Running tests in temporary directory: '/tmp/viash_test_logistic_regression_4386442450255812096'
====================================================================
+/tmp/viash_test_logistic_regression_4386442450255812096/build_engine_environment/logistic_regression ---verbosity 6 ---setup cachedbuild ---engine docker
[notice] Building container 'ghcr.io/openproblems-bio/task_template/methods/logistic_regression:test' with Dockerfile
[info] docker build -t 'ghcr.io/openproblems-bio/task_template/methods/logistic_regression:test' '/tmp/viash_test_logistic_regression_4386442450255812096/build_engine_environment' -f '/tmp/viash_test_logistic_regression_4386442450255812096/build_engine_environment/tmp/dockerbuild-logistic_regression-zw2VMb/Dockerfile'
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 571B done
#1 DONE 0.0s
#2 [auth] openproblems/base_python:pull token for registry-1.docker.io
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/openproblems/base_python:1.0.0
#3 DONE 0.2s
#4 [internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.0s
#5 [1/2] FROM docker.io/openproblems/base_python:1.0.0@sha256:bbb0a093e275498bf905237c8cd26124d436f5d35d0f8dd1749c06d0a0a2e88c
#5 resolve docker.io/openproblems/base_python:1.0.0@sha256:bbb0a093e275498bf905237c8cd26124d436f5d35d0f8dd1749c06d0a0a2e88c done
#5 sha256:8cd46d290033f265db57fd808ac81c444ec5a5b3f189c3d6d85043b647336913 3.15MB / 49.56MB 0.1s
#5 sha256:2e66a70da0bec13fb3d492fcdef60fd8a5ef0a1a65c4e8a4909e26742852f0f2 4.19MB / 64.15MB 0.1s
#5 sha256:8cd46d290033f265db57fd808ac81c444ec5a5b3f189c3d6d85043b647336913 14.68MB / 49.56MB 0.2s
#5 sha256:2e66a70da0bec13fb3d492fcdef60fd8a5ef0a1a65c4e8a4909e26742852f0f2 15.73MB / 64.15MB 0.2s
#5 sha256:bbb0a093e275498bf905237c8cd26124d436f5d35d0f8dd1749c06d0a0a2e88c 2.43kB / 2.43kB done
#5 sha256:f3113a160ebb790d7b7e5c9a2148c422ca3f71d30ab661b05c922da5923e4672 9.52kB / 9.52kB done
#5 sha256:2e6afa3f266c11e8960349e7866203a9df478a50362bb5488c45fe39d99b2707 15.73MB / 24.05MB 0.2s
#5 sha256:8cd46d290033f265db57fd808ac81c444ec5a5b3f189c3d6d85043b647336913 40.93MB / 49.56MB 0.4s
#5 sha256:2e66a70da0bec13fb3d492fcdef60fd8a5ef0a1a65c4e8a4909e26742852f0f2 44.04MB / 64.15MB 0.4s
#5 sha256:2e6afa3f266c11e8960349e7866203a9df478a50362bb5488c45fe39d99b2707 24.05MB / 24.05MB 0.3s done
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 10.49MB / 211.27MB 0.4s
#5 sha256:8cd46d290033f265db57fd808ac81c444ec5a5b3f189c3d6d85043b647336913 49.56MB / 49.56MB 0.5s done
#5 sha256:2e66a70da0bec13fb3d492fcdef60fd8a5ef0a1a65c4e8a4909e26742852f0f2 56.62MB / 64.15MB 0.5s
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 31.74MB / 211.27MB 0.5s
#5 sha256:a0ff605e08b8c97d64efd5de9004f7be648fe6181093227246142e70eda4d985 0B / 6.16MB 0.5s
#5 extracting sha256:8cd46d290033f265db57fd808ac81c444ec5a5b3f189c3d6d85043b647336913
#5 sha256:2e66a70da0bec13fb3d492fcdef60fd8a5ef0a1a65c4e8a4909e26742852f0f2 64.15MB / 64.15MB 0.6s
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 46.19MB / 211.27MB 0.6s
#5 sha256:a0ff605e08b8c97d64efd5de9004f7be648fe6181093227246142e70eda4d985 6.16MB / 6.16MB 0.6s done
#5 sha256:a040235ac426a0e27ffff8201c375bc2dea5e9b79fbe3de107e8640a3152cb3a 0B / 19.84MB 0.6s
#5 sha256:2e66a70da0bec13fb3d492fcdef60fd8a5ef0a1a65c4e8a4909e26742852f0f2 64.15MB / 64.15MB 0.6s done
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 62.91MB / 211.27MB 0.7s
#5 sha256:a040235ac426a0e27ffff8201c375bc2dea5e9b79fbe3de107e8640a3152cb3a 10.80MB / 19.84MB 0.7s
#5 sha256:608bb063c2b69dbab463e8ba089f65d9ca171add34cc5dc77434d44320dc4858 1.05MB / 3.13MB 0.7s
#5 sha256:bf8c0a4030de5f4f6d52f2fd8d70281f7230aa557d51632f7fb27f5c7bca0720 232B / 232B 0.7s done
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 75.67MB / 211.27MB 0.8s
#5 sha256:a040235ac426a0e27ffff8201c375bc2dea5e9b79fbe3de107e8640a3152cb3a 17.83MB / 19.84MB 0.8s
#5 sha256:608bb063c2b69dbab463e8ba089f65d9ca171add34cc5dc77434d44320dc4858 3.13MB / 3.13MB 0.7s done
#5 sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B 0.7s done
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 1.05MB / 239.90MB 0.8s
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 99.61MB / 211.27MB 0.9s
#5 sha256:a040235ac426a0e27ffff8201c375bc2dea5e9b79fbe3de107e8640a3152cb3a 19.84MB / 19.84MB 0.8s done
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 143.65MB / 211.27MB 1.1s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 33.55MB / 239.90MB 1.1s
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 173.02MB / 211.27MB 1.3s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 73.40MB / 239.90MB 1.3s
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 187.70MB / 211.27MB 1.4s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 88.08MB / 239.90MB 1.4s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 102.76MB / 239.90MB 1.5s
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 211.27MB / 211.27MB 1.6s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 120.80MB / 239.90MB 1.7s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 135.27MB / 239.90MB 1.8s
#5 sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 211.27MB / 211.27MB 1.8s done
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 163.61MB / 239.90MB 2.0s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 185.60MB / 239.90MB 2.2s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 207.62MB / 239.90MB 2.3s
#5 extracting sha256:8cd46d290033f265db57fd808ac81c444ec5a5b3f189c3d6d85043b647336913 1.9s done
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 220.20MB / 239.90MB 2.4s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 232.78MB / 239.90MB 2.5s
#5 extracting sha256:2e6afa3f266c11e8960349e7866203a9df478a50362bb5488c45fe39d99b2707 0.1s
#5 sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 239.90MB / 239.90MB 2.9s done
#5 extracting sha256:2e6afa3f266c11e8960349e7866203a9df478a50362bb5488c45fe39d99b2707 0.7s done
#5 extracting sha256:2e66a70da0bec13fb3d492fcdef60fd8a5ef0a1a65c4e8a4909e26742852f0f2 0.1s
#5 extracting sha256:2e66a70da0bec13fb3d492fcdef60fd8a5ef0a1a65c4e8a4909e26742852f0f2 2.0s done
#5 extracting sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81
#5 extracting sha256:1c8ff076d818ad6b8557e03e10c83657cc716ab287c8380054ff91571c8cae81 5.0s done
#5 extracting sha256:a0ff605e08b8c97d64efd5de9004f7be648fe6181093227246142e70eda4d985
#5 extracting sha256:a0ff605e08b8c97d64efd5de9004f7be648fe6181093227246142e70eda4d985 0.2s done
#5 extracting sha256:a040235ac426a0e27ffff8201c375bc2dea5e9b79fbe3de107e8640a3152cb3a 0.1s
#5 extracting sha256:a040235ac426a0e27ffff8201c375bc2dea5e9b79fbe3de107e8640a3152cb3a 0.4s done
#5 extracting sha256:bf8c0a4030de5f4f6d52f2fd8d70281f7230aa557d51632f7fb27f5c7bca0720 done
#5 extracting sha256:608bb063c2b69dbab463e8ba089f65d9ca171add34cc5dc77434d44320dc4858
#5 extracting sha256:608bb063c2b69dbab463e8ba089f65d9ca171add34cc5dc77434d44320dc4858 0.2s done
#5 extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 done
#5 extracting sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 0.1s
#5 extracting sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 5.2s
#5 extracting sha256:2ab4a9a4417c3cba6da0695fbcb161acd24bd950f468b0c807bf365f4c09dfc2 7.4s done
#5 DONE 22.2s
#6 [2/2] RUN pip install --upgrade pip && pip install --upgrade --no-cache-dir "scikit-learn"
#6 0.504 Requirement already satisfied: pip in /usr/local/lib/python3.11/site-packages (24.2)
#6 0.684 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
#6 1.054 Requirement already satisfied: scikit-learn in /usr/local/lib/python3.11/site-packages (1.5.1)
#6 1.202 Requirement already satisfied: numpy>=1.19.5 in /usr/local/lib/python3.11/site-packages (from scikit-learn) (1.26.4)
#6 1.203 Requirement already satisfied: scipy>=1.6.0 in /usr/local/lib/python3.11/site-packages (from scikit-learn) (1.14.1)
#6 1.203 Requirement already satisfied: joblib>=1.2.0 in /usr/local/lib/python3.11/site-packages (from scikit-learn) (1.4.2)
#6 1.204 Requirement already satisfied: threadpoolctl>=3.1.0 in /usr/local/lib/python3.11/site-packages (from scikit-learn) (3.5.0)
#6 1.280 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
#6 DONE 1.4s
#7 exporting to image
#7 exporting layers
#7 exporting layers 2.0s done
#7 writing image sha256:776b765d96f7fae09177a1dc602941855a2f51b1e62c043f3d5c97ae01b2c3c4 done
#7 naming to ghcr.io/openproblems-bio/task_template/methods/logistic_regression:test done
#7 DONE 2.0s
====================================================================
+/tmp/viash_test_logistic_regression_4386442450255812096/test_run_and_check_output/test_executable
>> Running test 'run'
>> Checking whether input files exist
>> Running script as test
Reading input files
Preprocess data
Train model
Generate predictions
Write output AnnData to file
>> Checking whether output file exists
>> Reading h5ad files and checking formats
Reading and checking output
AnnData object with n_obs × n_vars = 213 × 0
obs: 'label_pred'
uns: 'dataset_id', 'method_id', 'normalization_id'
All checks succeeded!
====================================================================
+/tmp/viash_test_logistic_regression_4386442450255812096/test_check_config/test_executable
Load config data
Check .namespace
Check .info.type
Check component metadata
Check references fields
Checking contents of .info.preferred_normalization
Check Nextflow runner
All checks succeeded!
====================================================================
SUCCESS! All 2 out of 2 test scripts succeeded!
Cleaning up temporary directory
Run tests
A component in OpenProblems will typically come with at least two unit tests out of the box:
- The first test will check if the config file has all the required fields.
- The second test will generally test if your component works and if the output has the expected dimensions and fields.
Use viash test
to run all of the component’s unit tests.
Example
viash test src/tasks/label_projection/methods/knn/config.vsh.yaml
Output
Test multiple components
Use viash ns test
to unit test all of the components of a given task.
viash ns test --parallel
Output
namespace name runner engine test_name exit_code duration result
control_methods true_labels executable docker start
metrics accuracy executable docker start
data_processors process_dataset executable docker start
methods logistic_regression executable docker start
data_processors process_dataset executable docker build_executable 0 2 SUCCESS
data_processors process_dataset executable docker run_and_check_output.py 0 4 SUCCESS
control_methods true_labels executable docker build_executable 0 2 SUCCESS
control_methods true_labels executable docker run_and_check_output.py 0 4 SUCCESS
control_methods true_labels executable docker check_config.py 0 3 SUCCESS
metrics accuracy executable docker build_executable 0 2 SUCCESS
metrics accuracy executable docker run_and_check_output.py 0 5 SUCCESS
metrics accuracy executable docker check_config.py 0 2 SUCCESS
methods logistic_regression executable docker build_executable 0 2 SUCCESS
methods logistic_regression executable docker run_and_check_output.py 0 5 SUCCESS
methods logistic_regression executable docker check_config.py 0 3 SUCCESS
All 11 configs built and tested successfully …
Common errors
Below is a listing of common errors and how to solve them. If you come across any other problems, please take a look at our troubleshooting page, or reach out via GitHub issues.
Assertion error
An assertion error typically occurs when data format of input or output parameters is incorrect.
Component script errors:
Output file cannot be found: Check that your script writes to the correct output filename.
Some fields/objects cannot be found in the output file: Check whether the correct fields are written in the output file.
+/tmp/viash_test_knn12471306149427017048/test_generic_test/test_executable
>> Running script as test
>> Checking whether output file exists
>> Reading h5ad files
>> Checking whether predictions were added
Traceback (most recent call last):
File "/viash_automount/tmp/viash_test_knn12471306149427017048/test_generic_test/tmp//viash-run-knn-QTKmUM.py", line 57, in <module>
assert "label_predi" in output.obs
AssertionError
Component config errors:
When these AssertionErrors
occur, check the spelling of the missing value if it is present in the file. If the field is irrelevant you can simply add an empty string ""
to make sure it is included in the composed config file.
+/tmp/viash_test_knn12945373156205296243/test_check_method_config/test_executable
Load config data
check general fields
Traceback (most recent call last):
Check info fields
File "/viash_automount/tmp/viash_test_knn12945373156205296243/test_check_method_config/tmp//viash-run-knn-Xn2Vd7.py", line 42, in <module>
assert "summary" in info is not None, "summary not an info field or is empty"
AssertionError: summary not an info field or is empty
Python / R dependency does not exist
When a dependency for the unit test or the executed script is not added to the setup of the docker you will get a ModuleNotFoundError
. Add the dependency to the setup.
ModuleNotFoundError: No module named 'yaml'
Docker image not found
When this kind of error occurs make sure there are no spelling mistakes in the image name.
#3 ERROR: docker.io/library/python:3.1: not found
------
> [internal] load metadata for docker.io/library/python:3.1:
------
Dockerfile:1
--------------------
1 | >>> FROM python:3.1
2 |
3 | RUN pip install --upgrade pip && \
--------------------
ERROR: failed to solve: python:3.1: docker.io/library/python:3.1: not found
[error] Error occurred while building container 'ghcr.io/openproblems-bio/label_projection/methods/knn:test'
ERROR! Setup failed!
Script error
When the executed script has an error it will be printed out like the example below. In most cases you can find the problem in the stack trace.
+/tmp/viash_test_knn14797416935521308344/test_generic_test/test_executable
>> Running script as test
Load input data
Traceback (most recent call last):
File "/tmp/viash-run-knn-p4pvkA.py", line 31, in <module>
input_test = ad.read_h5ad(par['input_test'])
File "/usr/local/lib/python3.10/site-packages/anndata/_io/h5ad.py", line 224, in read_h5ad
with h5py.File(filename, "r") as f:
File "/usr/local/lib/python3.10/site-packages/h5py/_hl/files.py", line 542, in __init__
name = filename_encode(name)
File "/usr/local/lib/python3.10/site-packages/h5py/_hl/compat.py", line 19, in filename_encode
filename = fspath(filename)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Method script with returncode ...