A multi-algorithm combination calling method based on open source Hongmeng atomic service
By packaging algorithms into atomic services in the OpenharMony operating system, and using its dynamic combination and scalability characteristics, multi -algorithm dynamic combinations and switching are realized, and the problem of low multi -algorithm switching efficiency in existing technology is solved. System flexibility and user experience.
Patent Information
- Application Number
- CN202411000571.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-07-25
AI Technical Summary
In the Openharmony operating system, it is difficult for the existing technology to achieve efficient and reliable multi-algorithm switching and calling, resulting in the inability to meet the needs of multiple scenarios to transform, affecting the user experience.
By encapsulating various algorithms into atomized services and integrating them in the algorithm library, using the dynamic combination, standardized interfaces and scalability features of the atomized services, dynamic combination and switching of algorithm models can be achieved by simply changing the configuration file. The algorithm calls the relationship.
The dynamic combination and switching of the algorithm model has been implemented, and the efficiency of multi -algorithm combination calls in the Openharmony system can be improved. It can easily cope with the scenes of complex changes and provide an efficient user experience.
Smart Images

Figure CN118838663B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of operating system software and is a multi-algorithm combination calling method based on open source Hongmeng atomic service. Background Art
[0002] At present, the multi-algorithm calling method has become more and more mature and has been widely used. However, most of the current methods need to rewrite the calling logic of each algorithm each time according to the changes in business logic to complete the multi-algorithm calling in the open source Hongmeng Openharmony operating system, which has a great impact on the efficiency of algorithm switching. Therefore, under the Openharmony operating system, there is no efficient and reliable algorithm calling module to realize the switching and calling of multiple algorithms, which cannot meet the needs of more scene changes and cannot provide users with a good experience. Summary of the invention
[0003] In order to solve the above technical problems, the present invention provides a multi-algorithm combination calling method based on the open source Hongmeng atomic service, which can realize the multi-algorithm combination calling of heterogeneous algorithms such as python, C / C++, and AI models on Openharmony, and encapsulate various algorithm models into atomic services and integrate them in the algorithm library. As the business logic changes, it is only necessary to change the algorithm calling relationship in the configuration file, pull the atomic service corresponding to the algorithm model, and through the complete algorithm scheduling module, the mutual switching and calling of different atomic services can be realized.
[0004] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0005] A multi-algorithm combination calling method based on open source Hongmeng atomic service, the steps are as follows:
[0006] Step 1: Encapsulate various algorithms into atomic services and integrate them into the algorithm library. Encapsulate the algorithm model using atomic services, a lightweight and easy-to-circulate method. Use atomic capabilities to pull algorithms with relevant capabilities from the algorithm library according to business needs, and release them back to the library after completing the business. When the business logic changes, the algorithm model in the algorithm library can be dynamically selected to support the call and switching of various algorithms.
[0007] Step 2: Use the capabilities of atomic services to define the dynamic combination, standardized interfaces, and scalability of each algorithm in the algorithm library. The detailed steps are as follows:
[0008] Step 2.1. In the Openharmony operating system, by using the dynamic combination characteristics of atomic services, by using the autonomous and flexible calling and combination of various algorithm models, applications with different functions can be dynamically built, and microsecond-level switching of different algorithms can be achieved to achieve better performance, effects or adapt to different environments to meet complex application systems. First, using the service call and discovery mechanism, the required services are found from the algorithm library, which are sufficient to cover the different functions and requirements of the current task. Secondly, according to the needs of business logic, these algorithm models are dynamically selected and combined to form a complete application system. Finally, using the flexibility of atomic services, adjustments and optimizations can be made at any time according to changes in business logic, and services can be dynamically added, deleted or replaced to meet the changing needs of the application system.
[0009] Step 2.2: In the Openharmony operating system, a set of unified interface specifications are defined using the standardized interface characteristics of atomic services, including key information such as interface name, parameter list, and return value type. In this way, different services can be designed and implemented according to these specifications, so that different services corresponding to heterogeneous algorithm models can work together seamlessly. Through this standardized interface definition, the integration between different services becomes simpler and more reliable. The application system only needs to focus on how to combine and call each algorithm model without worrying about the specific implementation details of the underlying services, thereby reducing the complexity of the heterogeneous algorithm integration process and improving the flexibility and scalability of the system.
[0010] Step 2.3: In the Openharmony operating system, the scalability characteristics of atomic services are utilized. Each algorithm model is encapsulated as an independent atomic service, which is designed in a loosely coupled manner. The dependencies between each other are relatively small, and they can be expanded and replaced independently of each other. Each algorithm model follows a unified standardized interface definition to achieve cross-model functional integration, greatly improving the interoperability between algorithm models. When a new algorithm model needs to be integrated into the algorithm library or an existing algorithm model in the algorithm library needs to be replaced, only the logic of the front-end application layer needs to be replaced without modifying the back-end underlying code. The scalability of atomic services provides good support for the integration of heterogeneous algorithm models, greatly reducing the complexity of system expansion and maintenance.
[0011] Step 3: Clearly define the business logic of each algorithm in the configuration file, including data input (defining the input data format and source required by the algorithm), processing (defining the specific processing steps of the algorithm on the input data) and output (defining the output format of the algorithm processing results), as well as the dependency and calling relationship between each algorithm and the business logic. The dynamic calling and switching of business logic can be met in an autonomous and configurable way.
[0012] Step 4: In the Openharmony operating system, define a complete set of algorithm scheduling modules to improve the functions of algorithm combination and calling. The detailed steps are as follows:
[0013] Step 4.1: Call the model management function to start, stop and run different models.
[0014] Step 4.2: Call the model scheduling function, customize the model scheduling strategy according to the designed operation plan, and complete the operation of various algorithm models by calling the model management function.
[0015] Step 4.3, call the operation monitoring function to keep track of the execution of the task, detect abnormal situations in time, and intervene and handle them. This module usually includes two modes: alarm when task execution fails and alarm when task execution is delayed. In addition, you can also develop or customize monitoring strategies that suit your needs based on this.
[0016] Step 4.4, call the log management function to timely collect and store the log information generated when the task is executed, and retrieve and browse the detailed log of the task execution. By viewing the log function, you can easily understand and search the detailed records of the task operation, which provides a powerful tool for troubleshooting errors and determining the location of the problem.
[0017] Step 4.5, call the inspection test function. If you find that there is a problem with the result data after the task is completed, call the model management function and the model scheduling function again. If the data obtained is completed by a single task, just re-run the task; if the data obtained is completed by multiple tasks, you need to analyze whether each task is executed in parallel or in series. If it is executed in parallel, you only need to re-run the task with the problem; if it is executed in series, you need to re-run the task with the problem and other tasks following the task. This ensures that all potentially affected tasks can obtain accurate results.
[0018] Step 4.6, call the algorithm switching management function. When the algorithm-related business logic is changed during the operation of the Openharmony operating system, it is only necessary to change the calling relationship of the algorithm in the configuration file. Without interrupting the operation of the Openharmony operating system, the corresponding atomic service is replaced to dynamically implement microsecond-level switching of different algorithms to achieve better performance, effect or adapt to different environments. In this way, the switching efficiency of business logic can be improved, a lot of time can be saved, and a better user experience can be provided.
[0019] The beneficial effects of the present invention are:
[0020] By utilizing the characteristics of atomic services and encapsulating the algorithm model into an atomic service, the algorithm model can be dynamically combined and easily expanded, shielding the language differences of heterogeneous algorithms, thereby completing business closure. By changing the calling relationship between the algorithms in the corresponding configuration files at the front-end application layer without modifying the back-end code, the transformation requirements of the business logic can be met, which greatly improves the efficiency of multi-algorithm combination calls in the Openharmony system, can easily cope with more complex and changing scenarios, and provide users with a practical and simple algorithm calling experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A schematic diagram of a multi-algorithm combination calling method based on the open source Hongmeng atomic service;
[0022] Figure 2 A flowchart of a multi-algorithm combination calling method based on open source Hongmeng atomic service. DETAILED DESCRIPTION
[0023] In order to more clearly demonstrate the objectives, technical solutions and advantages of the present invention, the present invention will be further described in detail and completely in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments described herein are only a part of the multiple embodiments of the present invention, not all embodiments, and the specific embodiments described are only used to explain the present invention and do not have a limiting effect on the present invention.
[0024] like Figure 1As shown in the figure, it is a schematic diagram of a multi-algorithm combination calling method based on the open source Hongmeng atomic service. First, each algorithm is encapsulated into different atomic services and integrated into the algorithm library to facilitate the subsequent calling of different algorithms according to the configuration file. Secondly, the characteristics of the atomic service are used to define the dynamic combination, standardized interface and extensible capabilities of each algorithm model in the algorithm library, which facilitates the autonomous calling and switching of each algorithm model. Then, the business logic is defined in the configuration file, and it can be ensured that the business logic can be switched at any time during the operation of the Openharmony operating system. Finally, the algorithm scheduling module is used to perform different tasks, and the algorithm scheduling module includes: model management, model scheduling, operation monitoring, log management, inspection testing and algorithm switching management. In short, according to the changes in business logic requirements, relevant algorithms are pulled from the algorithm library, the capabilities of the atomic service are used, and according to the settings of the configuration file, the multi-algorithm combination and calling under the Openharmony operating system are flexibly implemented.
[0025] Figure 2 The flowchart is a multi-algorithm combination calling method based on the open source Hongmeng atomic service, and its steps are as follows:
[0026] The first step is to encapsulate different algorithm models into independent atomic service processes. Each atomic service provides a standardized interface, including input parameters, return values, etc. Then, these atomic services are integrated into an algorithm library to form a reusable algorithm capability pool. Taking advantage of the lightweight and easy-to-flow capabilities of atomic services, the startup and operation overhead of each algorithm model is small, which facilitates efficient calling and circulation. Communication through standardized interfaces can facilitate dynamic binding and switching. Dynamically pull the required atomic services from the algorithm library, and after completing the business, release them back to the algorithm library for use by other businesses. When the business logic changes, flexibly switch to other appropriate algorithm models in the algorithm library to better adapt to changes in business needs.
[0027] The second step is to use the characteristics of atomic services to define the dynamic combination of algorithm models, standardized interfaces, and scalability.
[0028] First, regarding the dynamic composition feature, the Openharmony operating system can realize flexible and efficient application construction. Autonomously call and combine algorithm models, various algorithm models are encapsulated as independent atomic services, and applications can autonomously call and combine these services to dynamically build functions that meet requirements.
[0029] Secondly, for standardized interfaces, a set of unified interface specifications are defined, including interface names, parameter lists, and return value types, so that different algorithm models can be designed and implemented according to these specifications, thereby achieving seamless collaboration and making the integration between different services simpler and more reliable. The application system only needs to focus on how to combine and call each algorithm model, without worrying about the specific implementation details of the underlying services. This greatly reduces the complexity of the heterogeneous algorithm integration process, and at the same time, the business logic can achieve rapid switching between different algorithm models to achieve better performance, effects, or adaptability.
[0030] Finally, for high scalability, in the Openharmony operating system, each algorithm model is loosely coupled and independently encapsulated as an atomic service process. At the same time, the algorithm services have little dependency and can be expanded and replaced independently of each other. This greatly improves the interoperability between the algorithm models and realizes cross-model functional integration. In addition, when it is necessary to integrate a new algorithm model or replace an existing model, it is only necessary to replace the logic of the front-end application layer, which greatly reduces the complexity of expansion and maintenance. In short, the application can be adjusted and optimized at any time according to changes in business logic, and services can be dynamically added, deleted or replaced to meet changing needs.
[0031] The third step is to clearly define the business logic of various algorithm models in the configuration file, covering the processes of data input, processing, output, and the calling relationship with other business logic, so as to realize the configurability of business logic. In the process of running the Openharmony operating system, the replacement of business logic will trigger the replacement of the corresponding algorithm model. This method makes it easier to modify and maintain business logic. Two states need to be defined for the configuration file: background running state group and foreground running state group. Among them, the background running state group contains some algorithms running in the background, which can be quickly converted to the foreground running state; the foreground running state group contains the set of algorithms currently running. In the initial state, the configuration file defines the set of algorithms running and puts them in the foreground running state; and these foreground running algorithms put all possible algorithms in the background running state according to the algorithm calling relationship; at the same time, according to the results of the foreground running algorithm and the calling relationship defined in the configuration file, the algorithm in the background running state of the corresponding algorithm is converted to the foreground running state, and the algorithms running in the background of other judgment branches of the algorithm are closed.
[0032] The fourth step is to select the corresponding algorithm model in the algorithm library according to the defined configuration file, and call the algorithm scheduling module to complete the corresponding task. The functions of model management, model scheduling, operation monitoring, log management, inspection and testing, and algorithm switching management in the algorithm scheduling module are as follows:
[0033] 1) Calling the model management function aims to provide the system with a controllable multi-model management mechanism that can effectively manage the life cycle of various algorithm models. This function has flexible capabilities and can realize operations such as starting, stopping and running different models to meet the needs of different business scenarios. During the operation of the Openharmony operating system, the model management function can start different models, establish connections with the external environment, and initialize the required resources. When a model completes its task or needs to stop running, the model management function is also responsible for performing appropriate shutdown and resource release operations to ensure efficient use of system resources.
[0034] 2) Call the model scheduling function, and under the guidance of the operation plan, formulate the optimal scheduling plan according to the characteristics, resource requirements, and priority of different models. This includes decisions on factors such as the model's start time, running time period, and parallelism. By reasonably allocating resources and avoiding resource contention and conflict, the orderly execution of multiple models can be achieved to achieve efficient allocation of system resources and collaborative operation of tasks. In addition, the model scheduling function and the model management function work closely together. The model scheduling function uses the model management function to implement specific operations such as starting, stopping, and running models. This collaborative execution ensures that the model is scheduled according to the predetermined plan, thereby achieving the best performance under the constraints of system resources and time.
[0035] 3) Calling the operation monitoring function allows users to monitor the execution process of tasks at any time, timely capture abnormal situations in task execution, and quickly intervene and handle them. Through this timely feedback mechanism, users can effectively monitor the overall operation status of tasks, thereby ensuring the stability and efficiency of the system. In practical applications, the operation monitoring function usually integrates multiple alarm mechanisms to meet different types of abnormal situations. First, when an error occurs in task execution or an abnormal state is encountered, an alarm for task execution error will be triggered, and relevant information will be sent to the system administrator or relevant personnel for rapid problem troubleshooting and processing. Secondly, if the execution delay of a task exceeds the predetermined time threshold, an alarm for task execution delay will also be triggered to ensure that the task is completed on time and avoid potential impacts.
[0036] 4) Calling the log management function can realize the real-time collection, storage and subsequent retrieval of log information generated during task execution. This function allows users to easily browse and search detailed records of task execution by viewing the log function, providing a powerful tool for troubleshooting and problem location. In addition, this function supports different log levels (such as debug, warning, error, etc.), and users can choose the level of detail of the record according to their needs, which helps to balance storage costs and information value.
[0037] 5) Call the check test function to check whether the result data is correct after the task is completed. When the data is incorrect, after analysis by this function, if it is determined that the data comes from a single task, you only need to rerun the task; if the result data comes from multiple tasks, you need to continue to determine whether the tasks are executed in parallel or serially. For parallel execution, you only need to rerun the task in question; for serial execution, you need to rerun the task in question and its subsequent tasks to ensure that the affected tasks obtain accurate results.
[0038] 6) Calling the algorithm switching management function is committed to realizing highly sophisticated seamless switching of different algorithms according to the changes in real-time business logic, without interrupting the operation of the Openharmony operating system, by simply modifying the algorithm calling relationship in the configuration file, so as to meet dynamically changing business needs. During the switching process, factors such as the characteristics of the algorithm, resource requirements, and performance indicators are taken into consideration to ensure smooth and trouble-free switching. In addition, in order to achieve microsecond-level switching, the algorithm switching management function has a high degree of real-time and responsiveness. It can monitor real-time business conditions, capture changes in business logic, and trigger algorithm switching at the right time through an intelligent scheduling mechanism. At the same time, the design of this function also takes into account the stability and reliability of the system to ensure that the impact of the switching process on users and the system is minimized.
[0039] The above is the execution process of the complete algorithm scheduling module, which can well complete the multi-algorithm combination calling task and call the corresponding atomic service.
[0040] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A multi-algorithm combination calling method based on open source Hongmeng atomic service, characterized in that: The method comprises: Step 1: Encapsulate each algorithm model into an independent atomic service process and integrate it into the open source Hongmeng algorithm library. Use the atomic capability to pull algorithms with relevant capabilities from the algorithm library according to business needs, and release them back to the algorithm library after completing the business. Step 2: Based on the characteristics of atomic services, define the dynamic combination capability, standardized interface, and scalability of each algorithm model in the algorithm library; the definition of the dynamic combination capability of each algorithm model in the algorithm library includes: selecting and combining different algorithm models according to the needs of business logic; the definition of the standardized interface of each algorithm model includes: defining a unified interface specification for each algorithm model, including interface name, parameter list, and return value type information, so that different services corresponding to heterogeneous algorithm models can work together seamlessly; the definition of the scalability of each algorithm model includes: designing heterogeneous algorithm models to be loosely coupled, and supporting the addition of new algorithm models or the replacement of existing services; Step 3: Set up a configuration file to record the business logic of each algorithm model, including data input, processing, output, and the calling relationship with other business logics; Step 4. According to the set configuration file, use the algorithm scheduling module to complete the corresponding calling task. The algorithm scheduling module includes model management function, model scheduling function, operation monitoring function, log management function, inspection and testing function, and algorithm switching management function. The algorithm switching management function is used to change the calling relationship of the algorithm model in the configuration file when the business logic related to the algorithm model changes during the operation of the open source Hongmeng operating system, and replace the corresponding atomic service without interrupting the operation of the open source Hongmeng operating system.
2. According to claim 1, a multi-algorithm combination calling method based on open source Hongmeng atomic service is characterized in that: The model management function is used to realize the start, stop and run operations of different algorithm models; The model scheduling function is used to customize the model scheduling strategy according to the designed operation plan, and complete the operation of various algorithm models through the model management function; The operation monitoring function is used to monitor the execution of tasks; The log management function is used to collect and store log information generated during task execution to provide users with retrieval and browsing services; The inspection test function is used to detect whether the result data after the task is executed is correct.
Citation Information
Patent Citations
Novel customizable big data platform architecture method
CN106874016A
Integration method and device of dynamic combined service and storage medium
CN115857879A