Functions of Preset Components
The platform provides multiple preset components.
|
Category |
Component |
Function |
|---|---|---|
|
Data read and write |
convert_obs_file_to_base64 |
|
|
save_data_to_local_file |
||
|
read_data_from_local_file |
||
|
Logic component |
deploy_together |
|
|
Customizing a script |
custom_python_script |
|
|
Other |
call_stream_api |
|
|
call_api |
convert_obs_file_to_base64 Component
The convert_obs_file_to_base64 component is used to read files from OBS and convert the files to Base64 encoding. It is applicable to Base64 reading and conversion of small files, such as images.
|
Category |
Parameter |
Description |
|---|---|---|
|
Input params |
obs_path |
Path of the OBS file to be read. The value starts with obs://. |
|
ak |
Access key (AK) of the tenant where the OBS file is located. |
|
|
sk |
Secret key (SK) of the tenant where the OBS file is located. |
|
|
Output params |
output |
Output result after the file is converted to a Base64-encoded file. |
To obtain the AK and SK, perform the following steps:
Log in to the Huawei Cloud management console, hover the cursor on the username in the upper right corner of the page, and click My Credential. On the My Credential page that is displayed, click the Access Keys tab to obtain the AK and SK. If no AK or SK is available, click Add Access Key to create one.
save_data_to_local_file Component
The save_data_to_local_file component is used to store single-level JSON data to a local CSV or JSON file.
|
Category |
Parameter |
Description |
|---|---|---|
|
Input params |
file_path |
Path of the local file. The file can be in CSV or JSON format. Example: /home/HwHiAiUser/test.csv |
|
data |
JSON data to be written to the file. |
|
|
encoding |
File content code. The value can be gbk or utf-8. The default value is gbk. If the file_path file is in CSV format, you are advised to use GBK encoding. |
|
|
Output params |
flag |
Length of the file after JSON data is written. |
read_data_from_local_file Component
The read_data_from_local_file component can be used to read local data. The component parameters are described as follows.
|
Category |
Parameter |
Description |
|---|---|---|
|
Input params |
file_path |
Path of the local file to be read. The file can be in CSV or JSON format. Example: /home/HwHiAiUser/test.csv |
|
encoding |
Encoding format of the file content. The options are gbk and utf-8. |
|
|
Output params |
data |
JSON data read from the file. |
deploy_together Component
The deploy_together component allows all subcomponents dragged to the same container to be integrated into a container service, which simplifies the management and deployment process. These subcomponents share the resources of the same container, such as CPUs, memory, and environment variables. These subcomponents run in the same container, which reduces the overhead and complexity of cross-container communication and facilitates unified configuration and management.
The component parameters are described as follows.
|
Category |
Parameter |
Description |
|---|---|---|
|
Deployment Configuration |
CPU |
Minimum number of physical CPU cores required for deployment. |
|
Memory |
Minimum size of memory reserved for deploying the component. |
|
|
Ascend |
Number of NPUs used for deployment. |
|
|
Environment Variable |
External environment variables defined in the component code. |
custom_python_script Component
The functions of the custom_python_script component are similar to those of the custom script component in component management. You can compile Python code to implement specific component functions. The difference is that the custom_python_script component allows you to create and delete parameters in the canvas and compile script code. If any problem occurs during debugging, you do not need to return to the component management page for processing, which greatly facilitates debugging, after the debugging is complete, the component can be archived on the component management page. Note that each time you drag the custom_python_script component to the canvas, you need to create its parameters and supplement the script. When you delete the component, the created information will be lost.
call_stream_api Component
The call_stream_api component can be used to invoke the model service with deployed streaming output parameters. For example, the component parameters in the NLP model streaming scenario are described as follows:
|
Category |
Parameter |
Description |
|---|---|---|
|
Input params |
body |
Request body required for invoking a service is in object format. The default value is {}. |
|
headers |
Request header required for invoking a service is in object format. The default value is {}. |
|
|
url |
Request address for invoking a service. The value is a character string. You can click the Select Service button on the canvas to fill in the address. |
|
|
request_type |
Type of the request for invoking the service. The default value is POST. |
|
|
Output params |
response |
Streaming return value of the invoked service. |
call_api Component
The call_api component can be used to invoke the five deployed model services (non-streaming output parameter scenario). The component parameters are described as follows.
|
Category |
Parameter |
Description |
|---|---|---|
|
Input params |
body |
Request body required for invoking a service is in object format. The default value is {}. |
|
url |
Request address for invoking the service. The value is a character string. You can click the model association button on the canvas to invoke the deployed algorithm package component. |
|
|
headers |
Request header required for invoking a service is in object format. The default value is {}. |
|
|
request_type |
Type of the request for invoking the service. The default value is POST. |
|
|
Output params |
response |
Return value of the invoked service. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot