Task scheduling method, device, computer readable storage medium and electronic device
By assigning a collection of types to different servers and assigning tasks based on task type matching, the resource waste problem in the prior art caused by scheduling tasks based on the busyness and idleness of the server is solved, and more efficient resource utilization and task processing efficiency are achieved.
Patent Information
- Application Number
- CN202210285623.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-22
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-03-22
AI Technical Summary
In a diversified task scenario, the prior art can easily lead to resource waste by scheduling tasks based solely on the busyness of the server.
By assigning a set of types to different servers that are appropriate to them, and when receiving a pending task, the corresponding set of types is matched based on the task type, the task is allocated to the appropriate server.
It improves resource utilization, avoids resource waste, improves the matching degree between servers and tasks, reduces the possibility of tasks being allocated to unrelated servers, and avoids the problem of untimely processing caused by task accumulation.
Smart Images

Figure CN114610499B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task scheduling method, a task scheduling device, a computer-readable storage medium, and an electronic device. Background Art
[0002] When receiving a task that needs to be processed by a server, task scheduling technology is usually involved. Generally speaking, scenarios that require task scheduling usually set up a server cluster and schedule tasks based on the busyness of the server. This can reduce the idle rate of the server and avoid excessive load on the same server as much as possible. However, in diverse task scenarios, some tasks may require servers with more advanced hardware resources to process, while some tasks may only require servers with ordinary hardware resources to process. If the above method is directly applied to diverse task scenarios, it is easy to cause resource waste.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The purpose of the present application is to provide a task scheduling method, a task scheduling device, a computer-readable storage medium and an electronic device. In the present application, different servers correspond to type sets that are compatible with them. When receiving a task to be processed, a type set that is compatible with it can be matched based on the task type of the task to be processed, and the task to be processed can be assigned to the server corresponding to the type set to solve the problem of resource waste caused by scheduling tasks only according to the busyness of the server. The idle servers can be determined first, and then the dedicated servers can be made to process the corresponding tasks according to the type matching method. This can improve resource utilization and avoid resource waste.
[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0006] According to one aspect of the present application, a task scheduling method is provided, comprising:
[0007] Determine an idle server in an idle state according to the working status corresponding to each server;
[0008] If the number of idle servers is greater than 1, then the type set corresponding to each idle server is obtained to obtain multiple type sets;
[0009] Determine a task type corresponding to the task to be processed, and determine a target type set including the task type from multiple type sets;
[0010] Allocate the tasks to be processed to the target servers corresponding to the target type set.
[0011] In an exemplary embodiment of the present application, if the number of idle servers is equal to 1, the method further includes:
[0012] Get the idle type set corresponding to the idle server;
[0013] Determine the task type corresponding to the pending task, and if the idle type set contains the task type, assign the pending task to the target server corresponding to the idle type set.
[0014] In an exemplary embodiment of the present application, determining a target type set including a task type from a plurality of type sets includes:
[0015] Determine a candidate type set including the task type from multiple type sets;
[0016] If the number of the candidate type sets is equal to 1, the candidate type set is determined as the target type set;
[0017] If the number of the candidate type sets is greater than 1, a target type set is selected from the candidate type sets according to a preset selection rule.
[0018] In an exemplary embodiment of the present application, before determining an idle server in an idle state according to the working status corresponding to each server, the method further includes:
[0019] A new working state of a specific server reported by the management system is received, and a current working state of the specific server is updated according to the new working state; wherein the specific server is any server among the servers.
[0020] In an exemplary embodiment of the present application, the method further includes:
[0021] When receiving a task to be processed, generating a priority identifier corresponding to the task to be processed according to the task receiving time corresponding to the task to be processed and the preset priority of the task to be processed;
[0022] The to-be-processed task is added to the first specific position of the task queue according to the priority identifier.
[0023] In an exemplary embodiment of the present application, before adding the to-be-processed task to the first specific position of the task queue according to the priority identifier, the method further includes:
[0024] Determine the status parameters corresponding to the tasks to be processed;
[0025] If the state parameter is used to indicate that the task to be processed is a task to be processed for the first time, then the task information corresponding to the task to be processed and the task state indicating that the task to be processed is in an unprocessed state are stored;
[0026] If the status parameter is used to indicate that the task to be processed is not a task to be processed for the first time, the task status corresponding to the task to be processed is updated from a processed status to an unprocessed status.
[0027] In an exemplary embodiment of the present application, after allocating the to-be-processed tasks to the target servers corresponding to the target type set, the method further includes:
[0028] If the allocation is successful, receiving the processing result corresponding to the task to be processed returned by the target server, and sending a first request for instructing to update the working state from the busy state to the idle state to the management system; wherein the management system is used to update the working state from the busy state to the idle state;
[0029] If the allocation fails, a second request is sent to the management system to instruct the working state to be updated from a busy state to an idle state, and the pending task is added back to the task queue according to the priority identifier; wherein the management system is used to update the working state from a busy state to an idle state.
[0030] In an exemplary embodiment of the present application, the management system is further used to update the heartbeat time threshold corresponding to the target server after updating the working state from the busy state to the idle state;
[0031] The management system is also used to obtain the heartbeat information of the target server according to the unit time. If the heartbeat information is greater than the heartbeat time threshold, the working state is updated from the busy state to the abnormal state, and the abnormal state corresponding to the target server is synchronized to the scheduling system.
[0032] In an exemplary embodiment of the present application, the management system is further used to save the registration information and configure a heartbeat time threshold corresponding to the new server when the registration information for the new server is received.
[0033] In an exemplary embodiment of the present application, after allocating the to-be-processed tasks to the target servers corresponding to the target type set, the method further includes:
[0034] Receive the processing result corresponding to the task to be processed returned by the target server;
[0035] If the processing result is used to indicate that the task processing is successful, the task status corresponding to the task to be processed is updated from an unprocessed state to a processed state.
[0036] In an exemplary embodiment of the present application, after receiving the processing result corresponding to the task to be processed returned by the target server, the method further includes:
[0037] If the processing result indicates that the task processing has failed, then the number of task failures corresponding to the task to be processed is determined;
[0038] If the number of task failures is greater than or equal to the preset number, a prompt message indicating that the working state of the target server is updated from a busy state to an abnormal state is sent to the management system, and a prompt message indicating that the task to be processed is abnormal is returned to the user end;
[0039] If the number of task failures is less than the preset number, the number of task failures is updated and the to-be-processed task is re-added to the second specific position of the task queue according to the priority identifier.
[0040] In an exemplary embodiment of the present application, the method further includes:
[0041] When receiving offline prompt information, determining a designated server corresponding to the offline prompt information; wherein the designated server is any server among the servers;
[0042] A current task corresponding to the designated server is determined, and the current task is added to a third specific position of the task queue according to a specific priority identifier corresponding to the current task.
[0043] In an exemplary embodiment of the present application, the method further includes:
[0044] Perform timeout monitoring on the target server according to the preset duration;
[0045] If it is monitored that the processing time of the target server for the task to be processed is greater than or equal to the preset time, the processing result corresponding to the task to be processed is obtained from the target server;
[0046] If the processing result is obtained within the preset number of acquisitions, the task status corresponding to the pending task is updated from the unprocessed state to the processed state;
[0047] If the processing result is not obtained within the preset number of acquisition times, the task to be processed is determined to be abnormal, and a prompt message indicating that the task to be processed is abnormal is returned to the user end.
[0048] In an exemplary embodiment of the present application, the target server is used to determine at least one processing stage corresponding to the task to be processed and the stage processing time corresponding to each processing stage; if it is detected that there is a target processing stage that exceeds the corresponding stage processing time, the execution process is exited, and a third request is sent to the management system to instruct the target server to update its corresponding working state to an idle state.
[0049] According to one aspect of the present application, a task scheduling device is provided, comprising:
[0050] A server determination unit, used to determine an idle server in an idle state according to the working status corresponding to each server;
[0051] a type determination unit, configured to obtain a type set corresponding to each idle server if the number of idle servers is greater than 1, to obtain a plurality of type sets;
[0052] The type determination unit is further used to determine the task type corresponding to the task to be processed, and determine a target type set including the task type from a plurality of type sets;
[0053] The task dispatching unit is used to distribute the tasks to be processed to the target servers corresponding to the target type set.
[0054] In an exemplary embodiment of the present application, if the number of idle servers is equal to 1, the above-mentioned device further includes:
[0055] A type set acquisition unit, used to acquire an idle type set corresponding to an idle server;
[0056] The server determination unit is further used to determine the task type corresponding to the task to be processed, and if the idle type set contains the task type, the task to be processed is allocated to the target server corresponding to the idle type set.
[0057] In an exemplary embodiment of the present application, the type determination unit determines a target type set including a task type from a plurality of type sets, including:
[0058] Determine a candidate type set including the task type from multiple type sets;
[0059] If the number of the candidate type sets is equal to 1, the candidate type set is determined as the target type set;
[0060] If the number of the candidate type sets is greater than 1, a target type set is selected from the candidate type sets according to a preset selection rule.
[0061] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0062] A working status updating unit is used to receive a new working status of a specific server reported by the management system before the server determination unit determines an idle server in an idle state according to the working status corresponding to each server, and to update the current working status of the specific server according to the new working status; wherein the specific server is any one of the servers.
[0063] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0064] A priority identification determination unit, configured to generate a priority identification corresponding to the task to be processed according to a task reception time corresponding to the task to be processed and a preset priority of the task to be processed when receiving the task to be processed;
[0065] The task adding unit is used to add the to-be-processed task to the first specific position of the task queue according to the priority identifier.
[0066] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0067] A parameter determination unit, used for determining a state parameter corresponding to the task to be processed before the task adding unit adds the task to be processed to the first specific position of the task queue according to the priority identifier;
[0068] An information storage unit, used for storing task information corresponding to the task to be processed and a task status indicating that the task to be processed is in an unprocessed state when the status parameter is used to indicate that the task to be processed is a task to be processed for the first time;
[0069] The processing status updating unit is used to update the task status corresponding to the task to be processed from a processed status to an unprocessed status when the status parameter is used to indicate that the task to be processed is not a task to be processed for the first time.
[0070] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0071] A request sending unit, configured to receive a processing result corresponding to the task to be processed returned by the target server if the assignment is successful after the task dispatching unit assigns the task to be processed to the target server corresponding to the target type set, and to send a first request to the management system for instructing to update the working state from the busy state to the idle state; wherein the management system is configured to update the working state from the busy state to the idle state;
[0072] The request sending unit is also used to send a second request to the management system to instruct the working status to be updated from a busy state to an idle state if the allocation fails, and to add the pending task back to the task queue according to the priority identifier; wherein the management system is used to update the working status from a busy state to an idle state.
[0073] In an exemplary embodiment of the present application, the management system is further used to update the heartbeat time threshold corresponding to the target server after updating the working state from the busy state to the idle state;
[0074] The management system is also used to obtain the heartbeat information of the target server according to the unit time. If the heartbeat information is greater than the heartbeat time threshold, the working state is updated from the busy state to the abnormal state, and the abnormal state corresponding to the target server is synchronized to the scheduling system.
[0075] In an exemplary embodiment of the present application, the management system is further used to save the registration information and configure a heartbeat time threshold corresponding to the new server when the registration information for the new server is received.
[0076] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0077] The processing status update unit is also used to receive the processing result corresponding to the task to be processed returned by the target server after the task scheduling unit assigns the task to be processed to the target server corresponding to the target type set; if the processing result is used to indicate that the task processing is successful, the task status corresponding to the task to be processed is updated from the unprocessed state to the processed state.
[0078] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0079] a failure count determination unit, configured to determine the task failure count corresponding to the task to be processed after the processing status update unit receives the processing result corresponding to the task to be processed returned by the target server, if the processing result indicates that the task processing has failed;
[0080] A message reminder unit, used for sending a reminder message for instructing the management system to update the working state of the target server from a busy state to an abnormal state when the number of task failures is greater than or equal to a preset number, and returning a reminder message for indicating that the task to be processed is abnormal to the user end;
[0081] The task adding unit is further used to update the number of task failures and re-add the to-be-processed task to the second specific position of the task queue according to the priority identifier when the number of task failures is less than a preset number.
[0082] In an exemplary embodiment of the present application, wherein:
[0083] The server determination unit is further used to determine the designated server corresponding to the offline prompt information when receiving the offline prompt information; wherein the designated server is any server among the servers;
[0084] The task adding unit is further used to determine the current task corresponding to the designated server, and add the current task to the third specific position of the task queue according to the specific priority identifier corresponding to the current task.
[0085] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0086] A timeout monitoring unit is used to perform timeout monitoring on a target server according to a preset time length; if it is monitored that the processing time of a task to be processed by the target server is greater than or equal to the preset time length, the processing result corresponding to the task to be processed is obtained from the target server; if the processing result is obtained within a preset number of acquisitions, the task status corresponding to the task to be processed is updated from an unprocessed state to a processed state; if the processing result is not obtained within the preset number of acquisitions, the task to be processed is determined to be abnormal, and a prompt message indicating the abnormality of the task to be processed is returned to the user end.
[0087] In an exemplary embodiment of the present application, the target server is used to determine at least one processing stage corresponding to the task to be processed and the stage processing time corresponding to each processing stage; if it is detected that there is a target processing stage that exceeds the corresponding stage processing time, the execution process is exited, and a third request is sent to the management system to instruct the target server to update its corresponding working state to an idle state.
[0088] According to one aspect of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any one of the above methods by executing the executable instructions.
[0089] According to one aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, any one of the above methods is implemented.
[0090] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0091] The exemplary embodiments of the present application may have some or all of the following beneficial effects:
[0092] In the task scheduling method provided in an example implementation of the present application, an idle server in an idle state can be determined according to the working state corresponding to each server; if the number of idle servers is greater than 1, the type set corresponding to each idle server is obtained to obtain multiple type sets; determine the task type corresponding to the task to be processed, and determine the target type set containing the task type from the multiple type sets; assign the task to be processed to the target server corresponding to the target type set. It can be seen that in the present application, different servers correspond to the type set that is adapted to them. When receiving the task to be processed, the type set that is adapted to them can be matched based on the task type of the task to be processed, and the task to be processed can be assigned to the server corresponding to the type set, so as to solve the problem of resource waste caused by scheduling tasks only according to the busyness of the server. The idle server can be determined first, and then the special server can be made to process the corresponding task according to the type matching method, so as to improve the resource utilization rate of resources and avoid resource waste. In addition, the matching degree between the server and the task can be improved, so as to avoid assigning tasks to irrelevant servers, and to avoid assigning too many tasks to the same server, which causes the problem of untimely task processing caused by too many tasks being piled up, and is conducive to improving the processing efficiency of tasks.
[0093] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0095] Figure 1 A schematic diagram showing an exemplary system architecture of a task scheduling method and a task scheduling device to which the embodiments of the present application can be applied;
[0096] Figure 2 A flowchart of a task scheduling method according to an embodiment of the present application is schematically shown;
[0097] Figure 3 A flowchart of a task scheduling method according to an embodiment of the present application is schematically shown;
[0098] Figure 4 The structure diagram of a task scheduling system according to an embodiment of the present application is schematically shown;
[0099] Figure 5The structure block diagram of a task scheduling device according to an embodiment of the present application is schematically shown;
[0100] Figure 6 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0101] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present application will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical solutions of the present application may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present application.
[0102] In addition, the accompanying drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0103] Figure 1 A schematic diagram of a system architecture of an exemplary application environment in which a task scheduling method and a task scheduling device according to an embodiment of the present application can be applied is shown.
[0104] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with display screens, including but not limited to desktop computers, portable computers, smart phones, tablet computers, etc. It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0105] The task scheduling method provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the task scheduling device is generally set in the server 105. However, it is easy for those skilled in the art to understand that the task scheduling method provided in the embodiment of the present application can also be executed by the terminal device 101, 102 or 103, and accordingly, the task scheduling device can also be set in the terminal device 101, 102 or 103, and this is not specifically limited in the present exemplary embodiment. For example, in an exemplary embodiment, the server 105 can determine the idle servers in the idle state according to the working status corresponding to each server; if the number of idle servers is greater than 1, then obtain the type set corresponding to each idle server to obtain multiple type sets; determine the task type corresponding to the task to be processed, and determine the target type set containing the task type from the multiple type sets; assign the task to be processed to the target server corresponding to the target type set.
[0106] This exemplary embodiment provides a task scheduling method. The task scheduling method can be applied to the server 105, or to one or more of the terminal devices 101, 102, 103, which is not particularly limited in this exemplary embodiment. Figure 2 As shown, the task scheduling method may include the following steps S210 to S240.
[0107] Step S210: determining an idle server in an idle state according to the working status corresponding to each server.
[0108] Step S220: If the number of idle servers is greater than 1, then the type set corresponding to each idle server is obtained to obtain multiple type sets.
[0109] Step S230: Determine the task type corresponding to the task to be processed, and determine a target type set including the task type from multiple type sets.
[0110] Step S240: Allocate the tasks to be processed to the target servers corresponding to the target type set.
[0111] It should be noted that step S210 to step S240 and corresponding embodiments may be implemented by a scheduling system, and the scheduling system may run in a pre-set server / electronic device.
[0112] It can be seen that in Figure 2In the example, different servers correspond to the type sets that are compatible with them. When receiving a task to be processed, the type set that is compatible with it can be matched based on the task type of the task to be processed, and the task to be processed can be assigned to the server corresponding to the type set to solve the problem of resource waste caused by scheduling tasks only according to the busyness of the server. The idle server can be determined first, and then the dedicated server can be made to process the corresponding task according to the type matching method, which can improve the resource utilization rate and avoid resource waste. In addition, the matching degree between the server and the task can be improved to avoid assigning tasks to irrelevant servers, and it can also avoid assigning too many tasks to the same server, resulting in too many tasks piling up and leading to untimely task processing, which is conducive to improving the processing efficiency of tasks.
[0113] Next, the above steps of this exemplary embodiment are described in more detail.
[0114] In step S210, an idle server in an idle state is determined according to the working state corresponding to each server.
[0115] Specifically, the above-mentioned servers may be from the same server cluster or from different server clusters, which is not limited in the embodiments of the present application. The working states corresponding to the servers may be the same or different, and the working states may at least include: busy state, idle state, abnormal state (such as offline), and optionally, the working states may also include other states, which is not limited in the embodiments of the present application. In addition, the working states corresponding to the servers may be represented in any form such as numbers, words, and strings, which is not limited in the embodiments of the present application.
[0116] In addition, exemplarily, each of the above servers may be a rendering server, and the rendering server is used to process rendering tasks.
[0117] Optionally, before determining the idle server in the idle state according to the working state corresponding to each server, the above method may also include: configuring a type set for each server. The type sets corresponding to each server may be the same or different, and the number of types corresponding to different type sets is different. Based on this, different servers can process different types of tasks. For example, server A can process tasks of task types T1 and T2, server B can process tasks of task types T3 and T4, server C can process tasks of task types T1, T2, T3, and T4, and server D can process tasks of task types T2 and T3. In this way, the servers can be distinguished, so that servers with different hardware configurations can process the most suitable tasks, so that each server can maximize its own characteristics, which is conducive to improving task processing efficiency and the utilization of server resources.
[0118] As an optional embodiment, before determining the idle server in an idle state according to the corresponding working status of each server, the above method also includes: receiving a new working status of a specific server reported by the management system, and updating the current working status of the specific server according to the new working status; wherein the specific server is any server among the servers.
[0119] Specifically, the management system is used to report the new working state to the scheduling system when detecting a new working state of any server, so that the working states of each server stored in the management system and the scheduling system are consistent. The new working state can be an idle state, a busy state or an abnormal state.
[0120] It can be seen that by implementing this optional embodiment, the working status of the server can be received by the management system in a timely manner, so that when a task to be processed is received, the accurate idle server can be determined in time, which is conducive to improving the scheduling efficiency of the task, and further conducive to improving the task processing efficiency.
[0121] In step S220, if the number of idle servers is greater than 1, the type set corresponding to each idle server is obtained to obtain multiple type sets.
[0122] Specifically, each type set in a plurality of type sets may be different, and the same type set may exist in a plurality of type sets, which is not limited in the embodiments of the present application.
[0123] As an optional embodiment, if the number of idle servers is equal to 1, the above method also includes: obtaining an idle type set corresponding to the idle servers; determining the task type corresponding to the task to be processed, and if the idle type set contains the task type, allocating the task to be processed to the target server corresponding to the idle type set.
[0124] Specifically, after allocating the pending tasks to the target servers corresponding to the idle type set, the above method may further include: the scheduling system may receive the processing results corresponding to the pending tasks returned by the target server; if the processing results are used to indicate that the task processing is successful, the task status corresponding to the pending task is updated from an unprocessed status to a processed status; if the processing results are used to indicate that the task processing fails, the number of task failures corresponding to the pending task is determined; if the number of task failures is greater than or equal to a preset number, a prompt message is sent to the management system to indicate that the working status of the target server is updated from a busy state to an abnormal state, and a prompt message indicating that the pending task is abnormal is returned to the user end; if the number of task failures is less than the preset number, the number of task failures is updated and the pending task is re-added to the second specific position of the task queue according to the priority identifier.
[0125] Furthermore, the management system can update the working state from a busy state to an idle state when the processing result indicates that the task processing is successful and the scheduling system indicates that the working state corresponding to the target server is changed, so that the target server can receive the next round of task assignments; further, the heartbeat time threshold corresponding to the target server can be updated, and the heartbeat information of the target server can be obtained according to the unit time. If the heartbeat information is greater than the heartbeat time threshold, the working state is updated from a busy state to an abnormal state, and the abnormal state corresponding to the target server is synchronized to the scheduling system to avoid the scheduling system from assigning tasks to abnormal servers, which is conducive to improving the processing efficiency of tasks. Furthermore, the management system can also update the working state from a busy state to an abnormal state when the processing result indicates that the task processing fails and the scheduling system indicates that the working state corresponding to the target server is changed.
[0126] In addition, optionally, after allocating the pending tasks to the target server corresponding to the idle type set, the above method may further include: if the allocation is successful, the scheduling system receives the processing results corresponding to the pending tasks returned by the target server, and sends a first request to the management system to indicate that the working status is updated from a busy state to an idle state; wherein the management system is used to update the working status from a busy state to an idle state; if the allocation fails, the scheduling system sends a second request to the management system to indicate that the working status is updated from a busy state to an idle state, and adds the pending tasks back to the task queue according to the priority identifier; wherein the management system is used to update the working status from a busy state to an idle state.
[0127] It can be seen that by implementing this optional embodiment, different scheduling methods can be disclosed when the number of idle servers is one or more, so that the present application can cope with more diverse application scenarios and improve the robustness of the technical solution of the present application.
[0128] In step S230 , the task type corresponding to the task to be processed is determined, and a target type set including the task type is determined from a plurality of type sets.
[0129] Specifically, the task to be processed may be a rendering task (such as baking, etc.) or other tasks, which is not limited in the embodiment of the present application.
[0130] As an optional embodiment, determining a target type set including a task type from multiple type sets includes: determining a set of to-be-selected types including the task type from multiple type sets; if the number of to-be-selected type sets is equal to 1, determining the to-be-selected type set as the target type set; if the number of to-be-selected type sets is greater than 1, selecting the target type set from the to-be-selected type set according to a preset selection rule.
[0131] Specifically, the number of candidate type sets can be one or more. For example, if the task type is T1, the candidate type sets containing the task type may be: candidate type set S = {T1, T3, T5}, candidate type set F = {T1, T2}, candidate type set G = {T1}, candidate type set W = {T8, T6, T1}.
[0132] In addition, optionally, the preset selection rule can be expressed in any form such as a function expression, text information, etc., which is not limited in the embodiments of the present application. Based on this, if the preset selection rule is used to limit random selection, the target type set is selected from the set of types to be selected according to the preset selection rule, including: randomly selecting the target type set from the set of types to be selected. If the preset selection rule is used to limit the type set with the least number of types as the target type set, the target type set is selected from the set of types to be selected according to the preset selection rule, including: selecting the type set with the least number of types as the target type set from the set of types to be selected. If the preset selection rule is used to limit the type set with the largest number of types as the target type set, the target type set is selected from the set of types to be selected according to the preset selection rule, including: selecting the type set with the largest number of types as the target type set from the set of types to be selected.
[0133] It can be seen that by implementing this optional embodiment, when the number of the to-be-selected type sets is one or more, a corresponding target type set can be determined to allocate the tasks to be processed to the target server corresponding to the target type set, which is beneficial to improving the utilization of server resources.
[0134] As an optional embodiment, the above method also includes: when receiving a task to be processed, generating a priority identifier corresponding to the task to be processed based on the task reception time corresponding to the task to be processed and the preset priority of the task to be processed; adding the task to be processed to the first specific position of the task queue according to the priority identifier.
[0135] Specifically, the priority identifier can be expressed in any form such as numbers, words, characters, etc., which is not limited in the embodiments of the present application. The task queue can be stored in a message middleware (such as rabbitMq), and the task queue may include one or more pending tasks, or may not include tasks. If the task queue contains multiple pending tasks, the multiple pending tasks are arranged in order from large to small / from small to large according to the priority identifier, or arranged in other ways, which is not limited in the embodiments of the present application.
[0136] In addition, optionally, a priority identifier corresponding to the task to be processed is generated based on the task reception time corresponding to the task to be processed and the preset priority of the task to be processed, including: obtaining the task reception time corresponding to the task to be processed (e.g., 22:00) and the preset priority of the task to be processed (e.g., L3); normalizing the task reception time and the preset priority to obtain a time parameter (e.g., 2200) and a priority parameter (e.g., 3); substituting the time parameter and the priority parameter into a preset expression (e.g., time parameter-priority parameter; or, a1*time parameter-a2*priority parameter, a1 and a2 are weights expressed as constants) to calculate the priority identifier of the task to be processed (e.g., 2197).
[0137] In addition, adding the pending task to the first specific position of the task queue according to the priority identifier includes: determining the identifier (such as 2198) of the designated task that is greater than the priority identifier (such as 2197) and adjacent from the task queue, determining the position corresponding to the designated task as the first specific position, and updating the positions of other tasks whose identifiers are greater than the priority identifier in the task queue; wherein the determined first specific position can be any position in the task queue, and the present application does not limit the first specific position in the task queue to be a fixed position. For example, if the task queue includes task 1 (at position 1)-task 2 (at position 2)-task 3 (at position 3), task 1 is the task with the highest priority, and if task 2 is the above-mentioned designated task, the position of task 2 can be determined as the first specific position, and the position of task 2 is updated to position 3 and the position of task 3 is updated to position 4, and then, the task queue includes task 1 (at position 1)-pending task (at position 2)-task 2 (at position 3)-task 3 (at position 4).
[0138] It can be seen that by implementing this optional embodiment, a priority identifier corresponding to the task to be processed can be generated according to the task reception time of the task to be processed and the preset priority of the task to be processed, and then the task to be processed can be added to the task queue based on the priority identifier, thereby realizing personalized setting of the priority identifier and thus realizing accurate determination of the priority of the task to be processed.
[0139] As an optional embodiment, before adding the pending task to the first specific position of the task queue according to the priority identifier, the above method also includes: determining a status parameter corresponding to the pending task; if the status parameter is used to indicate that the pending task is a task being processed for the first time, storing the task information corresponding to the pending task and the task status characterizing that the pending task is in an unprocessed state; if the status parameter is used to indicate that the pending task is not a task being processed for the first time, updating the task status corresponding to the pending task from a processed state to an unprocessed state.
[0140] Specifically, the state parameter may include at least the number of times the task to be processed is processed (e.g., 2 times). In addition, the state parameter may also include other parameters (e.g., task processing history record parameters), which are not limited in the embodiments of the present application. If the state parameter is used to indicate that the number of times the task is processed is 0, the task to be processed can be determined to be a task processed for the first time. If the state parameter is used to indicate that the number of times the task is processed is greater than 0, the task to be processed can be determined to be a task not processed for the first time.
[0141] In addition, the task information corresponding to the pending task can be used to describe the relevant information of the task, such as the specific content of the task. In addition, the task status can be represented in any form, and the task status can include other states in addition to the unprocessed state and the processed state, which is not limited in the embodiments of the present application.
[0142] It can be seen that by implementing this optional embodiment, it is possible to distinguish whether a task is being processed for the first time based on the status parameters, thereby realizing the storage of task information corresponding to the task to be processed and the task status representing that the task to be processed is in an unprocessed state, or updating the task status corresponding to the task to be processed from a processed state to an unprocessed state, thereby realizing accurate recording of the task processing cycle and avoiding misprocessing of the task.
[0143] In step S240, the tasks to be processed are allocated to the target servers corresponding to the target type set.
[0144] Specifically, assigning the pending task to the target server corresponding to the target type set includes: sending a task assignment instruction to the target server corresponding to the target type set, the task assignment instruction is used to indicate the storage location corresponding to the pending task (i.e., the first specific location), after the target server receives the task assignment instruction, it can obtain the pending task from the first specific location of the task queue and execute the pending task.
[0145] As an optional embodiment, after allocating the pending tasks to the target servers corresponding to the target type set, the above method further includes: if the allocation is successful, receiving the processing results corresponding to the pending tasks returned by the target server, and sending a first request to the management system to indicate that the working status is updated from a busy state to an idle state; wherein the management system is used to update the working status from a busy state to an idle state; if the allocation fails, sending a second request to the management system to indicate that the working status is updated from a busy state to an idle state, and adding the pending tasks back to the task queue according to the priority identifier; wherein the management system is used to update the working status from a busy state to an idle state.
[0146] Specifically, the data formats of the first request and the second and third requests described below may also be the same, but the data contents may be different. In addition, the method may further include: sending a task allocation instruction to a target server corresponding to the target type set, and if a feedback message of the target server to the task allocation instruction is received within a specified unit time (such as 5 milliseconds), the allocation is determined to be successful; if a feedback message of the target server to the task allocation instruction is not received within the specified unit time (such as 5 milliseconds), the allocation is determined to be unsuccessful; wherein the feedback message is used to indicate the instruction reception status of the target server.
[0147] It can be seen that by implementing this optional embodiment, the working status of the server is updated in time according to the task allocation situation, so as to improve the utilization rate of the server resources.
[0148] As an optional embodiment, the management system is also used to update the heartbeat time threshold corresponding to the target server after updating the working state from a busy state to an idle state; the management system is also used to obtain the heartbeat information of the target server according to a unit time length. If the heartbeat information is greater than the heartbeat time threshold, the working state is updated from a busy state to an abnormal state, and the abnormal state corresponding to the target server is synchronized to the scheduling system.
[0149] Specifically, the heartbeat time threshold (e.g., 3 seconds) can be used to limit the maximum duration of the server to perform the task. The heartbeat time thresholds corresponding to different servers can be the same or different, and the embodiments of the present application are not limited thereto. The heartbeat information is at least used to indicate the duration after the target server receives the assigned task. If the heartbeat information is greater than the heartbeat time threshold, it means that the server may be offline, and then the working state can be updated from the busy state to the abnormal state, and the abnormal state corresponding to the target server is synchronized to the scheduling system, so that the scheduling system can timely re-add the task processed by the server to the task queue, and reallocate the server to it, to ensure that the task can be processed in time.
[0150] In addition, optionally, after the working status is updated from the busy status to the abnormal status, the above method may further include: returning prompt information indicating that the target server is abnormal to the user terminal.
[0151] It can be seen that by implementing this optional embodiment, the server can be monitored through the management system, so as to promptly detect abnormal servers based on the comparison of heartbeat information and heartbeat time thresholds, and promptly update the working status of the server to avoid tasks not being processed in time, thereby improving the processing efficiency of tasks.
[0152] As an optional embodiment, the management system is further used to save the registration information and configure a heartbeat time threshold corresponding to the new server when the registration information for the new server is received.
[0153] Specifically, the registration information can be used to achieve horizontal expansion of the new server. The registration information can specifically include information such as the identifier, address, type set, etc. corresponding to the new server, which is not limited in the embodiments of the present application.
[0154] It can be seen that by implementing this optional embodiment, new servers can be added through registration information to achieve horizontal expansion of servers, making it convenient for relevant personnel to increase or decrease servers in real time based on demand to cope with tasks of different magnitudes.
[0155] As an optional embodiment, after allocating the tasks to be processed to the target server corresponding to the target type set, the above method also includes: receiving the processing results corresponding to the tasks to be processed returned by the target server; if the processing results are used to indicate that the task processing is successful, then updating the task status corresponding to the tasks to be processed from an unprocessed state to a processed state.
[0156] Specifically, after updating the task status corresponding to the to-be-processed task from an unprocessed status to a processed status, the method may further include: deleting the to-be-processed task in the task queue, and scheduling the task after the to-be-processed task.
[0157] It can be seen that by implementing this optional embodiment, the processing status of the task can be updated in time when the task is successfully processed, thereby avoiding the task from being assigned again.
[0158] As an optional embodiment, after receiving the processing result corresponding to the task to be processed returned by the target server, the above method also includes: if the processing result is used to indicate that the task processing failed, then determining the number of task failures corresponding to the task to be processed; if the number of task failures is greater than or equal to a preset number, sending a prompt message to the management system to indicate that the working status of the target server is updated from a busy state to an abnormal state, and returning a prompt message to the user end to indicate that the task to be processed is abnormal; if the number of task failures is less than the preset number, then updating the number of task failures and re-adding the task to be processed to the second specific position of the task queue according to the priority identifier.
[0159] Specifically, the number of task failures can be used to limit the number of times the task has failed to be processed. If the number of task failures is greater than or equal to the preset number, it means that there may be a problem with the server, and it is necessary to send a prompt message to the management system to instruct the target server's working status to be updated from a busy state to an abnormal state. If the number of task failures is less than the preset number, it means that there may not be a problem with the server, and the server can be reallocated without requesting the management system to update the working status of the target server.
[0160] It can be seen that by implementing this optional embodiment, compensation retries can be automatically performed when a task fails, thereby improving the success rate and automation level of rendering tasks.
[0161] As an optional embodiment, the above method also includes: when receiving the offline prompt information, determining the designated server corresponding to the offline prompt information; wherein the designated server is any one of the servers; determining the current task corresponding to the designated server, and adding the current task to the third specific position of the task queue according to the specific priority identifier corresponding to the current task.
[0162] Specifically, the first specific position, the second specific position and the third specific position can be the same position or different positions, and the embodiment of the present application does not limit this. The first specific position, the second specific position and the third specific position are only used to distinguish different adding stages and are not used to accurately limit the adding position.
[0163] In addition, the offline prompt information can be used to indicate the designated server that is offline. The designated server indicated by the offline prompt information can be one or more, which is not limited in the embodiment of the present application. Correspondingly, the designated server can be one or more. Among them, the designated server can be the aforementioned target server or other servers, which is not limited in the embodiment of the present application. Specifically, if the designated server is the aforementioned target server, the current task is the aforementioned task to be processed.
[0164] In addition, optionally, determining the current task corresponding to the designated server includes: determining the unprocessed tasks of the designated server as the current task. If there are multiple designated servers, determining the current task corresponding to the designated server includes: determining the unprocessed tasks of each designated server as the current tasks corresponding to each designated server.
[0165] Based on this, optionally, if there are multiple designated servers, the current task is added to the third specific position of the task queue according to the specific priority identifier corresponding to the current task, including: determining the third specific position corresponding to each current task from the task queue according to the specific priority identifier corresponding to each current task, and adding each current task to its corresponding third specific position; wherein different current tasks correspond to different third specific positions.
[0166] In addition, before adding the current task to the third specific position of the task queue according to the specific priority identifier corresponding to the current task, the above method may also include: generating a specific priority identifier corresponding to the current task according to the task reception time corresponding to the current task and the preset priority of the current task. The specific priority identifier may be generated when the current task is first assigned, so when the server is offline, the specific priority identifier may be used when the current task is reallocated, so that the current task can be added to a front position of the task queue, so that it can be assigned earlier, so as to improve the processing efficiency of the current task.
[0167] It can be seen that by implementing this optional embodiment, when task processing fails, the unprocessed tasks of the server can be added back to the task queue to avoid missing tasks. At the same time, the task processing efficiency can be improved by adding tasks in a timely manner.
[0168] As an optional embodiment, the above method also includes: performing timeout monitoring on the target server according to a preset time length; if it is monitored that the processing time of the target server for the task to be processed is greater than or equal to the preset time length, obtaining the processing result corresponding to the task to be processed from the target server; if the processing result is obtained within a preset number of acquisitions (e.g., 3 times), the task status corresponding to the task to be processed is updated from an unprocessed state to a processed state; if the processing result is not obtained within the preset number of acquisitions, it is determined that the task to be processed is abnormal, and a prompt message indicating the abnormality of the task to be processed is returned to the user end.
[0169] Specifically, the preset duration can be a pre-set duration or a duration obtained from a time comparison table, which is not limited in the embodiments of the present application. Among them, the time comparison table can be a comparison table of duration and task magnitude, and different task magnitudes can correspond to different durations. For example, a task magnitude of one hundred to two hundred can correspond to 10 minutes, and a task magnitude of ten thousand to twenty thousand can correspond to five minutes. In addition, the above-mentioned user terminal can be a pre-set user terminal, and the number of user terminals can be one or more. The user terminal can be an operator client. Returning prompt information to the user terminal to indicate an abnormality of the task to be processed can help the operator to be informed of the abnormal situation in a timely manner and then perform manual intervention.
[0170] It can be seen that the implementation of this optional embodiment can realize timeout monitoring of the target server. It can be understood that the present application can not only realize the target server to monitor itself, but also realize monitoring based on the scheduling system and management system, thereby improving the monitoring intensity, and can realize timely update of the server working status, thereby improving the utilization rate of server resources.
[0171] As an optional embodiment, the target server is used to determine at least one processing stage corresponding to the task to be processed and the stage processing time corresponding to each processing stage; if it is detected that there is a target processing stage that exceeds the corresponding stage processing time, the execution process is exited, and a third request is sent to the management system to instruct the target server to update its corresponding working state to an idle state.
[0172] Specifically, the task to be processed may correspond to one or more processing stages, wherein there may or may not be an execution order between the multiple processing stages, which is not limited in the embodiments of the present application. Different processing stages may correspond to different stage processing durations / same stage processing durations, and the stage processing durations may be pre-set.
[0173] In addition, after the third request is sent to the management system to instruct the target server to update its corresponding working state to an idle state, the method may further include: the management system updates the corresponding working state of the target server to an idle state, and synchronizes the idle state of the target server to the scheduling system.
[0174] It can be seen that the implementation of this optional embodiment can not only enable the target server to monitor itself, but also realize monitoring based on the scheduling system and management system, thereby improving the monitoring intensity, realizing timely updating of the server working status, and thus improving the utilization rate of server resources.
[0175] See also Figure 3 , Figure 3 The flowchart of a task scheduling method according to another embodiment of the present application is schematically shown. Figure 3 As shown, the task scheduling method includes: steps S300 to S344.
[0176] Step S300: When receiving registration information for a new server, the management system saves the registration information and configures a heartbeat time threshold corresponding to the new server.
[0177] Step S302: the scheduling system receives the new working status of the specific server reported by the management system, and updates the current working status of the specific server according to the new working status; wherein the specific server is any server among the servers.
[0178] Step S304: When receiving the task to be processed, the scheduling system generates a priority identifier corresponding to the task to be processed according to the task receiving time corresponding to the task to be processed and the preset priority of the task to be processed, and the scheduling system determines the state parameter corresponding to the task to be processed. If the state parameter is used to indicate that the task to be processed is a task to be processed for the first time, step S306 is executed. If the state parameter is used to indicate that the task to be processed is not a task to be processed for the first time, step S308 is executed.
[0179] Step S306: The scheduling system stores the task information corresponding to the pending task and the task status indicating that the pending task is in an unprocessed state.
[0180] Step S308: The scheduling system updates the task status corresponding to the to-be-processed task from the processed status to the unprocessed status.
[0181] Step S310: The scheduling system adds the to-be-processed task to the first specific position of the task queue according to the priority identifier.
[0182] Step S312: The scheduling system determines idle servers in an idle state according to the working states corresponding to the servers. If the number of idle servers is greater than 1, then execute S314. If the number of idle servers is equal to 1, then execute step S340.
[0183] Step S314: The scheduling system obtains the type set corresponding to each idle server to obtain multiple type sets.
[0184] Step S316: The scheduling system determines the task type corresponding to the task to be processed, and determines a set of candidate types containing the task type from multiple type sets. If the number of candidate type sets is greater than 1, step S318 is executed. If the number of candidate type sets is greater than 1, step S320 is executed.
[0185] Step S318: The scheduling system determines the candidate type set as the target type set.
[0186] Step S320: The scheduling system selects a target type set from the set of to-be-selected types according to a preset selection rule.
[0187] Step S322: The scheduling system allocates the pending tasks to the target servers corresponding to the target type set, and then executes steps S342 and S344. If the allocation is successful, execute step S324. If the allocation fails, execute step S326.
[0188] Step S324: The scheduling system performs timeout monitoring on the target server according to a preset duration; if it is monitored that the processing time of the target server for the task to be processed is greater than or equal to the preset duration, the processing result corresponding to the task to be processed is obtained from the target server; if the processing result is obtained within the preset number of acquisitions, the task status corresponding to the task to be processed is updated from an unprocessed state to a processed state; if the processing result is not obtained within the preset number of acquisitions, the task to be processed is determined to be abnormal, and a prompt message indicating the abnormality of the task to be processed is returned to the user end.
[0189] Step S326: The scheduling system sends a second request to the management system to instruct the working state to be updated from the busy state to the idle state, and adds the pending task back to the task queue according to the priority identifier; wherein the management system is used to update the working state from the busy state to the idle state.
[0190] Step S328: The scheduling system receives the processing result corresponding to the task to be processed returned by the target server. If the processing result indicates that the task processing is successful, step S330 is executed. If the processing result indicates that the task processing fails, step S332 is executed.
[0191] Step S330: The scheduling system updates the task status corresponding to the pending task from an unprocessed status to a processed status, and sends a first request to the management system to instruct the working status to be updated from a busy status to an idle status; wherein the management system is used to update the working status from a busy status to an idle status.
[0192] Step S332: The scheduling system determines the number of task failures corresponding to the task to be processed.
[0193] Step S334: If the number of task failures is greater than or equal to the preset number, the scheduling system sends a prompt message to the management system to instruct the target server's working status to be updated from a busy state to an abnormal state, and returns a prompt message to the user end to indicate that the task to be processed is abnormal; if the number of task failures is less than the preset number, the scheduling system updates the number of task failures and re-adds the task to be processed to the second specific position of the task queue according to the priority identifier.
[0194] Step S336: When receiving the offline prompt information, the scheduling system determines the designated server corresponding to the offline prompt information; wherein the designated server is any server among the servers.
[0195] Step S338: The scheduling system determines the current task corresponding to the designated server, and adds the current task to the third specific position of the task queue according to the specific priority identifier corresponding to the current task.
[0196] Step S340: The scheduling system obtains the idle type set corresponding to the idle server and determines the task type corresponding to the task to be processed. If the idle type set contains the task type, the task to be processed is assigned to the target server corresponding to the idle type set, and then steps S342 and S344 are executed.
[0197] Step S342: The target server determines at least one processing stage corresponding to the task to be processed and the stage processing time corresponding to each processing stage; if it is detected that there is a target processing stage that exceeds the corresponding stage processing time, the execution process is exited, and a third request is sent to the management system to instruct the target server to update its corresponding working status to an idle state.
[0198] Step S344: The management system updates the heartbeat time threshold corresponding to the target server, obtains the heartbeat information of the target server according to the unit time, and if the heartbeat information is greater than the heartbeat time threshold, updates the working status from the busy status to the abnormal status, and synchronizes the abnormal status corresponding to the target server to the scheduling system.
[0199] It should be noted that steps S300 to S344 are Figure 2 The steps and their embodiments shown correspond to each other. For the specific implementation of steps S300 to S344, please refer to Figure 2 The steps and embodiments shown are not described in detail here.
[0200] In addition, it should be noted that steps S300 to S344 are Figure 3 The order in the figure is only shown as an example. In practical applications, the present application does not limit the execution order of each step in step S300 to step S344.
[0201] It can be seen that in Figure 3 In the example, different servers correspond to the type sets that are compatible with them. When receiving a task to be processed, the type set that is compatible with it can be matched based on the task type of the task to be processed, and the task to be processed can be assigned to the server corresponding to the type set to solve the problem of resource waste caused by scheduling tasks only according to the busyness of the server. The idle server can be determined first, and then the dedicated server can be made to process the corresponding task according to the type matching method, which can improve the resource utilization rate and avoid resource waste. In addition, the matching degree between the server and the task can be improved to avoid assigning tasks to irrelevant servers, and it can also avoid assigning too many tasks to the same server, resulting in too many tasks piling up and leading to untimely task processing, which is conducive to improving the processing efficiency of tasks.
[0202] See also Figure 4 , Figure 4 The structure diagram of the task scheduling system according to an embodiment of the present application is schematically shown. Figure 4As shown, the task scheduling system includes: a rendering task scheduling platform 410, an external platform 420, a user terminal 430, an initiation system 440, a file storage system 450, and a server cluster 460. The initiation system 440 includes: a design tool 441 and a model plug-in 442. The server cluster 460 includes: servers 461, ..., servers 462, and servers 463. The rendering task scheduling platform 410 includes: a message middleware (rabbitMq) 411, a scheduling system 412, a management system 413, a cache (Redis) 414, and a database (Mysql) 415. Among them, the message middleware (rabbitMq) 411 includes: task information 4111, task queue 4112; the cache (Redis) 414 includes: task ordered set (zest) 4141, task status parameters 4142, heartbeat information 4143, distributed lock (Redisson) 4144, working status 4145; the database (Mysql) 415 includes: task (TASK) 4151, rendering function (RENDER_MACHINE) 4152, task execution result (TASK_RESULT) 4153.
[0203] Specifically, the user can initiate a task to be processed to the scheduling system 412 based on the initiation system 440; wherein the user can generate a task to be rendered based on the design tool 441 and the model plug-in 442. The user can also store files related to the task to be rendered based on the file storage system 450, and the file type can be any type (such as OSS), which is not limited in the embodiment of the present application.
[0204] In addition, the scheduling system 412 can determine the idle servers in the idle state according to the working status corresponding to each server in the server cluster 460 (i.e., server 461, ..., server 462, server 463), and obtain the type set corresponding to each idle server to obtain multiple type sets, and then determine the task type corresponding to the task to be processed, and determine the target type set containing the task type from the multiple type sets, and then send the task processing instruction corresponding to the task to be processed to the target server corresponding to the target type set, and the target server can determine the task to be processed from the task queue 4112 of the message middleware (rabbitMq) 411 based on the task position in the task processing instruction. In addition, the message middleware (rabbitMq) 411 can also include task information 4111 to record the information of the task to be processed.
[0205] Among them, the target server can also determine at least one processing stage corresponding to the task to be processed and the stage processing time corresponding to each processing stage; if it is detected that there is a target processing stage that exceeds the corresponding stage processing time, the execution process is exited, and a third request is sent to the management system to instruct the management system to update the corresponding working status of the target server to an idle state.
[0206] In the above processing process, the management system 413 is used to save the registration information for the new server when receiving the registration information, and configure the heartbeat time threshold corresponding to the new server and store it in the cache (Redis) 414; update the heartbeat time threshold corresponding to the target server, and obtain the heartbeat information of the target server according to the unit time. If the heartbeat information is greater than the heartbeat time threshold, the working status is updated from the busy status to the abnormal status, and the abnormal status corresponding to the target server is synchronized to the scheduling system 412.
[0207] In addition, the scheduling system 412 is also used to generate a priority identifier corresponding to the pending task according to the task reception time corresponding to the pending task and the preset priority of the pending task when receiving the pending task, and the scheduling system 412 determines the state parameter corresponding to the pending task. If the state parameter is used to indicate that the pending task is a task processed for the first time, the task information corresponding to the pending task and the task state characterizing that the pending task is in an unprocessed state are stored. If the state parameter is used to indicate that the pending task is not a task processed for the first time, the task state corresponding to the pending task is updated from a processed state to an unprocessed state. The pending task is added to the first specific position of the task queue 4112 according to the priority identifier.
[0208] And, after the scheduling system 412 allocates the pending task to the target server corresponding to the target type set, if the allocation is successful, the target server is monitored for timeout according to the preset time; if it is monitored that the processing time of the pending task by the target server is greater than or equal to the preset time, the processing result corresponding to the pending task is obtained from the target server; if the processing result is obtained within the preset acquisition times, the task state corresponding to the pending task is updated from the unprocessed state to the processed state; if the processing result is not obtained within the preset acquisition times, the pending task is determined to be abnormal, and a prompt message indicating that the pending task is abnormal is returned to the user terminal 430. If the allocation fails, a second request for indicating that the working state is updated from the busy state to the idle state is sent to the management system 413, and the pending task is re-added to the task queue 4112 according to the priority identifier; wherein the management system 413 is used to update the working state from the busy state to the idle state.
[0209] Furthermore, the scheduling system 412 can receive the processing result corresponding to the pending task returned by the target server. If the processing result is used to indicate that the task processing is successful, the task status corresponding to the pending task is updated from the unprocessed status to the processed status, and a first request for indicating that the working status is updated from the busy status to the idle status is sent to the management system 413; wherein the management system 413 is used to update the working status from the busy status to the idle status. If the processing result is used to indicate that the task processing fails, the number of task failures corresponding to the pending task is determined. If the number of task failures is greater than or equal to the preset number, the scheduling system 412 sends a prompt message to the management system 413 for indicating that the working status of the target server is updated from the busy status to the abnormal status, and returns a prompt message to the user terminal 430 for indicating that the pending task is abnormal; if the number of task failures is less than the preset number, the scheduling system 412 updates the number of task failures and re-adds the pending task to the second specific position of the task queue 4112 according to the priority identifier.
[0210] In addition, when receiving the offline prompt information, the scheduling system 412 can determine the designated server corresponding to the offline prompt information, and then determine the current task corresponding to the designated server, and add the current task to the third specific position of the task queue 4112 according to the specific priority identifier corresponding to the current task.
[0211] In addition, cache (Redis) 414 is also used to store task ordered sets (zest) 4141 to record tasks that need to be processed; cache (Redis) 414 also includes distributed locks (Redisson) 4144 to support distributed server clusters 460; cache (Redis) 414 also includes working status 4145 to record the latest status of the target server; cache (Redis) 414 also includes task status parameters to record the processing status of the task.
[0212] In addition, the database (Mysql) 415 is used to store various tasks (TASK) 4151, as well as rendering functions (RENDER_MACHINE) 4152 and task execution results (TASK_RESULT) 4153 for subsequent calls.
[0213] It can be seen that in Figure 4In the example, different servers correspond to the type sets that are compatible with them. When receiving a task to be processed, the type set that is compatible with it can be matched based on the task type of the task to be processed, and the task to be processed can be assigned to the server corresponding to the type set to solve the problem of resource waste caused by scheduling tasks only according to the busyness of the server. The idle server can be determined first, and then the dedicated server can be made to process the corresponding task according to the type matching method, which can improve the resource utilization rate and avoid resource waste. In addition, the matching degree between the server and the task can be improved to avoid assigning tasks to irrelevant servers, and it can also avoid assigning too many tasks to the same server, resulting in too many tasks piling up and leading to untimely task processing, which is conducive to improving the processing efficiency of tasks.
[0214] Furthermore, in this exemplary embodiment, a task scheduling device is also provided. Figure 5 As shown, the task scheduling device 500 may include: a server determination unit 501, a type determination unit 502, and a task allocation unit 503, wherein:
[0215] The server determination unit 501 is used to determine an idle server in an idle state according to the working status corresponding to each server;
[0216] A type determination unit 502 is configured to obtain a type set corresponding to each idle server if the number of idle servers is greater than 1, thereby obtaining multiple type sets;
[0217] The type determination unit 502 is further used to determine the task type corresponding to the task to be processed, and determine a target type set including the task type from multiple type sets;
[0218] The task allocation unit 503 is used to allocate the tasks to be processed to the target servers corresponding to the target type set.
[0219] It can be seen that in Figure 5 In the example, different servers correspond to the type sets that are compatible with them. When receiving a task to be processed, the type set that is compatible with it can be matched based on the task type of the task to be processed, and the task to be processed can be assigned to the server corresponding to the type set to solve the problem of resource waste caused by scheduling tasks only according to the busyness of the server. The idle server can be determined first, and then the dedicated server can be made to process the corresponding task according to the type matching method, which can improve the resource utilization rate and avoid resource waste. In addition, the matching degree between the server and the task can be improved to avoid assigning tasks to irrelevant servers, and it can also avoid assigning too many tasks to the same server, resulting in too many tasks piling up and leading to untimely task processing, which is conducive to improving the processing efficiency of tasks.
[0220] In an exemplary embodiment of the present application, if the number of idle servers is equal to 1, the above-mentioned device further includes:
[0221] A type set acquisition unit, used to acquire an idle type set corresponding to an idle server;
[0222] The server determination unit 501 is further used to determine the task type corresponding to the to-be-processed task, and if the idle type set includes the task type, the to-be-processed task is allocated to a target server corresponding to the idle type set.
[0223] It can be seen that by implementing this optional embodiment, different scheduling methods can be disclosed when the number of idle servers is one or more, so that the present application can cope with more diverse application scenarios and improve the robustness of the technical solution of the present application.
[0224] In an exemplary embodiment of the present application, the type determination unit 502 determines a target type set including a task type from a plurality of type sets, including:
[0225] Determine a candidate type set including the task type from multiple type sets;
[0226] If the number of the candidate type sets is equal to 1, the candidate type set is determined as the target type set;
[0227] If the number of the candidate type sets is greater than 1, a target type set is selected from the candidate type sets according to a preset selection rule.
[0228] It can be seen that by implementing this optional embodiment, when the number of the to-be-selected type sets is one or more, a corresponding target type set can be determined to allocate the tasks to be processed to the target server corresponding to the target type set, which is beneficial to improving the utilization of server resources.
[0229] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0230] The working status update unit is used to receive the new working status of a specific server reported by the management system before the server determination unit 501 determines the idle server in the idle state according to the working status corresponding to each server, and update the current working status of the specific server according to the new working status; wherein the specific server is any server among the servers.
[0231] It can be seen that by implementing this optional embodiment, the working status of the server can be received by the management system in a timely manner, so that when a task to be processed is received, the accurate idle server can be determined in time, which is conducive to improving the scheduling efficiency of the task, and further conducive to improving the task processing efficiency.
[0232] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0233] A priority identification determination unit, configured to generate a priority identification corresponding to the task to be processed according to a task reception time corresponding to the task to be processed and a preset priority of the task to be processed when receiving the task to be processed;
[0234] The task adding unit is used to add the to-be-processed task to the first specific position of the task queue according to the priority identifier.
[0235] It can be seen that by implementing this optional embodiment, a priority identifier corresponding to the task to be processed can be generated according to the task reception time of the task to be processed and the preset priority of the task to be processed, and then the task to be processed can be added to the task queue based on the priority identifier, thereby realizing personalized setting of the priority identifier and thus realizing accurate determination of the priority of the task to be processed.
[0236] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0237] A parameter determination unit, used for determining a state parameter corresponding to the task to be processed before the task adding unit adds the task to be processed to the first specific position of the task queue according to the priority identifier;
[0238] An information storage unit, used for storing task information corresponding to the task to be processed and a task status indicating that the task to be processed is in an unprocessed state when the status parameter is used to indicate that the task to be processed is a task to be processed for the first time;
[0239] The processing status updating unit is used to update the task status corresponding to the task to be processed from a processed status to an unprocessed status when the status parameter is used to indicate that the task to be processed is not a task to be processed for the first time.
[0240] It can be seen that by implementing this optional embodiment, it is possible to distinguish whether a task is being processed for the first time based on the status parameters, thereby realizing the storage of task information corresponding to the task to be processed and the task status representing that the task to be processed is in an unprocessed state, or updating the task status corresponding to the task to be processed from a processed state to an unprocessed state, thereby realizing accurate recording of the task processing cycle and avoiding misprocessing of the task.
[0241] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0242] A request sending unit, configured to receive a processing result corresponding to the task to be processed returned by the target server if the assignment is successful after the task dispatching unit 503 assigns the task to be processed to the target server corresponding to the target type set, and to send a first request to the management system for instructing to update the working state from the busy state to the idle state; wherein the management system is configured to update the working state from the busy state to the idle state;
[0243] The request sending unit is also used to send a second request to the management system to instruct the working status to be updated from a busy state to an idle state if the allocation fails, and to add the pending task back to the task queue according to the priority identifier; wherein the management system is used to update the working status from a busy state to an idle state.
[0244] It can be seen that by implementing this optional embodiment, the working status of the server is updated in time according to the task allocation situation, so as to improve the utilization rate of the server resources.
[0245] In an exemplary embodiment of the present application, the management system is further used to update the heartbeat time threshold corresponding to the target server after updating the working state from the busy state to the idle state;
[0246] The management system is also used to obtain the heartbeat information of the target server according to the unit time. If the heartbeat information is greater than the heartbeat time threshold, the working state is updated from the busy state to the abnormal state, and the abnormal state corresponding to the target server is synchronized to the scheduling system.
[0247] It can be seen that by implementing this optional embodiment, the server can be monitored through the management system, so as to promptly detect abnormal servers based on the comparison of heartbeat information and heartbeat time thresholds, and promptly update the working status of the server to avoid tasks not being processed in time, thereby improving the processing efficiency of tasks.
[0248] In an exemplary embodiment of the present application, the management system is further used to save the registration information and configure a heartbeat time threshold corresponding to the new server when the registration information for the new server is received.
[0249] It can be seen that by implementing this optional embodiment, new servers can be added through registration information to achieve horizontal expansion of servers, making it convenient for relevant personnel to increase or decrease servers in real time based on demand to cope with tasks of different magnitudes.
[0250] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0251] The processing status update unit is also used to receive the processing result corresponding to the task to be processed returned by the target server after the task allocation unit 503 assigns the task to be processed to the target server corresponding to the target type set; if the processing result is used to indicate that the task processing is successful, the task status corresponding to the task to be processed is updated from the unprocessed state to the processed state.
[0252] It can be seen that by implementing this optional embodiment, the processing status of the task can be updated in time when the task is successfully processed, thereby avoiding the task from being assigned again.
[0253] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0254] a failure count determination unit, configured to determine the task failure count corresponding to the task to be processed after the processing status update unit receives the processing result corresponding to the task to be processed returned by the target server, if the processing result indicates that the task processing has failed;
[0255] A message reminder unit, used for sending a reminder message for instructing the management system to update the working state of the target server from a busy state to an abnormal state when the number of task failures is greater than or equal to a preset number, and returning a reminder message for indicating that the task to be processed is abnormal to the user end;
[0256] The task adding unit is further used to update the number of task failures and re-add the to-be-processed task to the second specific position of the task queue according to the priority identifier when the number of task failures is less than a preset number.
[0257] It can be seen that by implementing this optional embodiment, compensation retries can be automatically performed when a task fails, thereby improving the success rate and automation level of rendering tasks.
[0258] In an exemplary embodiment of the present application, wherein:
[0259] The server determination unit 501 is further configured to determine the designated server corresponding to the offline prompt information when receiving the offline prompt information; wherein the designated server is any server among the servers;
[0260] The task adding unit is further used to determine the current task corresponding to the designated server, and add the current task to the third specific position of the task queue according to the specific priority identifier corresponding to the current task.
[0261] It can be seen that by implementing this optional embodiment, when task processing fails, the unprocessed tasks of the server can be added back to the task queue to avoid missing tasks. At the same time, the task processing efficiency can be improved by adding tasks in a timely manner.
[0262] In an exemplary embodiment of the present application, the above-mentioned device further includes:
[0263] A timeout monitoring unit is used to perform timeout monitoring on a target server according to a preset time length; if it is monitored that the processing time of a task to be processed by the target server is greater than or equal to the preset time length, the processing result corresponding to the task to be processed is obtained from the target server; if the processing result is obtained within a preset number of acquisitions, the task status corresponding to the task to be processed is updated from an unprocessed state to a processed state; if the processing result is not obtained within the preset number of acquisitions, the task to be processed is determined to be abnormal, and a prompt message indicating the abnormality of the task to be processed is returned to the user end.
[0264] It can be seen that the implementation of this optional embodiment can realize timeout monitoring of the target server. It can be understood that the present application can not only realize the target server to monitor itself, but also realize monitoring based on the scheduling system and management system, thereby improving the monitoring intensity, and can realize timely update of the server working status, thereby improving the utilization rate of server resources.
[0265] In an exemplary embodiment of the present application, the target server is used to determine at least one processing stage corresponding to the task to be processed and the stage processing time corresponding to each processing stage; if it is detected that there is a target processing stage that exceeds the corresponding stage processing time, the execution process is exited, and a third request is sent to the management system to instruct the target server to update its corresponding working state to an idle state.
[0266] It can be seen that the implementation of this optional embodiment can not only enable the target server to monitor itself, but also realize monitoring based on the scheduling system and management system, thereby improving the monitoring intensity, realizing timely updating of the server working status, and thus improving the utilization rate of server resources.
[0267] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0268] Since the various functional modules of the task scheduling device of the example embodiment of the present application correspond to the steps of the example embodiment of the task scheduling method described above, for details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the task scheduling method described above in the present application.
[0269] See also Figure 6 , Figure 6A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0270] It should be noted that Figure 6 The computer system 600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0271] like Figure 6 As shown, computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. Various programs and data required for system operation are also stored in RAM 603. CPU 601, ROM 602 and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to bus 604.
[0272] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0273] In particular, according to an embodiment of the present application, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 609, and / or installed from a removable medium 611. When the computer program is executed by a central processing unit (CPU) 601, various functions defined in the method and apparatus of the present application are executed.
[0274] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0275] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0276] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0277] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0278] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0279] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A task scheduling method, characterized in that: include: Determine an idle server in an idle state according to the working status corresponding to each server; If the number of the idle servers is greater than 1, obtaining a type set corresponding to each of the idle servers to obtain multiple type sets; Determine a task type corresponding to the task to be processed, and determine a target type set including the task type from the multiple type sets; Allocating the tasks to be processed to the target servers corresponding to the target type set; Wherein, the method further comprises: When receiving the task to be processed, obtaining the task receiving time corresponding to the task to be processed and the preset priority of the task to be processed; Normalizing the task receiving time and the preset priority to obtain a time parameter and a priority parameter; Substituting the time parameter and the priority parameter into a preset expression to calculate the priority identifier of the task to be processed; Adding the to-be-processed task to a first specific position of a task queue according to the priority identifier includes: determining an identifier of a designated task that is greater than the priority identifier and adjacent to the task queue, determining a position corresponding to the designated task as the first specific position, and updating positions of other tasks whose identifiers are greater than the priority identifier in the task queue; Before adding the to-be-processed task to the first specific position of the task queue according to the priority identifier, the method further includes: Determine the state parameter corresponding to the task to be processed; If the state parameter is used to indicate that the to-be-processed task is a task being processed for the first time, then storing the task information corresponding to the to-be-processed task and the task state indicating that the to-be-processed task is in an unprocessed state; If the state parameter is used to indicate that the to-be-processed task is not a task to be processed for the first time, then the task state corresponding to the to-be-processed task is updated from a processed state to an unprocessed state; After allocating the to-be-processed tasks to the target servers corresponding to the target type set, the method further includes: If the allocation is successful, receiving the processing result corresponding to the to-be-processed task returned by the target server, and sending a first request for instructing to update the working state from the busy state to the idle state to the management system; wherein the management system is used to update the working state from the busy state to the idle state; If the allocation fails, a second request is sent to the management system for instructing to update the working state from the busy state to the idle state, and the to-be-processed task is re-added to the task queue according to the priority identifier; wherein the management system is used to update the working state from the busy state to the idle state; Wherein, the method further comprises: Performing timeout monitoring on the target server according to a preset time length; If it is monitored that the processing time of the target server for the task to be processed is greater than or equal to the preset time, obtaining the processing result corresponding to the task to be processed from the target server; If the processing result is obtained within the preset number of acquisition times, the task status corresponding to the to-be-processed task is updated from an unprocessed state to a processed state; If the processing result is not obtained within the preset number of acquisition times, it is determined that the task to be processed is abnormal, and prompt information indicating that the task to be processed is abnormal is returned to the user terminal; Among them, the target server is used to determine at least one processing stage corresponding to the task to be processed and the stage processing time corresponding to each processing stage; if it is detected that there is a target processing stage that exceeds the corresponding stage processing time, the execution process is exited, and a third request is sent to the management system to instruct the working status corresponding to the target server to be updated to an idle state.
2. The method according to claim 1, characterized in that: If the number of idle servers is equal to 1, the method further includes: Obtain an idle type set corresponding to the idle server; Determine the task type corresponding to the to-be-processed task, and if the idle type set includes the task type, allocate the to-be-processed task to the target server corresponding to the idle type set.
3. The method according to claim 1, characterized in that Determining a target type set including the task type from the multiple type sets includes: Determine a to-be-selected type set including the task type from the multiple type sets; If the number of the to-be-selected type sets is equal to 1, the to-be-selected type sets are determined as the target type sets; If the number of the to-be-selected type sets is greater than 1, a target type set is selected from the to-be-selected type sets according to a preset selection rule.
4. The method according to claim 1, characterized in that: Before determining the idle server in the idle state according to the working status corresponding to each server, the method further includes: A new working state of a specific server reported by a management system is received, and a current working state of the specific server is updated according to the new working state; wherein the specific server is any server among the servers.
5. The method according to claim 1, characterized in that The management system is further configured to update a heartbeat time threshold corresponding to the target server after the working state is updated from the busy state to the idle state; The management system is also used to obtain the heartbeat information of the target server according to the unit time length. If the heartbeat information is greater than the heartbeat time threshold, the working state is updated from the busy state to the abnormal state, and the abnormal state corresponding to the target server is synchronized to the scheduling system.
6. The method according to claim 1, characterized in that The management system is used to save the registration information for the new server when receiving the registration information, and configure the heartbeat time threshold corresponding to the new server.
7. The method according to claim 1, characterized in that After allocating the to-be-processed tasks to the target servers corresponding to the target type set, the method further includes: Receiving a processing result corresponding to the task to be processed returned by the target server; If the processing result is used to indicate that the task processing is successful, the task status corresponding to the to-be-processed task is updated from the unprocessed status to the processed status.
8. The method according to claim 7, characterized in that After receiving the processing result corresponding to the task to be processed returned by the target server, the method further includes: If the processing result indicates that the task processing has failed, determining the number of task failures corresponding to the task to be processed; If the number of task failures is greater than or equal to the preset number, a prompt message indicating that the working state of the target server is updated from the busy state to the abnormal state is sent to the management system, and a prompt message indicating that the task to be processed is abnormal is returned to the user terminal; If the number of task failures is less than the preset number, the number of task failures is updated and the to-be-processed task is re-added to the second specific position of the task queue according to the priority identifier.
9. The method according to claim 1, characterized in that: The method further comprises: When receiving offline prompt information, determining a designated server corresponding to the offline prompt information; wherein the designated server is any server among the servers; The current task corresponding to the designated server is determined, and the current task is added to a third specific position of the task queue according to a specific priority identifier corresponding to the current task.
10. A task scheduling device, characterized in that: include: A server determination unit, used to determine an idle server in an idle state according to the working status corresponding to each server; a type determination unit, configured to obtain a type set corresponding to each of the idle servers if the number of the idle servers is greater than 1, to obtain a plurality of type sets; The type determination unit is further used to determine the task type corresponding to the task to be processed, and determine a target type set including the task type from the multiple type sets; A task allocation unit, used to allocate the to-be-processed tasks to the target servers corresponding to the target type set; Wherein, the device further comprises: A priority identification determination unit is used to obtain, when receiving the task to be processed, a task reception time corresponding to the task to be processed and a preset priority of the task to be processed; normalize the task reception time and the preset priority to obtain a time parameter and a priority parameter; substitute the time parameter and the priority parameter into a preset expression to calculate the priority identification of the task to be processed; A task adding unit, used for adding the to-be-processed task to the first specific position of the task queue according to the priority identifier, comprising: a task adding unit, used for determining from the task queue an identifier of a designated task that is greater than the priority identifier and adjacent to the task queue, determining the position corresponding to the designated task as the first specific position, and updating the positions of other tasks whose identifiers are greater than the priority identifier in the task queue; Wherein, the device further comprises: a parameter determination unit, configured to determine a state parameter corresponding to the task to be processed before the task adding unit adds the task to be processed to the first specific position of the task queue according to the priority identifier; An information storage unit, configured to store task information corresponding to the task to be processed and a task status indicating that the task to be processed is in an unprocessed state if the status parameter indicates that the task to be processed is a task to be processed for the first time; a processing status updating unit, configured to update the task status corresponding to the task to be processed from a processed status to an unprocessed status if the status parameter is used to indicate that the task to be processed is not a task to be processed for the first time; Wherein, the device further comprises: A request sending unit, used for receiving the processing result corresponding to the task to be processed returned by the target server if the allocation is successful after the task allocation unit allocates the task to be processed to the target server corresponding to the target type set, and sending a first request to the management system for instructing to update the working state from the busy state to the idle state; wherein the management system is used to update the working state from the busy state to the idle state; The request sending unit is further used for sending a second request for instructing to update the working state from the busy state to the idle state to the management system if the allocation fails, and re-adding the to-be-processed task to the task queue according to the priority identifier; wherein the management system is used for updating the working state from the busy state to the idle state; Wherein, the device further comprises: A timeout monitoring unit is used to perform timeout monitoring on the target server according to a preset time length; if it is monitored that the processing time length of the target server for the task to be processed is greater than or equal to the preset time length, then obtain the processing result corresponding to the task to be processed from the target server; if the processing result is obtained within a preset number of acquisitions, then the task state corresponding to the task to be processed is updated from an unprocessed state to a processed state; if the processing result is not obtained within the preset number of acquisitions, then it is determined that the task to be processed is abnormal, and a prompt message indicating that the task to be processed is abnormal is returned to the user end; Among them, the target server is used to determine at least one processing stage corresponding to the task to be processed and the stage processing time corresponding to each processing stage; if it is detected that there is a target processing stage that exceeds the corresponding stage processing time, the execution process is exited, and a third request is sent to the management system to instruct the working status corresponding to the target server to be updated to an idle state.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
12. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 9 by executing the executable instructions.
Citation Information
Patent Citations
Task scheduling method, apparatus and system
CN107016480A
Task distribution method and device
CN107968836A
Server scheduling method and device, and server
CN112162865A
Task scheduling method and device, computer equipment and computer readable storage medium
CN113986534A
Load balancing method and device for batch tasks and computer equipment
CN114048033A