- Install SDK Dependencies
- Install and Build SDK
- Create Module
- Edit Module and Method(s)
- Locally Test Module and Method(s)
- Register Module
- Test in KBase
- Complete Module Info
- Deploy
The base KBase Docker image contains a KBase Ubuntu image, but not much else. You will need to add whatever dependencies, including the installation of whatever tool you are wrapping, to the Dockerfile that is executed to build a custom Docker image that can run your Module.
For example:
RUN \
git clone https://github.com/voutcn/megahit.git && \
cd megahit && \
git checkout tags/v1.0.3 && \
make
Note: you do not have to add any lines to the Dockerfile for installing your SDK Module code, as this will happen automatically. The contents of your SDK Module git repo will be added at /kb/module.
It is also important to note that layers in the Docker image are generated by each command in the Dockerfile. For a streamline Docker image which will deploy on a worker node more quickly and make cycles of Docker image builds faster, it is best to remove any large, extraneous files, such as a tarball from which you installed a tool.
So you want commands in your Dockerfile like this:
RUN \
wget blah.com/tarball.tgz && \
tar xzf tarball.tgz && \
cd tarball && \
make && \
cd .. && \
rm -rf tarball.tgz
instead of this (Bad):
RUN wget blah.com/tarball.tgz
RUN tar xzf tarball.tgz
RUN cd tarball
RUN make
RUN cd ..
RUN rm -rf tarball.tgz
because the latter does not remove the previous bloating layers, despite the "rm" command.
Edit the local test config file (test_local/test.cfg
) with a KBase user account name and password (note that this directory is in .gitignore so will not be copied to github. You're safe!):
test_user = TEST_USER_NAME
test_password = TEST_PASSWORD
In the Docker shell, run tests:
cd test_local
kb-sdk test
This will build your Docker container, run the method implementation running in the Docker container that fetches example ContigSet data from the KBase CI database and generates output.
Inspect the Docker container, such as seeing whether your wrapped tool was installed properly, by dropping into a bash console and poke around. From the test_local
directory:
./run_bash.sh
Unfortunately, you will have to rebuild the Docker image each time you change your module code (e.g. KIDL <MyModule>.spec, <MyModule>Impl.py, and your testing code) but this happens automatically for you when you run kb-sdk test, so it just slows you down rather than add any extra effort. However, if you change the KIDL <MyModule>.spec file, you will have to rerun make to propagate those changes to the <MyModule>Client and <MyModule>Impl code (and likely will have some tweaks to apply to the Impl code to match the spec changes). Happy debugging!
(don't forget to git commit and git push your edits to your github repo)