This topic describes FAQ about custom processors.

How can I improve the upload efficiency if the package of the custom processor is too large?

In Elastic Algorithm Service (EAS), we recommend that you use Docker images to upload runtime environments and large files. If the business code is modified, you only need to incrementally update the modified part, which significantly improves the development efficiency. For more information, see Develop custom processors by using Python.

Why am I unable to find the Python package that has been installed during the processor development after the processor is published?

The ENV environment of the Python processor is built based on Conda. Therefore, programs that can run in the development environment may depend on the Python packages in the user's .local environment. Run the pip install --force-reinstall command in the ENV environment to ensure that all Python program dependencies have been installed in the correct directory.

Why am I unable to find some system dependencies of the ENV environment when EAS is running online?

The user's development environment is unpredictable, which may be different from the online EAS environment. To ensure that the development environment is consistent with the online environment, EAS provides the pre-built development images to configure the ENV environment of the Python processor. Conda is pre-installed in the development image, and the ENV environment for Python is generated. The following code shows the development images provided by EAS:
# The base image installed with only Conda.
registry.cn-shanghai.aliyuncs.com/eas/eas-python-base-image:latest
# SDK for Python installed with Conda, Python 2.7, and EAS allspark 0.8.
registry.cn-shanghai.aliyuncs.com/eas/eas-python-base-image:py2.7-allspark-0.8
# SDK for Python installed with Conda, Python 3.6, and EAS allspark 0.8.
registry.cn-shanghai.aliyuncs.com/eas/eas-python-base-image:py3.6-allspark-0.8

How can I solve the problem that libSM.so.6: cannot open shared object file: No such file or directory is reported upon cv2 import?

The common pip install opencv method depends on the libXext, libSM, and libXrender libraries. The libXext, libSM, and libXrender libraries are not pre-installed in the online EAS environment. Therefore, the cv2 that is installed by using this command may properly run in the offline testing environment but may fail to run in the online environment. You can resolve this problem by using one of the following methods:
  • Run the pip install openv-python-headless command to install cv2. This method does not depend on libXext, libSM, and libXrender libraries.
  • Search for the ISO files of the libXext, libSM, and libXrender binary libraries installed in the system, copy them to the ENV/lib directory, and then upload them together with the processor. This method may involve other dependencies, which you can handle as needed.

How can I configure environment variables in the Python processor of EAS?

The Python processor of EAS automatically adds all directories in the processor directory to the LD_LIBRARY_PATH environment variable. Therefore, you can store the additional dependencies anywhere in the processor directory. We recommend that you run the os.environ['key'] = 'val' command in the Python program to configure other environment variables.

How does the EAS processor prevent a process from exiting due to code exceptions?

In the process of implementing business logic, the try-catch mechanism is added to detect exceptions, which ensures that the business code does not exit due to exceptions. If a process exits due to specific reasons, EAS can automatically restart this process to ensure service continuity.

How can I configure the AccessKey pair and endpoint?

You must provide your AccessKey ID and AccessKey secret to complete identity authentication when you deploy a model. By default, the endpoint of the China (Shanghai) region is used. To deploy the model in another region, you can use the -e parameter to specify the endpoint of the corresponding region.
./eascmd64 config -i <yourAccessKey ID> -k <yourAccessKey Secret> -e pai-eas.cn-beijing.aliyuncs.com

Why does the task remain in the [OK] Waiting [Total: 1, Pending: 1, Running: 0] state when I use EASCMD to create a task?

The resources required for task creation may be insufficient or cannot be found. You must check whether the resource region and name are correctly configured, and then determine whether available resources are sufficient. You can view related configurations in the following EAS description file:
{
  "name": "service",
  "token": "[Authorization-token]",
  "data_image":"[your-public-docker-image-repo]",
  "processor_entry": "app.py",
  "processor_type": "python",
  "processor_path": "[oss://eas-model-shenzhen/xxxxxxxxx/codes.tar.gz]",
  "metadata": {
    "region": "cn-shenzhen", # Ensures that the region of the resource group is correct.
    "resource": "resource-name", # Ensures that the resource group name, such as EAS-LsFlrwBP56, is correct and corresponds to the region.
    "gpu": 1,
    "cpu": 6,
    "memory": 2000,
    "instance": 2, # The number of resources that each instance has (gpu=1, cpu=6, memory=2000B).
                # If resources are insufficient, the task remains in the waiting state.
    "cuda": "10.0"
  }
}