Multi-process component scheduling method, device, server and storage medium
By receiving the scheduling requests of the subprocess and dynamically controlling the operating status of the autonomous driving components, the problems of waste of resources and low communication efficiency in the autonomous driving system are solved, and more efficient resource utilization is achieved.
Patent Information
- Application Number
- CN202310179049.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2043-02-27
AI Technical Summary
The dynamic scheduling of autonomous driving components in different scenarios has problems such as wasting resources and low communication efficiency. Especially when switching between high-speed and parking scenarios, the existing scheduling methods cannot effectively manage the startup and shutdown of components, resulting in excessive load on hardware resources.
By receiving the scheduling request of the child process, obtaining the name information and type of the to-scheduling node, generating the communication address of the target scheduling execution server, dynamically controlling the operating status of the component, solving the problem of server and client channel establishment, and realizing dynamic startup and shutdown of the component.
Reduce the controller resource load, improve the overall resource utilization rate of the controller, and optimize the efficiency of component scheduling and resource management.
Smart Images

Figure CN116302410B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of multi-threaded deployment and dynamic scheduling of autonomous driving components, and in particular to a multi-process component scheduling method, device, server, and storage medium. Background Art
[0002] Autonomous driving software is a complex system composed of multiple components. Because autonomous driving must handle a variety of scenarios, including highways, urban areas, and parking, a problem arises: parking-related functional modules are not used in highway scenarios. If these functional modules are still running, hardware computing resources will be wasted. Similarly, if parking-related functional modes are disabled in highway scenarios, the system requires the parking-related functional modules to be activated when entering a parking scenario from a highway. This is the problem of dynamic scheduling of autonomous driving components.
[0003] There are usually three ways to deploy various components of autonomous driving. One is that all components run in one process, another is that all components run in their own different processes, and the third is a hybrid deployment method that combines the first two methods, in which some components share a process and some components exclusively use a process.
[0004] The first approach offers the advantage of sharing a common process, allowing for efficient communication between components by directly passing variable addresses. Component scheduling is relatively simple, controlled through a single global variable. However, a disadvantage is that if any component crashes, all components in the same process will crash as well, severely impacting the operational safety of the autonomous driving system.
[0005] The second approach has the advantage that all components run independently in their own processes, meaning a component crash won't affect other components. However, its disadvantage is that communication between components must occur via shared memory or sockets, which is inefficient. The biggest challenge in scheduling components across different processes is the inability to know which processes are running in advance, making accurate scheduling control impossible.
[0006] In the third approach, components that require high inter-module communication can be deployed in the same process, while components that require isolation and no mutual impact can be deployed in separate processes. However, this approach has low communication efficiency and cannot achieve accurate scheduling control. Summary of the Invention
[0007] The present application provides a multi-process component scheduling method, device, server and storage medium, which solves the problems of establishing channels between the server and the client and dynamically shutting down or starting any single or multiple components, reducing the controller resource load and improving the overall resource utilization of the controller.
[0008] The first aspect of the present application provides a multi-process component scheduling method, including the following steps: receiving a current scheduling request sent by any child process, and obtaining the name information and the type of the node to be scheduled based on the current scheduling request; judging whether the name information of the node to be scheduled exists in a preset first dictionary type variable; if the name information of the node to be scheduled exists in the preset first dictionary type variable, generating a communication address of a target scheduling execution server according to the process number of the name information of the node to be scheduled, and sending the current scheduling request to the target scheduling executor based on the communication address; receiving the scheduling result fed back by the target scheduling executor based on the current scheduling request, and sending the scheduling result to a scheduling client, so that the user can obtain the final scheduling result through the scheduling client.
[0009] Based on the above technical means, problems such as establishing server and client channels and dynamically shutting down or starting any single or multiple components are solved, reducing the controller resource load and improving the overall resource utilization of the controller.
[0010] Furthermore, after determining whether the name information of the node to be scheduled exists in the preset first dictionary type variable, it also includes: if the name information of the node to be scheduled does not exist in the preset first dictionary type variable, creating a first response structure corresponding to the name information of the node to be scheduled that does not exist, and setting the current scheduling result to a predefined error code; sending the first response structure and the predefined error code to the scheduling client, and ending the current scheduling.
[0011] According to the above technical means, if the name information of the node to be scheduled does not exist in the preset first dictionary type variable, then when the vehicle does not need some components to participate in the operation in certain scenarios of autonomous driving, the corresponding components will be shut down so that they do not participate in the task system scheduling and calculation, reducing the controller resource load and improving the overall resource utilization of the controller.
[0012] Furthermore, before receiving the scheduling result fed back by the target scheduling executor based on the current scheduling request, it also includes: obtaining the name information of the node to be scheduled and the type to be scheduled based on the current scheduling request through the target scheduling executor, and judging whether the name information of the node to be scheduled exists in the preset second dictionary type variable; if the name information of the node to be scheduled exists in the preset second dictionary type variable, obtaining the node to be scheduled according to the name information of the node to be scheduled, and controlling the node to be scheduled to be in a running state or a stopped state according to the type to be scheduled, so as to complete the scheduling execution operation of the node to be scheduled.
[0013] According to the above technical means, the node to be scheduled in the sub-process is controlled to run or stop according to the name information and the type of the node to be scheduled.
[0014] Furthermore, after determining whether the name information of the node to be scheduled exists in the preset second dictionary type variable, it also includes: if the name information of the node to be scheduled does not exist in the preset second dictionary type variable, creating a second response structure corresponding to the name information of the node to be scheduled that does not exist through the target scheduling executor, and setting the current scheduling result to the predefined error code; sending the second response structure and the predefined error code to the main scheduling server, so as to send the second response structure and the predefined error code to the scheduling client through the main scheduling server.
[0015] According to the above technical means, the node to be scheduled in the sub-process is controlled to run or stop according to the name information and the type of the node to be scheduled.
[0016] Furthermore, when controlling the node to be scheduled to be in the running state or the stopped state according to the type of scheduled node, it also includes: if the current running state of the node to be scheduled is consistent with the scheduled state, generating an error message or a scheduling success status message that the node to be scheduled is in the corresponding state through the target scheduling executor; and sending the error message or the scheduling success status message that the node to be scheduled is in the corresponding state to the main scheduling server.
[0017] According to the above technical means, in some scenarios, when some components have already participated in the operation, the scheduling success information is generated, and some components are started, which reduces the resource load of the controller and improves the overall resource utilization of the controller.
[0018] Furthermore, before receiving the current scheduling request sent by any of the sub-processes, it also includes: defining a preset scheduling request and a preset response structure; creating a master node manager in the main process, and creating at least one sub-process and a corresponding component instance for each sub-process in the main process according to actual deployment requirements, and starting the main scheduling service and the scheduling execution services of all sub-processes.
[0019] According to the above technical means, this application creates multiple sub-processes in the main process, so that the process number information of all components can be obtained in the main process, and the process number information is further used as the URL address information of the main process and sub-process scheduling execution service.
[0020] The second aspect of the present application provides a multi-process component scheduling device, including: a first acquisition module, used to receive a current scheduling request sent by any child process, and obtain the name information and the type of the node to be scheduled based on the current scheduling request; a judgment module, used to judge whether the name information of the node to be scheduled exists in a preset first dictionary type variable; a generation module, used to generate the communication address of the target scheduling execution server according to the process number of the name information of the node to be scheduled if the name information of the node to be scheduled exists in the preset first dictionary type variable, and send the current scheduling request to the target scheduling executor based on the communication address; a second acquisition module, used to receive the scheduling result fed back by the target scheduling executor based on the current scheduling request, and send the scheduling result to the scheduling client, so that the user can obtain the final scheduling result through the scheduling client.
[0021] Furthermore, after determining whether the name information of the node to be scheduled exists in the preset first dictionary type variable, the judgment module is also used to: if the name information of the node to be scheduled does not exist in the preset first dictionary type variable, create a first response structure corresponding to the name information of the node to be scheduled that does not exist, and set the current scheduling result to a predefined error code; send the first response structure and the predefined error code to the scheduling client, and end the current scheduling.
[0022] Furthermore, before receiving the scheduling result fed back by the target scheduling executor based on the current scheduling request, the second acquisition module is further configured to: obtain, through the target scheduling executor, the name information and the type of the node to be scheduled based on the current scheduling request, and determine whether the name information of the node to be scheduled exists in the preset second dictionary type variable;
[0023] If the name information of the node to be scheduled exists in the preset second dictionary type variable, the node to be scheduled is obtained according to the name information of the node to be scheduled, and the node to be scheduled is controlled to be in a running state or a stopped state according to the type of scheduling to complete the scheduling execution operation of the node to be scheduled.
[0024] Furthermore, after determining whether the name information of the node to be scheduled exists in the preset second dictionary type variable, the second acquisition module is also used to: if the name information of the node to be scheduled does not exist in the preset second dictionary type variable, create a second response structure corresponding to the name information of the node to be scheduled that does not exist through the target scheduling executor, and set the current scheduling result to the predefined error code; send the second response structure and the predefined error code to the main scheduling server, so as to send the second response structure and the predefined error code to the scheduling client through the main scheduling server.
[0025] Furthermore, when controlling the node to be scheduled to be in the running state or the stopped state according to the type of scheduled node, the second acquisition module is also used to: if the current running state of the node to be scheduled is consistent with the scheduled state, generate an error message or a scheduling success status message that the node to be scheduled is in the corresponding state through the target scheduling executor; and send the error message or the scheduling success status message that the node to be scheduled is in the corresponding state to the main scheduling server.
[0026] Furthermore, before receiving the current scheduling request sent by any of the sub-processes, the first acquisition module is also used to: define a preset scheduling request and a preset response structure; create a master node manager in the main process, and create at least one sub-process and a corresponding component instance for each sub-process in the main process according to actual deployment requirements, and start the main scheduling service and the scheduling execution service of all sub-processes.
[0027] The third aspect of the present application provides a server, which includes: one or more processors; a storage device, which stores one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the multi-process component scheduling method as described in the above embodiment.
[0028] The fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored. The program is executed by a processor to implement the multi-process component scheduling method as described in the above embodiment.
[0029] Therefore, the present application receives the current scheduling request sent by any child process and obtains the name information and the type of the node to be scheduled. When the name information of the node to be scheduled exists in the preset first dictionary type variable, the communication address of the target scheduling execution server is generated according to the process number of the name information of the node to be scheduled, and the current scheduling request is sent to the target scheduling executor. The scheduling result fed back by the target scheduling executor based on the current scheduling request is received, and the scheduling result is sent to the scheduling client. The user obtains the final scheduling result through the scheduling client. In this way, the problems of establishing channels between the server and the client and dynamically shutting down or starting any single or multiple components are solved, the resource load of the controller is reduced, and the overall resource utilization of the controller is improved.
[0030] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0032] Figure 1 A flowchart of a multi-process component scheduling method provided according to an embodiment of the present application;
[0033] Figure 2 This is a schematic diagram of overall scheduling according to one embodiment of the present application;
[0034] Figure 3 This is a flowchart of the initialization part according to one embodiment of the present application;
[0035] Figure 4 This is a flowchart of scheduling execution according to one embodiment of the present application;
[0036] Figure 5 A schematic diagram of the URL connection between the server and the client according to an embodiment of the present application;
[0037] Figure 6 Schematic diagram of a multi-process component scheduling device according to an embodiment of the present application;
[0038] Figure 7 Schematic diagram of the structure of a server according to an embodiment of the present application.
[0039] Explanation of the reference numerals: 10 - multi-process component scheduling device, 100 - first acquisition module, 200 - judgment module, 300 - generation module, 400 - second acquisition module, 70 - processor, 71 - storage device, 72 - communication device. DETAILED DESCRIPTION
[0040] The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0041] The following describes the multi-process component scheduling method, device, server and storage medium of the embodiment of the present application with reference to the accompanying drawings. In response to the problems of establishing channels between the server and the client and dynamically shutting down or starting any single or multiple components mentioned in the above background technology, the present application provides a multi-process component scheduling method, in which the current scheduling request sent by any child process is received, and the name information and the type of the node to be scheduled are obtained. When the name information of the node to be scheduled exists in the preset first dictionary type variable, the communication address of the target scheduling execution server is generated according to the process number of the name information of the node to be scheduled, and the current scheduling request is sent to the target scheduling executor, the scheduling result fed back by the target scheduling executor based on the current scheduling request is received, and the scheduling result is sent to the scheduling client, and the user obtains the final scheduling result through the scheduling client. In this way, the problems of establishing channels between the server and the client and dynamically shutting down or starting any single or multiple components are solved, the resource load of the controller is reduced, and the overall resource utilization of the controller is improved.
[0042] Specifically, Figure 1 A flowchart of a multi-process component scheduling method provided in an embodiment of the present application.
[0043] like Figure 1 As shown, the multi-process component scheduling method includes the following steps:
[0044] In step S101 , a current scheduling request sent by any child process is received, and the name information and the type of the node to be scheduled are obtained based on the current scheduling request.
[0045] Specifically, if Figure 2 As shown, the embodiment of the present application receives the current scheduling request sent by any sub-process, including sub-process 1, sub-process 2 to sub-process n.
[0046] Furthermore, in some embodiments, before receiving the current scheduling request sent by any child process, it also includes: defining a preset scheduling request and a preset response structure; creating a master node manager in the main process, and creating at least one child process and a corresponding component instance for each child process in the main process according to actual deployment requirements, and starting the main scheduling service and the scheduling execution services of all child processes.
[0047] Specifically, if Figure 3As shown, the preset scheduling request and preset response structures ScheduleRequest and ScheduleReply are defined. The ScheduleRequest structure contains at least the scheduling type type of the enumeration type and the name of the node to be scheduled node_name of the string type. The enumeration type representing the scheduling type contains at least the unknown default none, start start, and stop stop. The ScheduleReply structure contains at least the int type code res representing the scheduling result. The code can use specific numbers to represent different scheduling results or error codes. According to the error information corresponding to the predefined error code, the scheduling execution feedback can be accurately obtained.
[0048] Next, the main process is started, a main node manager NodeManager is created, and a dictionary-type node_pid_map_ variable is created in the NodeManager to store the correspondence between component names and their corresponding process IDs (PIDs). In the main process, child processes and corresponding component instances are created based on actual deployment requirements. The component names and their corresponding process IDs are stored in the variable node_pid_map_. A child node manager NodeManager is created in each child process, and the created component instance is added to the child node manager through the child node manager's AddNode method.
[0049] The main scheduling service is started in the master node manager using the StartScheduleService method. The main scheduling service's communication URL uses an inter-process communication method named with a fixed string, such as ipc: / / / tmp / main_schedule_service.ipc. Only when prior information about the main scheduling service using this naming convention exists can the node manager of a child process establish a connection with the main scheduling service. This main scheduling service persists throughout the program's lifecycle. If no scheduling requests are received, the main scheduling service remains dormant. If a scheduling request is received, the corresponding scheduling operation is executed and the scheduling result is returned.
[0050] Start a scheduling execution service in the child node managers of all child processes. Each scheduling execution service uses an inter-process communication URL named using the process ID combined with a fixed string, such as ipc: / / / tmp / execution_4918.ip, where 4918 is the process ID. This scheduling execution service persists throughout the program's lifecycle. If no scheduling execution request is received, the scheduling execution service remains dormant. If a scheduling execution request is received, the corresponding scheduling execution operation is executed and the scheduling execution result is returned.
[0051] In step S102, it is determined whether the name information of the node to be scheduled exists in the preset first dictionary type variable.
[0052] Furthermore, in some embodiments, after determining whether the name information of the node to be scheduled exists in the preset first dictionary type variable, it also includes: if the name information of the node to be scheduled does not exist in the preset first dictionary type variable, creating a first response structure corresponding to the name information of the node to be scheduled that does not exist, and setting the current scheduling result to a predefined error code; sending the first response structure and the predefined error code to the scheduling client, and ending the current scheduling.
[0053] Specifically, if Figure 4 As shown, a scheduling request is initiated using the ScheduleNode method. This method requires at least the name of the node to be scheduled (node_name) and the type of the schedule (schedule_type). This method transfers the incoming information into a ScheduleRequest structure, creates a scheduling request client, sends the structure variable to the main scheduling server, and waits for the server to return the scheduling result.
[0054] When the main scheduling server in the main process receives a scheduling request, it obtains the node name information node_name to be scheduled from the received ScheduleRequest structure. It attempts to check whether the node name information node_name to be scheduled exists in the first dictionary type variable preset in node_pid_map_. If the node name information node_name to be scheduled does not exist, it creates a ScheduleReply structure variable, sets res to a predefined error code, and then returns the ScheduleReply first response structure to the corresponding client.
[0055] In step S103, if the name information of the node to be scheduled exists in the preset first dictionary type variable, the communication address of the target scheduling execution server is generated according to the process number of the name information of the node to be scheduled, and the current scheduling request is sent to the target scheduling executor based on the communication address.
[0056] It is understood that if the name information of the node to be scheduled, node_name, is present, the communication address of the corresponding target scheduling execution server is generated using the corresponding process ID information in node_pid_map_. The corresponding scheduling execution server is connected through this address, the scheduling information ScheduleRequest is forwarded to the target scheduling execution server, and the target scheduling execution server is waited for to return the scheduling execution result.
[0057] Furthermore, in some embodiments, before receiving the scheduling result fed back by the target scheduling executor based on the current scheduling request, it also includes: obtaining the name information and the type of the node to be scheduled based on the current scheduling request through the target scheduling executor, and judging whether the name information of the node to be scheduled exists in the preset second dictionary type variable; if the name information of the node to be scheduled exists in the preset second dictionary type variable, obtaining the node to be scheduled according to the name information of the node to be scheduled, and controlling the node to be scheduled to be in a running state or a stopped state according to the type of scheduling, so as to complete the scheduling execution operation of the node to be scheduled.
[0058] It should be understood that before receiving the scheduling result fed back by the target scheduling executor based on the current scheduling request, the name information node_name and the type of the node to be scheduled are obtained, and the start or stop method of the node to be scheduled is executed according to the scheduling type to complete the scheduling execution operation of the node to be scheduled. After the scheduling is completed, a ScheduleReply structure variable is created, and res is set to normal, and then the ScheduleReply structure variable is returned to the main scheduling server. It should be noted that when executing the start or stop method of the node object, it is necessary to determine whether the current running state of the node to be scheduled is already in the running or stopped state.
[0059] Furthermore, in some embodiments, when controlling the node to be scheduled to be in a running state or a stopped state according to the type of the node to be scheduled, it also includes: if the current running state of the node to be scheduled is consistent with the state to be scheduled, then generating an error message or a scheduling success state message that the node to be scheduled is in a corresponding state through the target scheduling executor; and sending the error message or the scheduling success state message that the node to be scheduled is in a corresponding state to the main scheduling server.
[0060] It can be understood that if the current running state of the node to be scheduled is consistent with the state to be scheduled, there are two ways to handle it. One is to generate an error message that the node to be scheduled is already in the corresponding state through the target scheduling executor, and send the error message that the node to be scheduled is already in the corresponding state or the scheduling success status information to the main scheduling server; the other is to generate an error message that the node to be scheduled is already in the corresponding state through the target scheduling executor, and send the error message that the node to be scheduled is already in the corresponding state or the scheduling success status information to the main scheduling server, skipping the specific start or stop method.
[0061] Furthermore, in some embodiments, after determining whether the name information of the node to be scheduled exists in the preset second dictionary type variable, it also includes: if the name information of the node to be scheduled does not exist in the preset second dictionary type variable, creating a second response structure corresponding to the name information of the node to be scheduled that does not exist through the target scheduling executor, and setting the current scheduling result to a predefined error code; sending the second response structure and the predefined error code to the main scheduling server, so as to send the second response structure and the predefined error code to the scheduling client through the main scheduling server.
[0062] It is understood that when the schedule execution server in the corresponding child process receives a schedule execution request, it obtains the name of the node to be scheduled, node_name, from the received ScheduleRequest structure. It then searches for node_name in the current NodeManager. If the node name does not exist, it creates a ScheduleReply second response structure variable, sets res to a predefined error code, and then returns the ScheduleReply second response structure to the target master schedule server.
[0063] In step S104, the scheduling result fed back by the target scheduling executor based on the current scheduling request is received, and the scheduling result is sent to the scheduling client, so that the user can obtain the final scheduling result through the scheduling client.
[0064] like Figure 5 As shown, the target main scheduling execution server receives the scheduling result fed back by the scheduling execution server and forwards the scheduling result to the main scheduling client. The user learns the final scheduling result through the result returned by the scheduling client.
[0065] In summary, this application implements component scheduling through three main modules: the scheduling server, the scheduling request client, and the execution server. Each process creates a unique component manager when it is created. The component manager created in the main process is the main manager, and the component manager created in the child process is the sub-manager. There is only one main manager, but there can be multiple sub-managers.
[0066] The component manager provides the methods ScheduleNode, StartScheduleService, StartExecutionService, and AddNode. The ScheduleNode method is responsible for initiating a scheduling request to the main scheduler. The StartScheduleService method is responsible for creating the main scheduling server and receiving the scheduling request. After receiving the scheduling request, it forwards it to the corresponding scheduling execution server, receives the scheduling execution result and returns it to the scheduling requester. The StartExecutionService method is responsible for receiving the execution request from the main scheduler, starting or shutting down the managed components according to the request content, and returning the execution result to the main scheduling server. The AddNode method provides the function of adding component nodes to the component manager. Only when the node is added to the component manager can the node be scheduled by the scheduler and executor.
[0067] When scheduling is required, any component can initiate a scheduling request for any component using the ScheduleNode method. Within the ScheduleNode method, the information related to the component to be scheduled is encapsulated and sent to the main scheduling server. Upon receiving the scheduling request, the main scheduling server internally queries the scheduling executor for the component to be scheduled. If the component is not found, an error message is returned. If the component is found, the scheduling information is sent to the corresponding scheduling executor. During the scheduling execution phase, upon receiving the scheduling execution information, the node manager is queried for node information. If the node is not found, an error message is returned. If the node is found, the corresponding scheduling operation is performed, shutting down or starting the component.
[0068] The embodiment of the present application creates multiple sub-processes in the main process, so that the process number information of all components can be obtained in the main process, and the process number information is further used as the URL address information of the main process and sub-process scheduling execution service, thereby solving the problem of establishing channels between the server and the client, and there is no need to specify the URL address of each scheduling execution end through manual configuration.
[0069] According to the multi-process component scheduling method proposed in the embodiment of the present application, the current scheduling request sent by any child process is received, and the name information and the type of the node to be scheduled are obtained. When the name information of the node to be scheduled exists in the preset first dictionary type variable, the communication address of the target scheduling execution server is generated according to the process number of the name information of the node to be scheduled, and the current scheduling request is sent to the target scheduling executor. The scheduling result fed back by the target scheduling executor based on the current scheduling request is received, and the scheduling result is sent to the scheduling client. The user obtains the final scheduling result through the scheduling client. In this way, the problems of establishing channels between the server and the client and dynamically shutting down or starting any single or multiple components are solved, the resource load of the controller is reduced, and the overall resource utilization of the controller is improved.
[0070] Next, a multi-process component scheduling device proposed according to an embodiment of the present application will be described with reference to the accompanying drawings.
[0071] Figure 6 It is a block diagram of a multi-process component scheduling device according to an embodiment of the present application.
[0072] like Figure 6 As shown, the multi-process component scheduling device 10 includes: a first acquisition module 100, a judgment module 200, a generation module 300 and a second acquisition module 400.
[0073] Among them, the first acquisition module 100 is used to receive the current scheduling request sent by any child process, and obtain the name information and the type of the node to be scheduled based on the current scheduling request; the judgment module 200 is used to judge whether the name information of the node to be scheduled exists in the preset first dictionary type variable; the generation module 300 is used to generate the communication address of the target scheduling execution server according to the process number of the name information of the node to be scheduled if the name information of the node to be scheduled exists in the preset first dictionary type variable, and send the current scheduling request to the target scheduling executor based on the communication address; the second acquisition module 400 is used to receive the scheduling result fed back by the target scheduling executor based on the current scheduling request, and send the scheduling result to the scheduling client, so that the user can obtain the final scheduling result through the scheduling client.
[0074] Furthermore, in some embodiments, after determining whether the name information of the node to be scheduled exists in the preset first dictionary type variable, the judgment module 200 is also used to: if the name information of the node to be scheduled does not exist in the preset first dictionary type variable, create a first response structure corresponding to the name information of the node to be scheduled that does not exist, and set the current scheduling result to a predefined error code; send the first response structure and the predefined error code to the scheduling client, and end the current scheduling.
[0075] Furthermore, in some embodiments, before receiving the scheduling result fed back by the target scheduling executor based on the current scheduling request, the second acquisition module 400 is also used to: obtain the name information and the type of the node to be scheduled based on the current scheduling request through the target scheduling executor, and determine whether the name information of the node to be scheduled exists in the preset second dictionary type variable; if the name information of the node to be scheduled exists in the preset second dictionary type variable, obtain the node to be scheduled according to the name information of the node to be scheduled, and control the node to be scheduled to be in a running state or a stopped state according to the type of scheduling, so as to complete the scheduling execution operation of the node to be scheduled.
[0076] Furthermore, in some embodiments, after determining whether the name information of the node to be scheduled exists in the preset second dictionary type variable, the second acquisition module 400 is also used to: if the name information of the node to be scheduled does not exist in the preset second dictionary type variable, create a second response structure corresponding to the name information of the node to be scheduled that does not exist through the target scheduling executor, and set the current scheduling result to a predefined error code; send the second response structure and the predefined error code to the main scheduling server, so as to send the second response structure and the predefined error code to the scheduling client through the main scheduling server.
[0077] Furthermore, in some embodiments, when the node to be scheduled is controlled to be in a running state or a stopped state according to the type of the node to be scheduled, the second acquisition module 400 is also used to: if the current running state of the node to be scheduled is consistent with the state to be scheduled, then generate an error message or a scheduling success status message that the node to be scheduled is in a corresponding state through the target scheduling executor; and send the error message or the scheduling success status message that the node to be scheduled is in a corresponding state to the main scheduling server.
[0078] Furthermore, in some embodiments, before receiving the current scheduling request sent by any child process, the first acquisition module 100 is also used to: define a preset scheduling request and a preset response structure; create a master node manager in the main process, and create at least one child process and a corresponding component instance for each child process in the main process according to actual deployment requirements, and start the main scheduling service and the scheduling execution service of all child processes.
[0079] It should be noted that the aforementioned explanation of the embodiment of the multi-process component scheduling method is also applicable to the multi-process component scheduling device of this embodiment, and will not be repeated here.
[0080] According to the multi-process component scheduling device proposed in the embodiment of the present application, the current scheduling request sent by any child process is received, and the name information and the type of the node to be scheduled are obtained. When the name information of the node to be scheduled exists in the preset first dictionary type variable, the communication address of the target scheduling execution server is generated according to the process number of the name information of the node to be scheduled, and the current scheduling request is sent to the target scheduling executor. The scheduling result fed back by the target scheduling executor based on the current scheduling request is received, and the scheduling result is sent to the scheduling client. The user obtains the final scheduling result through the scheduling client. In this way, the problems of establishing channels between the server and the client and dynamically shutting down or starting any single or multiple components are solved, the resource load of the controller is reduced, and the overall resource utilization of the controller is improved.
[0081] Figure 7 This is a schematic diagram of the structure of the server provided in the embodiment of the present application. The server may include:
[0082] Processor 70, storage device 71 and communication device 72; the number of processors 70 in the server can be one or more, Figure 7 In the example, a processor 70 is used; a storage device 71 in the server stores one or more programs; the processor 70, the storage device 71 and the communication device 72 in the server can be connected by a bus or other means. Figure 7 When one or more programs are executed by one or more processors, the one or more processors implement the multi-process component scheduling method as described in the above embodiment.
[0083] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned multi-process component scheduling method when executed by a processor.
[0084] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.
[0085] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Thus, a feature specified as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of this application, "N" means at least two, for example, two, three, etc., unless otherwise specifically defined.
[0086] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.
[0087] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiment, the N steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array, a field programmable gate array, etc.
[0088] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0089] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A multi-process component scheduling method, characterized in that: The following steps are included: Receive a current scheduling request sent by any child process, and obtain the name information and the type of the node to be scheduled based on the current scheduling request; Determine whether the name information of the node to be scheduled exists in the preset first dictionary type variable; If the name information of the node to be scheduled exists in the preset first dictionary type variable, a communication address of a target scheduling execution server is generated according to the process number of the name information of the node to be scheduled, and the current scheduling request is sent to the target scheduling executor based on the communication address; receiving a scheduling result fed back by the target scheduling executor based on the current scheduling request, and sending the scheduling result to a scheduling client, so that a user can obtain the final scheduling result through the scheduling client; Before receiving the scheduling result fed back by the target scheduling executor based on the current scheduling request, the method further includes: Obtaining, by the target scheduling executor, the name information of the node to be scheduled and the type to be scheduled based on the current scheduling request, and determining whether the name information of the node to be scheduled exists in the preset second dictionary type variable; If the name information of the node to be scheduled exists in the preset second dictionary type variable, the node to be scheduled is obtained according to the name information of the node to be scheduled, and the node to be scheduled is controlled to be in a running state or a stopped state according to the type of scheduling to complete the scheduling execution operation of the node to be scheduled.
2. The method according to claim 1, characterized in that After determining whether the name information of the node to be scheduled exists in the preset first dictionary type variable, the method further includes: If the name information of the node to be scheduled does not exist in the preset first dictionary type variable, a first response structure corresponding to the name information of the node to be scheduled that does not exist is created, and the current scheduling result is set to a predefined error code; Send the first response structure and the predefined error code to the scheduling client and end the current scheduling.
3. The method according to claim 1, characterized in that After determining whether the name information of the node to be scheduled exists in the preset second dictionary type variable, the method further includes: If the name information of the node to be scheduled does not exist in the preset second dictionary type variable, a second response structure corresponding to the name information of the node to be scheduled that does not exist is created by the target scheduling executor, and the current scheduling result is set to a predefined error code; The second response structure and the predefined error code are sent to the main scheduling server, so that the second response structure and the predefined error code are sent to the scheduling client through the main scheduling server.
4. The method according to claim 3, characterized in that When controlling the node to be scheduled to be in the running state or the stopped state according to the proposed scheduling type, the method further includes: If the current running state of the node to be scheduled is consistent with the state to be scheduled, an error message indicating that the node to be scheduled is already in the corresponding state or a scheduling success state message is generated by the target scheduling executor; Sending error information indicating that the node to be scheduled is already in the corresponding state or the scheduling success state information to the main scheduling server.
5. The method according to claim 1, wherein Before receiving the current scheduling request sent by any child process, the method further includes: Define the preset scheduling request and preset response structure; A master node manager is created in the main process, and at least one child process and a component instance corresponding to each child process are created in the main process according to actual deployment requirements, and the main scheduling service and the scheduling execution services of all child processes are started.
6. A multi-process component scheduling device, characterized in that: include: A first acquisition module is configured to receive a current scheduling request sent by any child process, and acquire the name information and the type of the node to be scheduled based on the current scheduling request; A judgment module, configured to judge whether the name information of the node to be scheduled exists in a preset first dictionary type variable; a generating module configured to generate a communication address of a target scheduling execution server according to a process ID of the name information of the node to be scheduled, if the name information of the node to be scheduled exists in the preset first dictionary type variable, and send the current scheduling request to the target scheduling executor based on the communication address; A second acquisition module is configured to receive a scheduling result fed back by the target scheduling executor based on the current scheduling request, and send the scheduling result to a scheduling client, so that a user can obtain the final scheduling result through the scheduling client; Before receiving the scheduling result fed back by the target scheduling executor based on the current scheduling request, the second obtaining module is further configured to: Obtaining, by the target scheduling executor, the name information of the node to be scheduled and the type to be scheduled based on the current scheduling request, and determining whether the name information of the node to be scheduled exists in the preset second dictionary type variable; If the name information of the node to be scheduled exists in the preset second dictionary type variable, the node to be scheduled is obtained according to the name information of the node to be scheduled, and the node to be scheduled is controlled to be in a running state or a stopped state according to the type of scheduling to complete the scheduling execution operation of the node to be scheduled.
7. The device according to claim 6, characterized in that After determining whether the name information of the node to be scheduled exists in the preset first dictionary type variable, the determining module is further configured to: If the name information of the node to be scheduled does not exist in the preset first dictionary type variable, a first response structure corresponding to the name information of the node to be scheduled that does not exist is created, and the current scheduling result is set to a predefined error code; Send the first response structure and the predefined error code to the scheduling client and end the current scheduling.
8. The device according to claim 6, characterized in that After determining whether the name information of the node to be scheduled exists in the preset second dictionary type variable, the second obtaining module is further configured to: If the name information of the node to be scheduled does not exist in the preset second dictionary type variable, a second response structure corresponding to the name information of the node to be scheduled that does not exist is created by the target scheduling executor, and the current scheduling result is set to a predefined error code; The second response structure and the predefined error code are sent to the main scheduling server, so that the second response structure and the predefined error code are sent to the scheduling client through the main scheduling server.
9. The device according to claim 8, characterized in that When controlling the node to be scheduled to be in the running state or the stopped state according to the proposed scheduling type, the second obtaining module is further configured to: If the current running state of the node to be scheduled is consistent with the state to be scheduled, an error message indicating that the node to be scheduled is already in the corresponding state or a scheduling success state message is generated by the target scheduling executor; Sending error information indicating that the node to be scheduled is already in the corresponding state or the scheduling success state information to the main scheduling server.
10. The device according to claim 6, characterized in that Before receiving the current scheduling request sent by any child process, the first acquisition module is further configured to: Define the preset scheduling request and preset response structure; A master node manager is created in the main process, and at least one child process and a component instance corresponding to each child process are created in the main process according to actual deployment requirements, and the main scheduling service and the scheduling execution services of all child processes are started.
11. A server, characterized in that: The server includes: one or more processors; A storage device, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the multi-process component scheduling method according to any one of claims 1 to 5.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the multi-process component scheduling method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Universal bus parallelism-based vehicle diagnosis system and method
CN101807068A
Assembly operation method and device
CN104317605A