(Optional) Customizing a Configuration File

You can customize a configuration file to define how ModelArts logs are cleaned, how much console log data is read, and how files are parsed, and save the custom configurations in the ${HOME}/.ascend_faultdiag/custom-fd-config.json file. When the fault diagnosis function is executed, MindCluster Ascend FaultDiag automatically loads the custom configurations in the path and cleans and diagnoses faults based on the configurations.

If you need to customize a path for storing fault files, see Customizing the Home Directory of MindCluster Ascend FaultDiag.

Procedure

  1. Add or modify custom configurations in a JSON file.
    ascend-fd config --update custom-config.json
    If the following information is displayed, the operation is successful:
    The custom config file was updated successfully.
    The following is an example of the JSON file, which is for reference only. You need to modify configurations as required. For details about the parameters in the file, see Table 1.
    {
    	"enable_model_asrt": false,   # Whether to clean key ModelArts logs. By default, this function is disabled.
    	"train_log_size": 1048576, # Size of the console log to be read. The default value is 1 MB (1024 × 1024 bytes = 1048576 bytes).
    	"custom_parse_file": [        # Custom parse file. The value can be []. A maximum of 10 files can be configured.
    		{
    			"file_path_glob": "test_custom/*.log",      # A large directory is required for --custom_log xx. Files are matched in the Unix wildcard mode in the corresponding path.
    			"log_time_format": "%Y-%m-%d-%H:%M:%S.%f",  # Time format of a log file. It follows the standard format string conventions for date and time parsing and formatting.
    			"source_file": ["CustomLog"]                 # Log file type. A maximum of 10 log file types can be configured.
    		}
    	]
    	"timezone_config" : {
    		"lcne": true   # Whether to support time zone conversion for LCNE logs. By default, this function is disabled.
    	}
    }

    The more parser files you configure, the lower the overall cleaning performance may be

    Table 1 Parameters

    Parameter

    Value Type

    Parameters

    Required (Yes/No)

    Value Description

    enable_model_asrt

    Bool

    Whether to clean key ModelArts logs

    No

    The default value is false.

    • true
    • false

    train_log_size

    Integer

    Size of the console log to be read

    No

    The value is a positive integer. The default value is 1048576 (1 MB = 1024 × 1024 bytes = 1048576 bytes).

    custom_parse_file

    List

    Custom parser file

    No

    A maximum of 10 files can be configured.

    file_path_glob

    String

    Custom parser file (Unix wildcard pattern)

    Required when custom_parse_file exists and is not "[]".

    The value can contain letters, digits, spaces, and asterisks (*), for example, test_custom/*.log.

    log_time_format

    String

    Time format string for printing logs in the custom parser file

    No

    The value can contain 1 to 50 characters, including letters (YmdHMSf) and special characters (percent sign, hyphen, space, colon, comma, and period), for example, "%Y-%m-%d %H:%M:%S.%f".

    • %Y: 4-digit year, for example, 2023 or 2024.
    • %m: 2-digit month (01-12), for example, 03 indicates March.
    • %d: 2-digit date (01-31), for example, 05 indicates the fifth day.
    • %H: hour of one day (00-23).
    • %M: minute of one hour (00-59).
    • %S: second of one minute (00-59).
    • %f: microsecond.

    source_file

    List

    Log file type

    Required when custom_parse_file exists and is not "[]".

    A maximum of 10 character strings can be configured. Each string contains 1 to 50 characters, including letters, digits, English symbols, and spaces.

    timezone_config

    Dictionary

    Log time zone conversion

    No

    -

    lcne

    Bool

    Whether to support LCNE log time zone conversion

    No

    The default value is false.

    • true
    • false

    mindie

    Bool

    Whether to support MindIE log time zone conversion. The function is not supported currently.

    No

    The default value is false.

    • true
    • false
  2. Views the custom configuration.
    ascend-fd config --show
  3. (Optional) Verify the custom-fd-config.json file. If you directly modify the custom fault entity information in the customfd-config.json file, run the following command to verify the integrity and availability of the modified file.
    ascend-fd config --check

    If the following information is displayed, the file verification is successful:

    The custom config file was updated successfully.

    You are not advised to directly modify the custom-fd-config.json file; otherwise, MindCluster Ascend FaultDiag may be abnormal.

  4. (Optional) If you add a custom parser file (for example, the JSON file in Step 1) to the configuration file, run the following command to to execute the cleaning process. This will clean all files matching the wildcard pattern (for example, worker-0/test_custom/*.log).
    ascend-fd parse --custom_log worker-0/ -o Cleaning output directory

    Only the --custom_log command can be used to clean the custom parse file. The -i command is not supported.