Updated on 2025-11-04 GMT+08:00

Example: Using Preset Components to Create a Containerized Data Access Application

In this example, preset components are used to save data to and read data from a container. This helps users understand the functions and usage of the preset components. This example shows the orchestration and connection capabilities of the components to help users get familiar with the canvas orchestration function.

  1. Log in to ModelArts Studio and access the required workspace.
  2. In the navigation pane, choose Application Development > Industrial Application Orchestration. On the Industrial Application Orchestration page, click Create Canvas in the upper right corner.
    1. Drag the custom_python_script, save_data_to_local_file and read_data_from_local_file components to the canvas in sequence and configure the connection as shown in the following figure.
      Figure 1 Canvas overview
    2. Click Canvas parameters in the upper right corner of the canvas and set the file_path and data parameters, as shown in the following figure.
      Figure 2 Setting canvas parameters
    3. Click the custom_python_script component and associate it with the canvas input parameters set in the previous step.
      Figure 3 Configuring the custom_python_script component

      The code of custom_python_script is as follows:

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      import base64
      import json
      
      
      class Template:
          """
              Python component template class.
          """
      
          def __init__(self):
              """
                  Class initialization
              """
              pass
      
          def process(self, params_dict: dict):
              data_input = params_dict.get("data_input")
              data = json.loads(data_input)
              return {"data": data}
    4. Click the save_data_to_local_file component and associate the input parameters of the component with the output parameters of the previous node.
      Figure 4 Configuring the save_data_to_local_file component
    5. Click the read_data_from_local_file component and associate it with the canvas parameters.
      Figure 5 Configuring the read_data_from_local_file component
  3. After the canvas is configured, click Canvas release in the upper right corner to save and release the canvas.
    Figure 6 Canvas release
  4. Click Canvas deployment in the upper right corner of the current page to deploy the canvas.
  5. After the deployment is successful, click Canvas service to obtain the access address required for calling the canvas.
  6. Based on the access address in the service details, transfer the parameters required by the canvas and call the canvas to obtain the canvas execution result.
    Figure 7 Calling the canvas