Process Startup Configuration File

The following uses an application process as an example to describe the detailed process startup configuration. For details about the parameters, see Table 1.

test_app:
    bin_path: "/home/test_app"
    depends: []
    uid: 1000
    gid: 1000
    arguments: ["1", "0", "topic_name", "3", "0", "0", "0", "1", "0","__name:=listener"]
    env:
        env1: "xxx1"
        env2: "xxx2"
    restart: "on-failure"
    term_time_out: 10000
    is_force_term: false
    core_affinity: [1,2]
    res_group_name: "OTHER"
    nice: -10
    sharepool_groups:
        GroupName_A: alloc    # Allocate the alloc write read free permission.
        GroupName_B: rw       # Allocate the write read free permission.
        GroupName_C: ro       # Allocate the read free permission.
    cpuset: "AICPU/DEV1"

    # Fields customized by each owner. The following are extended fields of DataMaster.
    is_ros_node: true
    is_auto_boot: false
    is_reporting: true
Table 1 Parameters in the process startup configuration file

Parameter Type

Description

test_app

Application name, which must be globally unique and can be customized.

  • If the application is a Hiva Open node, ensure that the name is the same as the value of NodeName.
  • The value of AppName cannot contain the number sign (#).

bin_path

(Mandatory) Binary path. The value is a character string and must be an absolute path.

depends

Dependency items when the application is started. The value is a list of character strings. By default, this parameter is left blank. For example, depends: ["TestApp1", "TestApp2"]. The list items are the names of other applications, indicating that the startup depends on these applications.

uid

(Mandatory) Application UID. The value is an integer. The valid value is an unsigned integer (an integer greater than or equal to 0). The value 0 indicates the root user.

gid

(Mandatory) Application GID. The value is an integer. The valid value is an unsigned integer (an integer greater than or equal to 0). The value 0 indicates the root user.

arguments

Parameter used when the application is started. The value is a list of character strings. By default, this parameter is left blank. Example: arguments: ["1", "test"].

env

Environment variable. By default, this parameter is left blank.

restart

Indicates whether to restart an application when the application exits. The value is a character string. The options are no, on-failure, on-forever, and on-until-succeed. The default value is no.

  • no: An application is not restarted regardless of how it exits.
  • on-failure: An application is restarted when it exits abnormally. The process is restarted for five times in any 60s window. If the process exits abnormally for the sixth time in 60s, the process is not restarted.
  • on-forever: An application is restarted when it exits abnormally.
  • on-until-succeed: indicates a non-resident process. After the process is successfully executed, it exits and does not restart. The restart mechanism is the same as that of on-failure.
  • Precautions for on-until-succeed:
    • This parameter is mandatory for non-resident processes and is not allowed for resident processes.
    • The exit code 0 is used as the normal exit flag of a non-resident process.
    • Non-resident processes cannot depend on other processes. That is, the depends parameter must be empty. If dependency is configured, the management plane fails to be started.

term_time_out

Timeout interval when an application is terminated. The value is an integer, in milliseconds. The default value is 60000.

  • If the ProcMgr sends a termination signal (15) to stop an application, but the application is not stopped after a specified time, it is called that ending the application through the ProcMgr times out.
  • This parameter is related to the value of is_force_term. For details, see the description of is_force_term.

is_force_term

Indicates whether the ProcMgr needs to forcibly exit the application when the application fails to end. The value is of bool type, and the default value is false.

  • When is_force_term is set to true, the application is forced to exit (using the signal of 9) once ending the application through the ProcMgr times out.
  • When is_force_term is set to false, the system does not forcibly exit the application but returns a message indicating that the application fails to be ended to the owner.

core_affinity

Application affinity attribute setting. The value is a list of numbers representing core IDs. By default, this parameter is left blank. For example, core_affinity: [1, 2] indicates that the application process is bound to cores 1 and 2.

  • Only the core IDs for Ctrl CPU can be configured for the affinity attribute. For example, if Ctrl CPU is 0-2, only the core IDs in the range from 0 to 2 (including 0 and 2) can be configured for the affinity attribute.
  • Query the Ctrl CPU allocation (cat /sys/fs/cgroup/cpuset/CtrlCPU/cpuset.cpus).
  • If a cpuset group is configured, the cpuset.cpus limit of the cpuset group takes effect. If a value exceeds the cpuset.cpus limit, the value does not take effect.
NOTE:

If a non-Ctrl CPU configuration is configured, the process fails to be started.

res_group_name

Name of the resource group to which the application belongs. The value is a character string. The valid value is one of the values configured in the env.cfg file. By default, this parameter is left blank.

nice

Priority of the APP process. The value ranges from –20 to 19. The default value is 0.

sharepool_groups

Permission configuration of the process group of the shared memory.

  • A process can have the alloc permission of only one group.
  • This parameter takes effect only on the applications on the data plane (processes managed by DataMaster).
  • If the permission is not configured, no group is added by default.
  • If this parameter is not configured, the default group is configured.
NOTE:
  • alloc: allocates the alloc, write, read, and free permissions.
  • rw: allocates the write, read, and free permissions.
  • ro: allocates the read and free permissions.

cpuset

CPU set to which an application belongs. The value is a character string. The valid value is the cpuset created by the system in advance. By default, this parameter is left blank.

is_ros_node

Indicates whether an application is a ros node. The value is of bool type and the default value is false. If the node is a ros node, the application reports the running status to the DataMaster through the Hiva Open framework by default. In this case, the setting of is_reporting does not take effect.

is_reporting

Indicates whether an application reports the running status (running) to the DataMaster. The value is of bool type and the default value is false. This parameter is valid only when is_ros_node is set to false.

  • If is_reporting is set to true, the application itself reports its running status to the DataMaster.
  • If is_reporting is set to false, the ProcMgr reports the running status of the application to the DataMaster. (After the ProcMgr creates a subprocess using the fork and detects that the subprocess is started, the ProcMgr reports the running status of the application to the owner. The reporting time is earlier than that of the application itself.)

is_auto_boot

Indicates whether to automatically start an application when the system starts.