Create#

To create your Executor, run:

jina hub new

For basic configuration (advanced configuration is optional but rarely necessary), you will be asked for:

  • Your Executor’s name

  • The path to the folder where it should be saved

After running the command, a project with the following structure will be generated:

MyExecutor/
├── executor.py
├── config.yml
├── README.md
├── requirements.txt
└── Dockerfile
  • executor.py contains your Executor’s main logic.

  • config.yml is the Executor’s configuration file, where you can define __init__ arguments using the with keyword. You can also define meta annotations relevant to the Executor, for getting better exposure on Executor Hub.

  • requirements.txt describes the Executor’s Python dependencies.

  • README.md describes how to use your Executor.

  • Dockerfile is only generated if you choose advanced configuration.

Tips#

  • Use jina hub new CLI to create an Executor

    To create an Executor, always use this command and follow the instructions. This ensures the correct file structure.

  • You don’t need to manually write a Dockerfile

    The build system automatically generates an optimized Dockerfile according to your Executor package.

Tip

In the jina hub new wizard you can choose from four Dockerfile templates: cpu, tf-gpu, torch-gpu, and jax-gpu.

  • If you push your Executor to the Executor Hub, you don’t need to bump the Jina version

    Hub Executors are version-agnostic. When you pull an Executor from Executor Hub, it will select the right Jina version for you. You don’t need to upgrade your version of Jina.

  • Fill in metadata of your Executor correctly

    Information you include under the metas key in config.yml is displayed on Executor Hub. The specification can be found here<config.yml>.