Running tests in temporary directory: '/tmp/viash_test_logistic_regression_1444104436733743701'
====================================================================
+/tmp/viash_test_logistic_regression_1444104436733743701/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_1444104436733743701/build_engine_environment' -f '/tmp/viash_test_logistic_regression_1444104436733743701/build_engine_environment/tmp/dockerbuild-logistic_regression-R0Z0kW/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.3s
#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:52302746d441804c9eb067b569f8671b68e6ebb3847da83b16e42b9316dcd583
#5 resolve docker.io/openproblems/base_python:1.0.0@sha256:52302746d441804c9eb067b569f8671b68e6ebb3847da83b16e42b9316dcd583 done
#5 sha256:b138557b3c9168650e12f59c1b94ca139d6856ab2d9c9254d01f092f08c92894 1.05MB / 19.84MB 0.1s
#5 sha256:f941e69671672ba68a9d7c8500f25b8e12f5aef94f4ba97c8fba1c5212435813 232B / 232B 0.1s done
#5 sha256:40686028595ecbb07f1b3250557eced506227cbf2af14ff8ccaa2eefb8fd303d 0B / 3.13MB 0.1s
#5 sha256:ddcca6e3f42035ac03358d82b13b5be2a118cd4bacb2772f93c9b863acb9927a 2.10MB / 6.16MB 0.1s
#5 sha256:52302746d441804c9eb067b569f8671b68e6ebb3847da83b16e42b9316dcd583 2.43kB / 2.43kB done
#5 sha256:f295e7043d30810d710c7f0b614bcfd665bd386ea37ca48df9f19ca96f5435e6 9.58kB / 9.58kB done
#5 sha256:b138557b3c9168650e12f59c1b94ca139d6856ab2d9c9254d01f092f08c92894 15.73MB / 19.84MB 0.2s
#5 sha256:40686028595ecbb07f1b3250557eced506227cbf2af14ff8ccaa2eefb8fd303d 3.13MB / 3.13MB 0.2s done
#5 sha256:ddcca6e3f42035ac03358d82b13b5be2a118cd4bacb2772f93c9b863acb9927a 6.16MB / 6.16MB 0.1s done
#5 extracting sha256:ddcca6e3f42035ac03358d82b13b5be2a118cd4bacb2772f93c9b863acb9927a
#5 sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B 0.2s done
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 2.10MB / 239.92MB 0.2s
#5 sha256:b138557b3c9168650e12f59c1b94ca139d6856ab2d9c9254d01f092f08c92894 19.84MB / 19.84MB 0.2s done
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 28.31MB / 239.92MB 0.3s
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 55.57MB / 239.92MB 0.4s
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 81.79MB / 239.92MB 0.5s
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 131.07MB / 239.92MB 0.7s
#5 extracting sha256:ddcca6e3f42035ac03358d82b13b5be2a118cd4bacb2772f93c9b863acb9927a 0.6s done
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 156.24MB / 239.92MB 0.8s
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 213.91MB / 239.92MB 1.0s
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 239.92MB / 239.92MB 1.1s
#5 extracting sha256:b138557b3c9168650e12f59c1b94ca139d6856ab2d9c9254d01f092f08c92894 0.1s
#5 sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 239.92MB / 239.92MB 1.1s done
#5 extracting sha256:b138557b3c9168650e12f59c1b94ca139d6856ab2d9c9254d01f092f08c92894 0.5s done
#5 extracting sha256:f941e69671672ba68a9d7c8500f25b8e12f5aef94f4ba97c8fba1c5212435813
#5 extracting sha256:f941e69671672ba68a9d7c8500f25b8e12f5aef94f4ba97c8fba1c5212435813 done
#5 extracting sha256:40686028595ecbb07f1b3250557eced506227cbf2af14ff8ccaa2eefb8fd303d 0.1s
#5 extracting sha256:40686028595ecbb07f1b3250557eced506227cbf2af14ff8ccaa2eefb8fd303d 0.3s done
#5 extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 done
#5 extracting sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 0.1s
#5 extracting sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 5.2s
#5 extracting sha256:00a8ac675928069c4d8eb19f9ca6cdb4fffae02789e434e04a86ded5fe2c7530 7.5s done
#5 DONE 11.3s
#6 [2/2] RUN pip install --upgrade pip && pip install --upgrade --no-cache-dir "scikit-learn"
#6 1.165 Requirement already satisfied: pip in /usr/local/lib/python3.11/site-packages (24.2)
#6 1.353 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.725 Requirement already satisfied: scikit-learn in /usr/local/lib/python3.11/site-packages (1.5.1)
#6 1.853 Requirement already satisfied: numpy>=1.19.5 in /usr/local/lib/python3.11/site-packages (from scikit-learn) (1.26.4)
#6 1.854 Requirement already satisfied: scipy>=1.6.0 in /usr/local/lib/python3.11/site-packages (from scikit-learn) (1.14.1)
#6 1.854 Requirement already satisfied: joblib>=1.2.0 in /usr/local/lib/python3.11/site-packages (from scikit-learn) (1.4.2)
#6 1.855 Requirement already satisfied: threadpoolctl>=3.1.0 in /usr/local/lib/python3.11/site-packages (from scikit-learn) (3.5.0)
#6 1.931 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 2.1s
#7 exporting to image
#7 exporting layers
#7 exporting layers 6.7s done
#7 writing image sha256:638cbf6bc648fc9fb668abc1f16af8b96b8678f5dba6c48ccd41ff1fb122f8a7 done
#7 naming to ghcr.io/openproblems-bio/task_template/methods/logistic_regression:test done
#7 DONE 6.7s
====================================================================
+/tmp/viash_test_logistic_regression_1444104436733743701/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_1444104436733743701/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/methods/logistic_regression/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
control_methods true_labels executable docker build_executable 0 1 SUCCESS
control_methods true_labels executable docker run_and_check_output.py 0 3 SUCCESS
control_methods true_labels executable docker check_config.py 0 3 SUCCESS
data_processors process_dataset executable docker start
data_processors process_dataset executable docker build_executable 0 1 SUCCESS
data_processors process_dataset executable docker run_and_check_output.py 0 3 SUCCESS
methods logistic_regression executable docker start
methods logistic_regression executable docker build_executable 0 1 SUCCESS
methods logistic_regression executable docker run_and_check_output.py 0 3 SUCCESS
methods logistic_regression executable docker check_config.py 0 3 SUCCESS
metrics accuracy executable docker start
metrics accuracy executable docker build_executable 0 1 SUCCESS
metrics accuracy executable docker run_and_check_output.py 0 3 SUCCESS
metrics accuracy 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 ...