Service configuration method and device, electronic equipment and storage medium
By generating directed acyclic graphs and configuring modules, the problem of low development efficiency caused by complex business and limited resources in software project development is solved, and the development efficiency and simplification of architecture design are improved.
Patent Information
- Application Number
- CN202410762092.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-03
AI Technical Summary
There are problems in the development of existing software projects due to complex business and limited resources, resulting in low development efficiency.
By obtaining the description file of the business to be configured, a directed acyclic graph is generated, and based on the graph, the module is configured, the function configuration is completed, and the target business is obtained.
It improves development efficiency, simplifies the architecture design and maintenance of software projects, supports dynamic reloading and on-demand ordered reloading, and maximizes reuse and minimizes dependencies.
Smart Images

Figure CN118585237A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software technology, and in particular to a service configuration method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of the Internet, software development companies pay more attention to their own development efficiency when developing software products. For general enterprises, the increase in internal projects and the increase in the scale of software development have made it urgent for enterprises to have a modern software project management tool. Through the architecture designed for software project development, corresponding guidance can be provided for all aspects of software system design. Figure 1 As shown, Figure 1 This is a traditional program structure diagram. Specifically, existing traditional programs have embedded hardware platforms, small running memory, slow CPU speed, and require high-efficiency programs; AI cameras have complex functions, diverse business codes, many cross-references between functions, complex logic, and difficult later maintenance; hardware devices are diverse and need to be cross-platform; software requirements are diverse, and firmware needs to be customized for different requirements. Therefore, there is an urgent need for a business configuration method to solve the problem of complex business and limited resources in existing methods, resulting in low development efficiency. Summary of the invention
[0003] The embodiment of the present invention provides a service configuration method, which aims to solve the problem of low development efficiency caused by complex services and limited resources in the existing methods. By obtaining a description file of the service to be configured, generating a directed acyclic graph of the service to be configured from the description file of the service to be configured, and using the directed acyclic graph to perform module configuration, the function configuration of the service to be configured is completed, and the target service is obtained, which can solve the problem of low development efficiency caused by complex services and limited resources in the existing methods.
[0004] In a first aspect, an embodiment of the present invention provides a service configuration method, the method comprising:
[0005] Obtain a description file of the service to be configured, wherein the description file includes reference relationships between modules to be configured, each service corresponds to one description file, and the module to be configured is a single functional module;
[0006] Generate a directed acyclic graph of the service to be configured according to the description file, wherein the directed acyclic graph includes a reference module and a referenced module determined according to the reference relationship, and the directed acyclic graph does not include a loop;
[0007] Module configuration is performed based on the directed acyclic graph, functional configuration of the service to be configured is completed, and a target service is obtained.
[0008] Optionally, the step of obtaining a description file of the service to be configured includes:
[0009] Acquire configuration request information of the service to be configured, wherein the configuration request information includes identification information of the service to be configured;
[0010] According to the identification information of the service to be configured, a description file corresponding to the service to be configured is matched to obtain the description file of the service to be configured.
[0011] Optionally, before the step of obtaining a description text of the service to be configured, the method further includes:
[0012] Obtain a parameter list, wherein the parameter list includes structured description parameters of each module;
[0013] Based on the structured description parameters of each module to be configured in the parameter list, the parameters of the modules to be configured and the reference relationships between the modules to be configured are filled in the initial description file to configure a description file of the service.
[0014] Optionally, the step of filling in the parameters of the modules to be configured and the reference relationships between the modules to be configured in the initial description file based on the structured description parameters of the modules to be configured in the parameter list to obtain the description files of the services includes:
[0015] Determine the functional dependencies of each business;
[0016] For each of the services, based on the functional dependency of the services and the parameter list, obtaining a structured description of the module to be configured in the current step and a module identifier of the module to be configured in the next step;
[0017] In the initial description file, the structured description of the module to be configured in the current step is filled into the reference module parameter field, and the module representation of the module to be configured in the next step is filled into the representation field of the referenced module;
[0018] Complete the parameter configuration of the module to be configured and obtain the description file of the service.
[0019] Optionally, the step of generating a directed acyclic graph of the service to be configured according to the description file includes:
[0020] According to the reference relationship between the modules to be configured in the description file, determining a reference module and a referenced module in the modules to be configured;
[0021] A directed acyclic graph of the service to be configured is generated according to the reference relationship between the referenced module and the referenced module.
[0022] Optionally, the step of performing module configuration based on the directed acyclic graph to complete function configuration of the service to be configured and obtain the target service includes:
[0023] Determining a module running direction of the directed acyclic graph according to a reference relationship between the referenced module and the referenced module in the directed acyclic graph;
[0024] Determining the startup sequence of the reference module and the referenced module based on the reverse direction of the module running direction;
[0025] Starting the reference module and the referenced module according to the startup sequence;
[0026] When all modules in the directed acyclic graph are started, the function configuration of the service to be configured is completed, and the target service is obtained.
[0027] Optionally, after the step of performing module configuration based on the directed acyclic graph, completing function configuration of the service to be configured, and obtaining the target service, the method further includes:
[0028] When exiting the target service, the exit order of the reference module and the referenced module is determined according to the positive direction of the module running direction;
[0029] According to the exit order, exit the referencing module and the referenced module;
[0030] When all modules in the directed acyclic graph have completed exiting, the target service exit is completed.
[0031] In a second aspect, an embodiment of the present invention further provides a service configuration device, the service configuration device comprising:
[0032] A first acquisition module is used to acquire a description file of a service to be configured, wherein the description file includes a reference relationship between modules to be configured, each service corresponds to one description file, and the module to be configured is a single functional module;
[0033] A generating module, configured to generate a directed acyclic graph of the service to be configured according to the description file, wherein the directed acyclic graph includes a reference module and a referenced module determined according to the reference relationship, and the directed acyclic graph does not include a loop;
[0034] The first configuration module is used to perform module configuration based on the directed acyclic graph, complete the function configuration of the service to be configured, and obtain the target service.
[0035] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the service configuration method provided in the embodiment of the present invention when executing the computer program.
[0036] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the service configuration method provided in the embodiment of the invention are implemented.
[0037] In an embodiment of the present invention, a description file of a service to be configured is obtained, the description file includes a reference relationship between modules to be configured, each service corresponds to a description file, and the module to be configured is a single functional module; according to the description file, a directed acyclic graph of the service to be configured is generated, the directed acyclic graph includes a reference module and a referenced module determined according to the reference relationship, and the directed acyclic graph does not include a loop; module configuration is performed based on the directed acyclic graph, and the functional configuration of the service to be configured is completed to obtain the target service. The present invention can solve the problem of low development efficiency caused by complex services and limited resources in the existing methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 It is a traditional program structure diagram;
[0040] Figure 2 is a flow chart of a service configuration method provided by an embodiment of the present invention;
[0041] Figure 3 It is a module diagram of a service configuration method provided by an embodiment of the present invention;
[0042] Figure 4 is a parameter list diagram provided by an embodiment of the present invention;
[0043] Figure 5 is an example diagram of a description file provided by an embodiment of the present invention;
[0044] Figure 6 It is an example diagram of reference relationships between multiple modules in a directed acyclic graph provided by an embodiment of the present invention;
[0045] Figure 7 It is an operation logic diagram of the service configuration method provided by an embodiment of the present invention;
[0046] Figure 8 It is a structural diagram of a service configuration device provided by an embodiment of the present invention;
[0047] Fig. 9 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] like Figure 2 As shown, Figure 2 1 is a flow chart of a service configuration method provided by an embodiment of the present invention. The service configuration method comprises the following steps:
[0050] 201. Obtain a description file of the service to be configured.
[0051] In an embodiment of the present invention, the above-mentioned service configuration method can be applied to a personal terminal, and the above-mentioned personal terminal can be an electronic device that can run the configuration service, such as a smart phone, a tablet, a computer or a smart wearable device.
[0052] The above description file can be understood as a file containing configuration information, which is used to describe the parameter values of each module of a program, component or system. The above description file uses C language, and the format of the description file can be JSON format or other similar formats. The above C language is a widely used computer programming language. C language takes up less resources and has less library dependence, so it is easy to port to various platforms.
[0053] The above description file includes reference relationships between modules to be configured, each service corresponds to a description file, and the above modules to be configured are single function modules.
[0054] The above-mentioned reference relationship is a relationship used to identify the association between two entities. The above-mentioned single function module can be understood as a module that only implements one function and does not include other functions. The above-mentioned module to be configured can be configured and customized according to requirements.
[0055] The above-mentioned services to be configured may also be referred to as software to be configured. The above-mentioned services to be configured may be understood as service functions or software functions that need to be configured and set for a system, application or service.
[0056] It should be noted that when the business is not running, in the static code state, the modules have no dependencies on each other.
[0057] 202. Generate a directed acyclic graph of the service to be configured according to the description file.
[0058] In the embodiment of the present invention, the directed acyclic graph includes a reference module and a referenced module determined according to a reference relationship, and the directed acyclic graph does not include a loop.
[0059] The above-mentioned referenced module can be understood as a module that calls other modules, and the above-mentioned referenced module can be understood as a module that is called by other modules.
[0060] The above-mentioned directed acyclic graph is a directed graph without loops. A directed acyclic graph is a data structure in graph theory, consisting of vertices and edges, and each edge has a clear direction. In a directed acyclic graph, each vertex represents a module, and each edge represents a reference relationship. According to the reference relationship, the referencing module and the referenced module can be determined. A directed acyclic graph has directionality, acyclicity, and topological order. The above-mentioned directionality means that the edges in the graph have directions, indicating the dependency or unidirectional relationship between tasks; the above-mentioned acyclicity means that there are no loops in the graph, that is, starting from a vertex, after passing through a series of edges, you cannot return to the starting point; topological order means that in a directed acyclic graph, the execution order of tasks can be determined by algorithms such as topological sorting to satisfy all dependencies and minimize execution time.
[0061] The fact that the directed acyclic graph does not include a loop can be understood as a module not referencing and being referenced at the same time.
[0062] 203. Perform module configuration based on the directed acyclic graph, complete function configuration of the service to be configured, and obtain the target service.
[0063] In an embodiment of the present invention, appropriate modules can be selected in a directed acyclic graph for configuration to meet the needs of the business to be configured. These modules can be functional modules, data modules, control modules, etc., which are connected in a certain order and dependency relationship to form a complete business process.
[0064] It should be noted that when configuring modules, it is necessary to analyze and understand the requirements of the business to be configured, clarify the functional requirements, data requirements, control requirements, etc. of the business, and then select the appropriate modules in the directed acyclic graph and connect them in the correct order and dependencies to obtain the target business.
[0065] In the embodiment of the present invention, the function of each module of the present invention is single, which is conducive to the development of new business functions; when a problem occurs in the business, the present invention can find the related party of the problem according to the directed acyclic graph. Dynamic reloading is supported. When a function change requires reloading, the business can automatically deduce the scope and order of reloading, and realize orderly reloading on demand.
[0066] In the embodiment of the present invention, a description file of a service to be configured is obtained, the description file includes a reference relationship between modules to be configured, and the module to be configured is a single functional module; a directed acyclic graph of the service to be configured is generated according to the description file, the directed acyclic graph includes a reference module and a referenced module determined according to the reference relationship, and the directed acyclic graph does not include a loop; the module configuration is performed based on the directed acyclic graph, the functional configuration of the service to be configured is completed, and the target service is obtained. The problem of low development efficiency caused by complex services and limited resources in the architecture design method of existing software project development can be solved.
[0067] It should be noted that the service configuration method provided in the embodiment of the present invention can be applied to devices such as computers and servers that can perform the service configuration method.
[0068] like Figure 3 As shown, Figure 3 It is a module diagram of a service configuration method provided by an embodiment of the present invention, and specifically includes: module 1, module 2, module 3, module 4, ..., module N, configuration manager, module manager, system call, and tool set.
[0069] In the embodiment of the present invention, the configuration manager is used to parse the description file, dynamically access parameters, and provide a remote management interface (provided to the Web or APP for use). The configuration manager is used to read and write parameters, and each module does not need to write code.
[0070] The module manager is used to generate a directed acyclic graph according to the result of the configuration manager, and manage the startup, uninstallation, dynamic reloading, callback functions and other functions of all modules, that is, to manage the entire life cycle of all modules.
[0071] The above system calls are used to isolate the differences in operating systems and encapsulate operating system-related calls into an internal unified form to facilitate cross-platform porting.
[0072] The above tool sets are used to help developers perform development and maintenance work more efficiently.
[0073] The functions of the above modules are single. A single function module can be understood as a module that implements only one function and does not contain other functions. The above modules can be configured and customized according to requirements. The above modules are object-oriented, and one module can run as multiple different instances. Object-oriented design mainly makes each function an independent unit, and the unit is as small as possible, and only performs independent functions. The object has internal data areas, external interfaces, internal threads, etc., and is not directly connected to other modules, but is referenced through description files.
[0074] The above module code uses C language, and the description file format can be JSON format or other similar formats. The description text can realize that one piece of software can be used for multiple products. Compared with traditional parameter configuration files, the description file is at a higher level, describing the runtime structure of the business, and can be more flexible to combine different functional forms.
[0075] In the embodiment of the present invention, the present invention supports dynamic reloading. When a function change requires reloading, the business can automatically deduce the scope and order of reloading, and realize orderly reloading on demand. The present invention can automatically divide functional modules according to business needs to maximize reuse and minimize dependencies.
[0076] Optionally, in the step of obtaining the description file of the service to be configured, configuration request information of the service to be configured may be obtained, the configuration request information including identification information of the service to be configured; according to the identification information of the service to be configured, the description file corresponding to the service to be configured is matched to obtain the description file of the service to be configured.
[0077] In the embodiment of the present invention, the configuration request information may be information required for configuring the service to be configured.
[0078] The above identification information is used to uniquely identify a service to be configured, and may be the name, number, etc. of the service.
[0079] The above description file includes reference relationships between modules to be configured, each service corresponds to a description file, and the above modules to be configured are single function modules.
[0080] Optionally, before the step of obtaining the description file of the service to be configured, a parameter list may also be obtained, the parameter list including structured description parameters of each module; based on the structured description parameters of each module to be configured in the parameter list, the parameters of the modules to be configured and the reference relationship between the modules to be configured are filled in the initial description file to configure the description file of the service.
[0081] In the embodiment of the present invention, the above parameter list is a structured description parameter list.
[0082] The above structured description parameters can be understood as parameters used to describe the function, behavior and state of each module. These parameters include input, output, internal state, etc., which can be used to describe how the module generates output signals based on input signals and how to update its internal state.
[0083] The above initial description file is used to describe the initial status and settings of the service.
[0084] The description file of the above services contains detailed information of each module, as well as reference relationships between modules, etc.
[0085] It should be noted that the parameter list of structured description is the key structure for realizing automatic derivation and dynamic configuration. It can not only save various parameters of the module to be configured, but also define the operation logic of the entire business.
[0086] like Figure 4 As shown, Figure 4 is a parameter list diagram provided by an embodiment of the present invention. Specifically, the parameters that the module needs to use and are exposed to the outside are all in Figure 4 The main items are: parameter name, parameter type, parameter default value, parameter attribute, parameter action, read and write callback, and dynamic overload callback.
[0087] Optionally, in the step of obtaining the description file of each service by filling in the parameters of the modules to be configured and the reference relationship between the modules to be configured in the initial description file based on the structured description parameters of each module to be configured in the parameter list, the functional dependency of each service can be determined; for each service, based on the functional dependency of the service and the parameter list, the structured description of the current configuration module and the module identifier of the next module to be configured are obtained; in the initial description file, the structured description of the current module to be configured is filled in the reference module parameter field, and the module identifier of the next module to be configured is filled in the identifier field of the referenced module; the parameter configuration of all modules to be configured is completed to obtain the description file of the service.
[0088] In the embodiment of the present invention, the functional dependency of each business mentioned above can be understood as the support and collaboration of other businesses required by one business. The dependency relationship can help users understand how to organize and build a software system and how to ensure the collaborative work between various parts.
[0089] The module identifier is used to uniquely identify the name or identifier of the module to be configured. Each module usually has a unique identifier to reference and identify the module in the business. This identifier can be a number, a combination of letters, or other symbols, and is usually defined and managed by the developer or team.
[0090] The description file of the above services contains detailed information of each module, as well as reference relationships between modules, etc.
[0091] In an embodiment of the present invention, by determining the functional dependencies of each service, and according to the functional dependencies and parameter lists of the services, a structured description of the module to be configured in the current step and a module identifier of the module to be configured in the next step are obtained; in the initial description file, the structured description of the module to be configured in the current step is added to the reference module parameter field so that the module can be referenced in the subsequent configuration process; at the same time, the module identifier of the module to be configured in the next step is added to the identifier field of the referenced module so that the module can be correctly referenced after the current configuration module is completed; the parameter configuration of all modules to be configured is completed, thereby obtaining a description file of the service.
[0092] Figure 5 1 is an example diagram of a description file provided by an embodiment of the present invention. Specifically, the diagram shows a service consisting of two modules, where module 1 is named "model 1" and of type "type 1", and module 1 references module 2 "model 2" through parameter "refrence 1".
[0093] Optionally, in the step of generating a directed acyclic graph of the business to be configured according to the description file, a reference module and a referenced module can be determined in the modules to be configured according to the reference relationship between the modules to be configured in the description file; and a directed acyclic graph of the business to be configured is generated according to the reference relationship between the referenced modules and the referenced modules.
[0094] In the embodiment of the present invention, the module to be configured is a single functional module, and the reference relationship is a relationship used to identify the association between two entities.
[0095] The above-mentioned referenced module can be understood as a module that calls other modules, and the above-mentioned referenced module can be understood as a module that is called by other modules.
[0096] The directed acyclic graph includes a referencing module and a referenced module determined according to a reference relationship, and the directed acyclic graph does not include a loop.
[0097] The above-mentioned directed acyclic graph is a directed graph without loops. The directed acyclic graph is a data structure in graph theory, which consists of vertices and edges, and each edge has a clear direction. In the directed acyclic graph, each vertex represents a module, and each edge represents a reference relationship. According to the reference relationship, the reference module and the referenced module can be determined. The directed acyclic graph has directionality, acyclicity, and topological order. The above-mentioned directionality means that the edges in the graph have directions, indicating the dependency or unidirectional relationship between tasks; the above-mentioned acyclicity means that there is no loop in the graph, that is, starting from a vertex, after a series of edges, it is impossible to return to the starting point; topological order means that in the directed acyclic graph, the execution order of tasks can be determined by algorithms such as topological sorting to meet all dependencies and minimize the execution time. The fact that the above-mentioned directed acyclic graph does not include loops can be understood as a situation where a module does not have a reference and is referenced at the same time on a link.
[0098] like Figure 6 As shown, Figure 6 This is an example diagram of the reference relationship between multiple modules in a directed acyclic graph provided by an embodiment of the present invention. Specifically, a directed graph is used to reference modules in a directed acyclic graph, and one-to-many and many-to-one references are supported. Circular references are prohibited, and loops cannot appear in directed graphs. The business automatically checks when running, reports the error location and exits the operation.
[0099] Optionally, in the step of performing module configuration based on a directed acyclic graph, completing the functional configuration of the service to be configured, and obtaining the target service, the module running direction of the directed acyclic graph can be determined according to the reference relationship between the referencing module and the referenced module in the directed acyclic graph; the startup order of the referencing module and the referenced module can be determined based on the reverse direction of the module running direction; the referencing module and the referenced module can be started according to the startup order; when all modules in the directed acyclic graph are started, the functional configuration of the service to be configured is completed, and the target service is obtained.
[0100] In an embodiment of the present invention, in a directed acyclic graph, the running direction of a module can be understood as the direction of data flow or control flow. For example, in a business, if module 1 depends on module 1, then the direction from 1 to 2 is the direction of data flow or control flow. In a directed acyclic graph, this dependency relationship can be represented by an arrow. Since there is no circular dependency in a directed acyclic graph, the running order of the modules can be determined based on the direction of the arrow. For example, if module 1 depends on module 2, then module 1 should run before module 2.
[0101] Specifically, after determining the startup order of the modules, start the modules in the direction of the arrows. That is, if module 1 depends on module 2, then when starting, module 2 should be started first, and then module 1. This is because only when the dependent module is started, the module that depends on it can run normally.
[0102] like Figure 7 As shown, Figure 7 It is the operation logic diagram of the service configuration method provided by the embodiment of the present invention. Specifically, fill in the reference module and the referenced module in the module parameters of the description file, and do not need to fill in all the modules. The reference module and the referenced module are analyzed according to the reference relationship between the modules in the description text, and a directed acyclic graph data structure is generated. When the service is started, all the referenced modules will be started first, and then the reference module will be started, and at the same time, the instance object of the referenced module will be passed to the reference module. Figure 7 The reference relationship shown in the figure shows that the startup order of the modules is the reverse execution of the directed acyclic graph, and all referenced modules need to be started before starting the referenced module. The startup order is: 1. Module 4, Module 6; 2. Module 3; 3. Module 2, Module 5; 4. Module 1. The startup order process runs recursively, and the entire business can be automatically started according to the dependency relationship.
[0103] Optionally, after performing module configuration based on a directed acyclic graph and completing the functional configuration of the service to be configured and obtaining the target service, you can also exit the target service by determining the exit order of the referenced module and the referenced module according to the positive direction of the module's running direction; exit the referenced module and the referenced module according to the exit order; when all modules in the directed acyclic graph have completed their exit, the exit from the target service is completed.
[0104] In an embodiment of the present invention, the startup sequence of the modules is the opposite direction of the module running direction to determine the startup sequence of the referencing module and the referenced module, and all the referenced modules need to be started before the referencing module is started. The entire business can be automatically started according to the dependency relationship. When exiting, the process is opposite to the startup, first exiting the referencing module, then exiting the referenced module, and recursively executing until all are exited.
[0105] In an embodiment of the present invention, based on the startup order of the referenced module and the referenced module and the exit order of the referenced module and the referenced module, the entire business can be automatically started and exited according to the dependency relationship. The present invention can automatically deduce the startup and exit order based on the dependency relationship, effectively improving the work efficiency of the business.
[0106] like Figure 8 As shown, an embodiment of the present invention provides a service configuration device, the service configuration device comprising:
[0107] A first acquisition module 801 is used to acquire a description file of a service to be configured, wherein the description file includes a reference relationship between modules to be configured, each service corresponds to one description file, and the module to be configured is a single functional module;
[0108] A generating module 802, configured to generate a directed acyclic graph of the service to be configured according to the description file, wherein the directed acyclic graph includes a reference module and a referenced module determined according to the reference relationship, and the directed acyclic graph does not include a loop;
[0109] The first configuration module 803 is used to perform module configuration based on the directed acyclic graph, complete the function configuration of the service to be configured, and obtain the target service.
[0110] Optionally, the acquisition module 801 includes:
[0111] A first acquisition submodule, configured to acquire configuration request information of a service to be configured, wherein the configuration request information includes identification information of the service to be configured;
[0112] The matching submodule is used to match the description file corresponding to the service to be configured according to the identification information of the service to be configured, so as to obtain the description file of the service to be configured.
[0113] Optionally, the device further comprises:
[0114] A second acquisition module is used to acquire a parameter list, wherein the parameter list includes structured description parameters of each module;
[0115] The second configuration module is used to fill in the parameters of the modules to be configured and the reference relationship between the modules to be configured in the initial description file based on the structured description parameters of each module to be configured in the parameter list, so as to configure a description file of the service.
[0116] Optionally, the second configuration module includes:
[0117] The first determination submodule is used to determine the functional dependencies of each business;
[0118] A second acquisition submodule is used to acquire, for each of the services, a structured description of the module to be configured in the current step and a module identifier of the module to be configured in the next step based on the functional dependency of the service and the parameter list;
[0119] A filling submodule is used to fill in the structured description of the module to be configured in the current step into the reference module parameter field in the initial description file, and fill in the module representation of the module to be configured in the next step into the representation field of the referenced module;
[0120] The parameter configuration submodule is used to complete the parameter configuration of the module to be configured and obtain the description file of the service.
[0121] Optionally, the generating module 802 includes:
[0122] A second determining submodule, configured to determine a referencing module and a referenced module in the modules to be configured according to the reference relationship between the modules to be configured in the description file;
[0123] A generating submodule is used to generate a directed acyclic graph of the service to be configured according to the reference relationship between the referenced module and the referenced module.
[0124] Optionally, the first configuration module 803 includes:
[0125] A third determining submodule, configured to determine a module running direction of the directed acyclic graph according to a reference relationship between the referenced module and the referenced module in the directed acyclic graph;
[0126] A fourth determining submodule, configured to determine a startup sequence of the reference module and the referenced module based on a reverse direction of the module running direction;
[0127] A startup submodule, used to start the reference module and the referenced module according to the startup sequence;
[0128] The function configuration submodule is used to complete the function configuration of the service to be configured and obtain the target service after all modules in the directed acyclic graph are started.
[0129] Optionally, the device further comprises:
[0130] A fifth determining submodule, used for determining the exit order of the reference module and the referenced module according to the positive direction of the module running direction when exiting the target service;
[0131] A first processing submodule, configured to exit the referencing module and the referenced module according to the exit sequence;
[0132] The second processing submodule is used to complete the exit of the target business after all modules in the directed acyclic graph have completed exiting.
[0133] It should be noted that the service configuration device provided in the embodiment of the present invention can be applied to devices such as smart phones, computers, servers, etc. that can perform the service configuration method.
[0134] The service configuration device provided in the embodiment of the present invention can implement each process implemented by the service configuration method in the above method embodiment and can achieve the same beneficial effect. To avoid repetition, it will not be described here.
[0135] See also Fig. 9 , Fig. 9 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig. 9As shown, it includes: a memory 902, a processor 901, and a computer program of a service configuration method stored in the memory 902 and executable on the processor 901, wherein:
[0136] The processor 901 is used to call the computer program stored in the memory 902 and execute the following steps:
[0137] Obtain a description file of the service to be configured, wherein the description file includes reference relationships between modules to be configured, each service corresponds to one description file, and the module to be configured is a single functional module;
[0138] Generate a directed acyclic graph of the service to be configured according to the description file, wherein the directed acyclic graph includes a reference module and a referenced module determined according to the reference relationship, and the directed acyclic graph does not include a loop;
[0139] Module configuration is performed based on the directed acyclic graph, functional configuration of the service to be configured is completed, and a target service is obtained.
[0140] Optionally, the step of obtaining a description file of the service to be configured, performed by the processor 901, includes:
[0141] Acquire configuration request information of the service to be configured, wherein the configuration request information includes identification information of the service to be configured;
[0142] According to the identification information of the service to be configured, a description file corresponding to the service to be configured is matched to obtain the description file of the service to be configured.
[0143] Optionally, before the step of obtaining a description text of the service to be configured, the method executed by the processor 901 further includes:
[0144] Obtain a parameter list, wherein the parameter list includes structured description parameters of each module;
[0145] Based on the structured description parameters of each module to be configured in the parameter list, the parameters of the modules to be configured and the reference relationships between the modules to be configured are filled in the initial description file to configure a description file of the service.
[0146] Optionally, the step of filling in the parameters of the modules to be configured and the reference relationship between the modules to be configured in the initial description file based on the structured description parameters of each module to be configured in the parameter list, and obtaining the description file of each service performed by the processor 901 includes:
[0147] Determine the functional dependencies of each business;
[0148] For each of the services, based on the functional dependency of the services and the parameter list, obtaining a structured description of the module to be configured in the current step and a module identifier of the module to be configured in the next step;
[0149] In the initial description file, the structured description of the module to be configured in the current step is filled into the reference module parameter field, and the module representation of the module to be configured in the next step is filled into the representation field of the referenced module;
[0150] Complete the parameter configuration of the module to be configured and obtain the description file of the service.
[0151] Optionally, the step of generating the directed acyclic graph of the service to be configured according to the description file, performed by the processor 901, includes:
[0152] According to the reference relationship between the modules to be configured in the description file, determining a reference module and a referenced module in the modules to be configured;
[0153] A directed acyclic graph of the service to be configured is generated according to the reference relationship between the referenced module and the referenced module.
[0154] Optionally, the processor 901 performs the module configuration based on the directed acyclic graph to complete the function configuration of the service to be configured, and the step of obtaining the target service includes:
[0155] Determining a module running direction of the directed acyclic graph according to a reference relationship between the referenced module and the referenced module in the directed acyclic graph;
[0156] Determining the startup sequence of the reference module and the referenced module based on the reverse direction of the module running direction;
[0157] Starting the reference module and the referenced module according to the startup sequence;
[0158] When all modules in the directed acyclic graph are started, the function configuration of the service to be configured is completed, and the target service is obtained.
[0159] Optionally, after the step of performing module configuration based on the directed acyclic graph, completing function configuration of the service to be configured, and obtaining the target service, the method executed by the processor 901 further includes:
[0160] When exiting the target service, the exit order of the reference module and the referenced module is determined according to the positive direction of the module running direction;
[0161] According to the exit order, exit the referencing module and the referenced module;
[0162] When all modules in the directed acyclic graph have completed exiting, the target service exit is completed.
[0163] It should be noted that the electronic device provided in the embodiment of the present invention can be applied to devices such as smart phones, computers, servers, etc. that can perform the service configuration method.
[0164] The electronic device provided in the embodiment of the present invention can implement each process implemented by the service configuration method in the above method embodiment and can achieve the same beneficial effect. To avoid repetition, it will not be described here.
[0165] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the business configuration method provided by the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0166] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0167] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A service configuration method, characterized in that: The method comprises the following steps: Obtain a description file of the service to be configured, wherein the description file includes reference relationships between modules to be configured, each service corresponds to one description file, and the module to be configured is a single functional module; Generate a directed acyclic graph of the service to be configured according to the description file, wherein the directed acyclic graph includes a reference module and a referenced module determined according to the reference relationship, and the directed acyclic graph does not include a loop; Module configuration is performed based on the directed acyclic graph, functional configuration of the service to be configured is completed, and a target service is obtained.
2. The service configuration method according to claim 1, characterized in that: The step of obtaining a description file of the service to be configured includes: Acquire configuration request information of the service to be configured, wherein the configuration request information includes identification information of the service to be configured; According to the identification information of the service to be configured, a description file corresponding to the service to be configured is matched to obtain the description file of the service to be configured.
3. The service configuration method according to claim 1, characterized in that: Before the step of obtaining the description file of the service to be configured, the method further includes: Obtain a parameter list, wherein the parameter list includes structured description parameters of each module; Based on the structured description parameters of each module to be configured in the parameter list, the parameters of the modules to be configured and the reference relationships between the modules to be configured are filled in the initial description file to configure a description file of the service.
4. The service configuration method according to claim 3, characterized in that: The step of filling in the parameters of the modules to be configured and the reference relationship between the modules to be configured in the initial description file based on the structured description parameters of each module to be configured in the parameter list to obtain the description file of each service comprises: Determine the functional dependencies of each business; For each of the services, based on the functional dependency of the services and the parameter list, obtaining a structured description of the module to be configured in the current step and a module identifier of the module to be configured in the next step; In the initial description file, the structured description of the module to be configured in the current step is filled into the reference module parameter field, and the module identifier of the module to be configured in the next step is filled into the identifier field of the referenced module; Complete the parameter configuration of all modules to be configured and obtain the description file of the service.
5. The service configuration method according to claim 1, characterized in that: The step of generating the directed acyclic graph of the service to be configured according to the description file comprises: According to the reference relationship between the modules to be configured in the description file, determining a reference module and a referenced module in the modules to be configured; A directed acyclic graph of the service to be configured is generated according to the reference relationship between the referenced module and the referenced module.
6. The service configuration method according to claim 1, characterized in that: The step of performing module configuration based on the directed acyclic graph, completing function configuration of the service to be configured, and obtaining the target service comprises: Determining a module running direction of the directed acyclic graph according to a reference relationship between the referenced module and the referenced module in the directed acyclic graph; Determining the startup sequence of the reference module and the referenced module based on the reverse direction of the module running direction; Starting the reference module and the referenced module according to the startup sequence; When all modules in the directed acyclic graph are started, the function configuration of the service to be configured is completed, and the target service is obtained.
7. The service configuration method according to any one of claims 1 to 6, characterized in that: After the step of performing module configuration based on the directed acyclic graph, completing function configuration of the service to be configured, and obtaining the target service, the method further includes: When exiting the target service, the exit order of the reference module and the referenced module is determined according to the positive direction of the module running direction; According to the exit order, exit the referencing module and the referenced module; When all modules in the directed acyclic graph have completed exiting, the target service exit is completed.
8. A service configuration device, characterized in that: The service configuration device comprises: A first acquisition module is used to acquire a description file of a service to be configured, wherein the description file includes a reference relationship between modules to be configured, each service corresponds to one description file, and the module to be configured is a single functional module; A generating module, which generates a directed acyclic graph of the service to be configured according to the description file, wherein the directed acyclic graph includes a reference module and a referenced module determined according to the reference relationship, and the directed acyclic graph does not include a loop; The first configuration module is used to perform module configuration based on the directed acyclic graph, complete the function configuration of the service to be configured, and obtain the target service.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the service configuration method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the service configuration method according to any one of claims 1 to 7 are implemented.
