Step 0. Organizing Your Code

Before Cloning the GitHub Repo

Before cloning this repo, structure your module in the following manner.

-- Modules
    -- {ModuleName}
        -- src
            -- {source_code}
            -- BQ_run_module.py

You should create a Modules folder which will only contain the modules that you wish to test in Bisque. You should name your {ModuleName} folder how you would like your module to appear in bisque, for ex. EdgeDetection. Create a folder named src and place all your source code inside it. Finally, create a python file named BQ_run_module.py inside the src folder.

BQ_run_module.py

Include all necessary data reading and pre-processing code in BQ_run_module.py as well as a function named run_module that will take input_path_dict and output_folder_path. Hyper parameters for running the module will have to be hardcoded for now but future releases will extend functionality for these as well. This function should load input resources from input_path_dict, do any preprocessing steps, run the algorithm, save all outputs to output_folder_path, AND return the outputs_path_dict.

input_path_dict

The input_path_dict parameter is a dictionary with input names as keys and their corresponding paths as values.

NOTE

It is important to note that these input names will be the labels that Bisque will display in your module web page.

****

Input Example

These input names must also match the input names specified with the cli in a later step. This will become clear later, for now, just choose some descriptive and unique input names that you would like Bisque to display in the module web page. You will use these input names to index the input_path_dict dictionary and load each resource from its respective path. Ex:

output_folder_path

The output_folder_path parameter is a path to the directory where output results should be saved.

output_paths_dict

You should save all output result paths into a dictionary with descriptive and unique output names as keys. These output names will be used by Bisque as labels in your module results web page.

Example

Output Example

These output paths must also be the same names used to specify outputs with the cli at a later step. The run_module function must return this dictionary of output paths in order for Bisque to read and post results back to the module web page.

A sample BQ_run_module.py is shown below:

Containerizing application

Test your BQ_run_module.py file by writing some test code in the if __name__ == '__main__': code block. A simple test implementation is shown above. Once BQ_run_module.py is working as expected, you can containerize your application with docker. Follow the instructions on downloading docker, creating a Dockerfile, and running a container. Here is an example of a Dockerfile for a simple edge detection module.

You must include the section**** Copy Source Code ****in your own Dockerfile.

In your {ModuleName} folder, you can create your image by running

Note that docker images are only allowed to have lowercase letters.

Run your docker container with docker run -it {modulemame}:v0.0.0 bash and test your application inside the container by calling python BQ_run_module.py.

Last updated