If you want to use your own algorithms on the UP42 platform, you can create custom blocks that can be seamlessly added to your workflows as processing blocks. These blocks will appear in the console tab Custom blocks.
While developing custom blocks in Python, we recommend using the UP42 block utilities package. This package contains base classes for processing blocks, and several facilities to handle testing.
This section will provide step-by-step instructions on how to upload a custom block to UP42, using the sharpening block from the public UP42 GitHub profile.
Requirements
Download the example block
Clone the example block using Git and navigate to the folder that contains the Dockerfile and UP42Manifest:
git clone https://github.com/up42/sharpening.git
cd sharpening
In this guide, we will skip modifying the example code and directly push the block to the UP42 platform. For more advanced instructions on custom block development, please refer to Developing a custom processing block.
Authenticate on the UP42 Docker registry
To log in to the UP42 Docker registry, replace the username with the email address associated with the UP42 account. When asked for your password, enter the password of your UP42 account.
# Template
docker login -u=<USERNAME> http://registry.up42.com
# Example
docker login -u=[email protected] http://registry.up42.com
Build the Docker image of the custom block
To build the block image, you need to use your UP42 user ID. This can be found in the console tab Custom blocks, where you need to click on PUSH A BLOCK TO THE PLATFORM.
A new window will open. At the bottom of the window, go to the section Push the image to the UP42 Docker registry. Copy the user ID from the command (e.g. 6760d08e-54e3-4f1c-b22e-6ba605ec7592
).
Build the Docker image with the command below:
# Template
docker build . -t registry.up42.com/<USER-ID>/sharpening:1.0 \
--build-arg manifest="$(cat UP42Manifest.json)"
# Example
docker build . -t registry.up42.com/6760d08e-54e3-4f1c-b22e-6ba605ec7592/sharpening:1.0 \
--build-arg manifest="$(cat UP42Manifest.json)"
Push the custom block to UP42
Now you can push the image to the UP42 Docker registry. To proceed, you need to use your UP42 user ID.
# Template
docker push registry.up42.com/<USER-ID>/sharpening:1.0
# Example
docker push registry.up42.com/6760d08e-54e3-4f1c-b22e-6ba605ec7592/sharpening:1.0
The Sharpening block will now be displayed in the console tab Custom blocks.
Add the custom block to a workflow
When building a workflow, you can add the custom block from the tab Custom blocks.
Congratulations, you successfully pushed a custom block to your UP42 Docker registry! For more advanced instructions on custom block development and publishing, please refer to Developing a custom processing block.