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

Dockerize WSIMOD #39

Merged
merged 5 commits into from
Nov 23, 2023
Merged

Dockerize WSIMOD #39

merged 5 commits into from
Nov 23, 2023

Conversation

dalonsoa
Copy link
Collaborator

@dalonsoa dalonsoa commented Nov 16, 2023

This PR dockerize the execution of WSIMOD and adds a docker-compose file to facilitate local testing and deployment.

To be reviewed and merged after #38 , as it builds on top of it.

Closes #25

@dalonsoa dalonsoa marked this pull request as ready for review November 16, 2023 14:08
@dalonsoa
Copy link
Collaborator Author

dalonsoa commented Nov 17, 2023

To test the code:

Without Docker

Just install WSIMOD and run wsimod docs/demo/examples/quickstart_demo.yaml. There should be a progress bar and a few files generated in results/quickstart_results.

With Docker

This is meant to run in DAFNI, so the file structure needs to be a little specific.

  1. Create a folder to host your input data wherever you want.
  2. Create a folder to host you output data wherever you want.
  3. Copy docs/demo/data/processed/timeseries_data.csv to the inputs folder.
  4. Copy docs/demo/examples/quickstart_demo.yaml to the inputs folder.
  5. Create a .env file in the root directory of the project for docker-compose to read and put the following environment variables inside:
WSIMOD_SETTINGS=quickstart_demo.yaml
WSIMOD_INPUTS={root_directory_for_the_inputs}
WSIMOD_OUTPUTS={root_directory_for_the_outputs}

For reference, this is what I have, with the inputs and outputs in the same folder, the the yaml file called settings_new.yaml:

WSIMOD_SETTINGS=settings_new.yaml
WSIMOD_INPUTS=./scratch
WSIMOD_OUTPUTS=./scratch
  1. Run docker-compose up

The output should be conceptually similar to the previous case, getting the same output files in the output folder.

@AdrianDAlessandro , @TinyMarsh , @tsmbland , @tg2414 , in case you want to try this.

Copy link
Contributor

@TinyMarsh TinyMarsh left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

I don't understand why you need to move things around and create files in different locations. Why not just change where those files are in the repo so that it is compatible with DAFNI? Removing as much manual intervention as possible is usually the best way to go here.

Also, in the instructions it's not clear which file WSIMOD_SETTINGS is meant to be. You use a file called settings_new.yaml but I don't know where to get that from / make it.

Also, the docker build failed for me, it failed to build wheels for numpy==1.26.2 - this might be because that version of numpy is too recent for the docker image, I'm not sure. It successfully installed in a virtual environment.

docker-compose.yaml Show resolved Hide resolved
@dalonsoa
Copy link
Collaborator Author

Keeping aside the WSIMOD code, there're no files in the repo needed for DAFNI. The files I copy are just taken from the documentation/tutorials, using them as an example of how to run the tool. Neither the Dockerfile nor the docker-compose.yaml file need those files specifically, just some input files to run the model with as an example. Therefore, calling a settings file settings.yaml, settings_new.yaml or something_different.yaml is irrelevant as long as that name is passed to the container. In the instructions, that file is quickstart_demo.yaml. I've updated the expected contents of the .env file to reflect this.

Those input files (the settings as well as any required data file) will need to be provided by the user in DAFNI using the DAFNI web interface, so nothing for us to worry about.

About the error with numpy, that's very odd because I'm using exactly that version - pinned in the requirements.txt file -, with that particular base image, and it works without any problem. No idea where your problem might be coming from. What architecture does a Docker container see? It might be that for Python:3.11.5-alpine numpy does not exist for ARM processors?

On your last comment, you need to include explicitly the environment file to use if you need the environment variables in the docker-image.yaml file itself, which is the case. Without that section, docker-compose fails saying it cannot find "WSIMOD_INPUTS" and "WSIMOD_OUTPUTS"

Copy link

@AdrianDAlessandro AdrianDAlessandro left a comment

Choose a reason for hiding this comment

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

Ok great, that all makes sense. As long as you can build the docker image, it's fine. I think my issue is probably ARM-related

@dalonsoa dalonsoa merged commit a42eb25 into main Nov 23, 2023
21 checks passed
@dalonsoa dalonsoa deleted the docker branch January 11, 2024 16:46
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.

Create docker container for WSIMOD
4 participants