Task scheduling method and device, storage medium and electronic equipment
By determining and utilizing the execution results of upstream nodes to assign parameters to the current node, the problem of inflexible node scheduling in the task scheduling system is solved, and flexible configuration and execution of task scheduling are realized.
Patent Information
- Application Number
- CN202110846869.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-26
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2041-07-26
AI Technical Summary
The existing task scheduling system cannot be flexibly adjusted, and there is a lack of connection between the various nodes, resulting in the inability to flexibly configure task scheduling.
By determining the list of upstream nodes of the current node, the execution results of the upstream nodes are used to assign values to the execution parameters of the current node. The current node is then scheduled to execute subtasks according to the assigned parameters. The successful execution of key upstream nodes indicates whether the current node meets the scheduling conditions.
It enables flexible configuration of node scheduling, improves the flexibility of task scheduling and execution, and solves the problem of inflexible task scheduling.
Smart Images

Figure CN113504981B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of big data, and in particular, to a task scheduling method and device, a storage medium and an electronic device. BACKGROUND
[0002] With the application of big data technology, in the face of massive data task scheduling, a task scheduling system supporting different types of upper-layer technology or business is the key to flexible and rapid task orchestration.
[0003] However, the current task scheduling system usually only supports setting fixed parameters before the entire task flow, and can only use preset fixed parameters during task scheduling, and cannot flexibly adjust the parameters during execution. Meanwhile, there is no association between nodes in execution, so that the task scheduling cannot flexibly configure the nodes.
[0004] Currently, there is no effective solution to the above problems. SUMMARY
[0005] The embodiments of the present application provide a task scheduling method and device, a storage medium and an electronic device to at least solve the technical problem that task scheduling cannot be flexibly adjusted.
[0006] According to an aspect of the embodiments of the present application, a task scheduling method is provided, comprising: determining, from the scheduling logic of a target task, an upstream node list corresponding to a current node that is about to execute a current subtask, wherein the scheduling logic includes scheduling conditions and execution parameters of nodes corresponding to a plurality of subtasks in the target task, and the upstream node list includes upstream nodes located before the current node in the scheduling logic and directly connected to the current node; in the case that a key upstream node in the upstream node list meets the scheduling condition of the current node, using a node result corresponding to each upstream node in the upstream node list to assign values to the execution parameters in the current node, wherein the key upstream node is a node whose execution result indicates execution success, the node result includes an output result of the key upstream node and an assignment result of a non-key upstream node in the upstream node list; and scheduling the current node to execute the current subtask according to the execution parameters after being assigned values.
[0007] According to another aspect of the embodiments of the present application, a task scheduling apparatus is further provided, which comprises: a determining unit configured to determine, from scheduling logic of a target task, an upstream node list corresponding to a current node which is to execute a current subtask, wherein the scheduling logic comprises scheduling conditions and execution parameters for nodes corresponding to subtasks in the target task, and the upstream node list comprises upstream nodes which are located before the current node and directly connected to the current node in the scheduling logic; an assigning unit configured to assign execution parameters in the current node by using node results corresponding to each upstream node in the upstream node list, in a case that a key upstream node in the upstream node list meets the scheduling condition of the current node, wherein the key upstream node is a node whose execution result indicates success, and the node result comprises an output result of the key upstream node and assignment results of non-key upstream nodes in the upstream node list; and a scheduling unit configured to schedule the current node to execute the current subtask according to the assigned execution parameters.
[0008] According to still another aspect of the embodiments of the present application, a computer readable storage medium is further provided, which stores a computer program, wherein the computer program is configured to execute the task scheduling method when running.
[0009] According to still another aspect of the embodiments of the present application, an electronic device is further provided, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the task scheduling method by using the computer program.
[0010] In the embodiments of the present application, the scheduling condition of the current node is determined by the key upstream node in the upstream node list, the execution parameters of the current node are assigned by using the node results of the upstream nodes, and the current node is scheduled to execute the current subtask according to the assigned execution parameters, so that the scheduling condition of the current node is determined by the key upstream node whose execution result indicates success, the node results of the upstream nodes are used as the execution parameters of the current node, the technical effect that the scheduling condition of the node is flexibly configured, and the scheduling and execution of the current node are flexibly controlled by using the node results of the upstream nodes is achieved, and the technical problem that the task scheduling cannot be flexibly adjusted is solved. BRIEF DESCRIPTION OF DRAWINGS
[0011] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
[0012] Figure 1 is a schematic diagram of an application environment of an optional task scheduling method according to an embodiment of the application;
[0013] Figure 2 is a flowchart of an optional task scheduling method according to an embodiment of the application;
[0014] Figure 3 is a node diagram of an optional task scheduling method according to an embodiment of the application;
[0015] Figure 4 is a flowchart of an optional task scheduling method according to an embodiment of the application;
[0016] Figure 5 is a structural diagram of an optional task scheduling device according to an embodiment of the application;
[0017] Figure 6 is a structural diagram of an optional electronic device according to an embodiment of the application. DETAILED DESCRIPTION
[0018] In order to make the personnel in the art better understand the application scheme, the technical scheme in the embodiments of the application will be described clearly and completely below in conjunction with the drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, but not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor should belong to the protection scope of the application.
[0019] It should be noted that the terms "first", "second", and the like in the specification and claims of the application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.
[0020] According to an aspect of an embodiment of the present application, a task scheduling method is provided. Optionally, the task scheduling method can be applied to, but is not limited to, the environment as shown in Figure 1 The current node 102 interacts with the server 122 through the network 110 to perform scheduling of the current node 102 through the server 122. The server 122 runs a database 114 for data storage and a processing engine 116 for processing data in the database 114 to implement scheduling of the node by the server 122.
[0021] The steps S102 to S106 are not limited to be executed in sequence. The upstream node list is determined. From the scheduling logic of the target task, the upstream node list corresponding to the current node that is to execute the current subtask is determined. The scheduling logic includes scheduling conditions and execution parameters of nodes corresponding to respective subtasks in the target task, and the upstream node list includes upstream nodes that are located before the current node and directly connected to the current node in the scheduling logic. The node result is used to assign values to the execution parameters. In the case that a key upstream node in the upstream node list meets the scheduling condition of the current node, the node result of each upstream node in the upstream node list is used to assign values to the execution parameters in the current node, the key upstream node is a node whose execution result indicates success, and the node result includes an output result of the key upstream node and an assignment result of a non-key upstream node in the upstream node list. The current node is scheduled to execute the current subtask. The current node is scheduled to execute the current subtask according to the execution parameters after being assigned values.
[0022] Optionally, in the embodiment, the current node is not limited to be a terminal device that executes the current subtask, and can include but is not limited to at least one of the following: a mobile phone (such as an Android mobile phone, an IOS mobile phone, etc.), a notebook computer, a tablet computer, a palm computer, a MID (Mobile Internet Device), a PAD, a desktop computer, a smart television, etc. The network can include but is not limited to a wired network and a wireless network, wherein the wired network includes a local area network, a metropolitan area network and a wide area network, and the wireless network includes Bluetooth, WIFI and other wireless communication networks. The server can be a single server, a server cluster composed of multiple servers, or a cloud server. The above is only an example, and the embodiment is not limited in this regard.
[0023] As an optional implementation, as shown in Figure 2 The task scheduling method includes the following steps:
[0024] S202, from the scheduling logic of the target task, the upstream node list corresponding to the current node that is to execute the current subtask is determined.
[0025] In step S202, the scheduling logic includes scheduling conditions and execution parameters of each node corresponding to the sub-tasks in the target task, and the upstream node list includes upstream nodes before the current node and directly connected to the current node in the scheduling logic.
[0026] Optionally, the scheduling logic includes scheduling conditions and execution parameters of each node. The scheduling condition is used to indicate the condition of the node being scheduled to execute the sub-task, and the node can only be scheduled when the scheduling condition is met. The scheduling condition is not limited to being related to the execution result of the upstream node. The execution parameter is used to indicate the parameter required to be used by the node when being scheduled and executing the sub-task. The specific value of the execution parameter is not limited to being the node result of the upstream node.
[0027] Optionally, the upstream node list includes nodes directly connected to the current node and before the current node in the execution order in the scheduling logic. The execution order is used to indicate the order of the nodes included in the task according to the execution of the scheduling condition in sequence. The upstream nodes included in the upstream node list are the direct upstream nodes of the current node.
[0028] In step S204, when the key upstream node in the upstream node list meets the scheduling condition of the current node, the execution parameter of the current node is assigned by using the node result of each upstream node in the upstream node list.
[0029] In step S204, the key upstream node is the node whose execution result indicates that the execution is successful. The node result includes the output result of the key upstream node and the assignment result of the non-key upstream node in the upstream node list.
[0030] Optionally, the upstream nodes are divided into key upstream nodes and non-key upstream nodes according to the execution result. The upstream node whose execution result indicates that the execution is successful is the key upstream node, and the upstream node whose execution result indicates that the execution fails is the non-key upstream node. The execution result of each node being scheduled to execute the sub-task includes execution success and execution failure. The scheduling condition of the node is related to the key upstream node in the upstream node, allowing the existence of the non-key upstream node, while different scheduling conditions can be made for each node, making the scheduling condition of the node more flexible.
[0031] Optionally, in a case where the execution result indicates that the execution is successful, the subtask result obtained by the node corresponding to the execution subtask is taken as the output result. For example, in a case where the subtask is a resource amount calculation task, and the execution result indicates that the execution is successful and the resource amount calculation is completed, the specific resource amount calculated is taken as the output result. In a case where the node has the output result, the output result is taken as the node result. In a case where the execution result indicates that the execution fails, that is, the subtask execution fails, there is no output result, and the assignment result configured for the node is taken as the node result.
[0032] S206, scheduling the current node to execute the current subtask according to the execution parameter after the assignment.
[0033] Optionally, the execution parameter corresponding to the current node is assigned according to the node result of the upstream node, and a specific value of the execution parameter is obtained, so that the current node is scheduled according to the execution parameter after the assignment, that is, the execution parameter with the specific value, to execute the current subtask.
[0034] In the embodiments of the present application, the scheduling condition of the current node is determined through the key upstream nodes in the upstream nodes, the execution parameter of the current node is assigned according to the node result of the upstream node, and the current node is scheduled according to the execution parameter after the assignment to execute the current subtask. In a case where the scheduling condition of the current node is met, the scheduling condition of the current node is determined through the key upstream nodes, the execution parameter of the current node is assigned according to the node result of the upstream node, and the execution result of the key upstream node indicating the successful execution is used to determine whether the scheduling condition of the current node is met, the node result of the upstream node is used as the execution parameter of the current node, so that the scheduling condition of the node is flexibly configured, and the scheduling and execution of the current node are flexibly controlled by using the node result of the upstream node. Technical effects are achieved.
[0035] As an optional implementation, before the execution parameter of the current node is assigned by using the node result corresponding to each upstream node in the upstream node list, in a case where the number of the key upstream nodes is greater than a first threshold value, it is determined that the execution result of the key upstream node meets the scheduling condition of the current node.
[0036] Optionally, the scheduling condition of the current node is not limited to the number of the key upstream nodes being greater than the first threshold value. In a case where the number of the upstream nodes whose execution result indicates the successful execution is greater than the first threshold value, it is determined that the scheduling condition of the current node is met.
[0037] Optionally, the first threshold value of different nodes can be different, and different first threshold values are configured for different nodes, so that the execution of the node is no longer limited to that the current node can be scheduled only when all the upstream nodes are successfully executed, and the scheduling of the current node can be implemented as long as the number of nodes successfully executed in the upstream nodes exceeds the first threshold value, thereby increasing the flexibility of node scheduling.
[0038] It should be noted that the specific value of the first threshold value is not limited herein and is set according to the specific circumstances of each node.
[0039] For example, the node relationship shown in FIG. 1 is taken as an example. It is assumed that the target task includes the four nodes shown in the figure, which are n1, n2, n3 and n4, wherein n1 is an upstream node of n2 and n3, and n1, n2 and n3 are upstream nodes of n4. In the case that the scheduling condition of n4 is that the number of key upstream nodes is greater than 1, as long as the execution result of two nodes in n1, n2 and n3 indicates successful execution, the scheduling condition of n4 is reached. In this way, even if there is a node in n1, n2 and n3 whose execution result indicates that the execution fails, the scheduling condition of n4 is still met, and n4 can still be scheduled to execute the corresponding subtask. Figure 3 In the embodiment of the present application, the number of key nodes in the upstream nodes is used as the scheduling condition of the current node, so that even if there is a node that fails to execute in the upstream nodes, as long as the scheduling condition of the current node is met, the current node can still be scheduled, thereby improving the scheduling flexibility of the current node.
[0040] As an optional implementation, before the execution result of each upstream node in the upstream node list is used to assign the execution parameter in the current node, it is further determined that the execution result of the key upstream node meets the scheduling condition of the current node when the node proportion of the key upstream node in the upstream node list is greater than a second threshold value.
[0041] Optionally, the scheduling condition of the current node is not limited to that the node proportion of the key upstream node is greater than the second threshold value. In the case that the node proportion of the execution result of each upstream node in the upstream node list that indicates successful execution is greater than the second threshold value, it is determined that the scheduling condition of the current node is met.
[0042] Optionally, the second threshold value of different nodes can be different, and different second threshold values are configured for different nodes, so that the execution of the node is no longer limited to that the current node can be scheduled only when all the upstream nodes are successfully executed, and the scheduling of the current node can be implemented as long as the node proportion of the upstream nodes that are successfully executed exceeds the second threshold value, thereby increasing the flexibility of node scheduling.
[0043] Optionally, the second threshold value of different nodes can be different, and different second threshold values are configured for different nodes, so that the execution of the node is no longer limited to that the current node can be scheduled only when all the upstream nodes are successfully executed, and the scheduling of the current node can be implemented as long as the node proportion of the upstream nodes that are successfully executed exceeds the second threshold value, thereby increasing the flexibility of node scheduling.
[0044] It should be noted that the specific value of the second threshold is not limited here, and is not limited to setting a specific second threshold for each node.
[0045] The node relationship shown in the above Figure 3 For example, in the case where the scheduling condition of n4 is that the node ratio of the key upstream node is greater than 30%, as long as the execution result of one of n1, n2, and n3 indicates execution success, the scheduling condition of n4 is met. For example, the execution result of n1 indicates execution success, and the execution results of n2 and n3 both indicate execution failure. At this time, the node ratio of the key upstream node of n4 is 1 / 3=33%, which meets the scheduling condition, and n4 can be scheduled to execute the corresponding subtask. Or in the case where the execution result of n1 indicates execution success and the execution result of any one of n2 and n3 indicates execution success, the scheduling condition of n4 is also met, and n4 can be scheduled to execute the corresponding subtask.
[0046] In the embodiment of the present application, the node ratio of the key node in the upstream node is used as the scheduling condition of the current node, so that even if there is a node that fails to execute in the upstream node, as long as the scheduling condition of the current node is met, the current node can still be scheduled, thereby improving the scheduling flexibility of the current node.
[0047] As an optional implementation, before the execution result of each upstream node in the upstream node list is used to assign the execution parameter in the current node, in the case where the key upstream node includes a specific upstream node, it is determined that the execution result of the key upstream node meets the scheduling condition of the current node, where the specific upstream node is a preselected node.
[0048] Optionally, the scheduling condition of the current node is not limited to the case where the key upstream node includes a specific upstream node. In the case where the execution result of the specific upstream node in the upstream node list indicates execution success, it is determined that the scheduling condition of the current node is met.
[0049] Optionally, since the specific upstream nodes of different nodes are independent of each other, in the case where different nodes have a common upstream node, the specific upstream node can be the common upstream node or can not be the common upstream node. For the current node, as long as the execution result of the specific upstream node is execution success, the node can be scheduled, so that the execution of the node is no longer limited to the case where all upstream nodes execute successfully, thereby increasing the flexibility of node scheduling.
[0050] It should be noted that the specific upstream node is not limited to which upstream node.
[0051] The node relationship shown in the above Figure 3Take the node relationship shown in the figure as an example. If n4's scheduling condition requires that key upstream nodes include the specific upstream node n2, as long as n2's execution result indicates success, n4's scheduling condition is met. Even if n1 and n3 both indicate failure, as long as n4's specific upstream node n2's execution result indicates success, the scheduling condition is met and n4 can be scheduled to execute the corresponding subtask.
[0052] Optionally, the condition types of the scheduling conditions of multiple nodes included in the target task may be different, and the condition types include a quantity type indicating that the number of nodes of the key upstream nodes is greater than a first threshold, a ratio type indicating that the ratio of nodes of the key upstream nodes is greater than a second threshold, and a node type indicating that the key upstream nodes include specific upstream nodes.
[0053] by Figure 3 Taking the node relationship shown as an example, the scheduling condition type for n2 can be node type. For example, if n1 is set as a specific upstream node, n2 can be scheduled as long as n1 is successfully executed. The scheduling condition type for n3 can be quantity type, with the first threshold set to 0. As long as there is a successfully executed upstream node, n3 can be scheduled. The scheduling condition type for n4 can be ratio type, with the second threshold set to 30%. As long as the critical upstream node accounts for more than 30% of the upstream nodes, n4 can be scheduled.
[0054] In an embodiment of the present application, a specific upstream node among the upstream nodes is used as the scheduling condition of the current node, so that even if only the specific upstream node among the upstream nodes is executed successfully and the remaining nodes fail to execute, the scheduling condition of the current node can be met. As long as the scheduling condition of the current node is met, the current node can be scheduled, thereby improving the scheduling flexibility of the current node.
[0055] As an optional implementation manner, after scheduling the current node to execute the current subtask according to the assigned execution parameters, the following steps may be performed:
[0056] When the execution result of the current subtask executed by the current node indicates that the execution is successful, the output result obtained after the current node executes the current subtask is passed to the downstream node of the current node;
[0057] When the execution result of the current subtask executed by the current node indicates that the execution has failed, a reference assignment is determined from a pre-configured assignment list, and the reference assignment is passed to a downstream node of the current node.
[0058] Optionally, an execution result of a current subtask executed by the current node is taken as an execution result of the current node. In a case where the execution result of the current node indicates that the execution is successful, a task result obtained by executing the current subtask is taken as an output result, and the execution result and the output result are passed to a downstream node. The downstream node is a node located after the current node in the scheduling logic and directly connected to the current node.
[0059] Optionally, in a case where the execution result of the current node indicates that the execution fails, the execution result of the current subnode is passed to the downstream node. In a case where it is determined that the execution result of the current node indicates that the execution fails and the downstream node meets the scheduling condition, a reference assignment configured for the current node in the assignment list is obtained, and the reference assignment is passed to the downstream node.
[0060] Optionally, the assignment list stores node identifiers and reference assignments having an association relationship. The corresponding reference assignment is found through the node identifier, so as to assign a value to the node through the assignment list in a case where the node fails to execute, to avoid an impact on an execution parameter of a downstream node, and to ensure normal execution of the downstream node in a case where the downstream node is scheduled.
[0061] In the embodiments of the present application, the output result is passed to the downstream node in a case where the node executes successfully, and the reference assignment corresponding to the node is taken as a node result by obtaining the reference assignment from the assignment list in a case where the node fails to execute and the downstream node meets the scheduling condition and needs the node result, so as to ensure normal execution of each node in a case where the node is scheduled on the basis of flexible scheduling of the node.
[0062] As an optional implementation manner, as shown in FIG. 4, the above-mentioned assigning values to the execution parameter in the current node by using the node result of each upstream node corresponding to each execution parameter in the upstream node list includes: Figure 4
[0063] The upstream node list is traversed, each upstream node is sequentially taken as a current upstream node, and the following operations are performed:
[0064] S402, determining a current execution result of the current upstream node;
[0065] S404, in a case where the current execution result of the current upstream node indicates that the execution is successful, determining that the current upstream node is a key upstream node; in a case where the current upstream node is the key upstream node, obtaining a current output result of the current upstream node, and assigning values to the corresponding current execution parameter by using the current output result, wherein the execution parameter of the current node includes the current execution parameter;
[0066] S406, in a case where the current execution result of the current upstream node indicates that the execution fails, determining that the current upstream node is a non-critical upstream node; in a case where the current upstream node is a non-critical upstream node, searching for a current reference assignment configured for the current upstream node in the assignment list, and assigning a current execution parameter corresponding to the current reference assignment.
[0067] Optionally, the execution result and the node result of each upstream node included in the upstream node list of the current node are determined in sequence to determine whether the current node meets the scheduling condition and the execution parameter. In a case where the execution result of the upstream node indicates that the execution succeeds, the upstream node is determined as a critical upstream node, the task result obtained by executing the subtask is taken as the output result, and the output result is taken as the node result. In a case where the execution result of the upstream node indicates that the execution fails, the upstream node is determined as a non-critical upstream node, the reference assignment obtained from the assignment list is taken as the assignment result, and the assignment result is taken as the node result.
[0068] Optionally, in a case where the execution result and the node result of all the upstream nodes are obtained, the critical upstream nodes are counted, and whether the scheduling condition of the current node is met is determined according to the counting result of the critical upstream nodes.
[0069] In the embodiment of the present application, whether the scheduling condition of the current node is met is determined through the execution result of the upstream node, and the execution parameter of the current node is assigned by using the upstream node. The assignment manners of the upstream nodes with different execution results are different, which not only increases the flexibility of node scheduling, but also ensures that the current node can be scheduled to execute the subtask according to the assigned execution parameter when the scheduling condition is met.
[0070] As an optional implementation, the output result of the current node includes a task output and a related output, wherein the task output is an output value obtained by executing the current subtask, and the related output is an attribute value used to indicate the execution of the current subtask, and the attribute value includes an execution duration.
[0071] Optionally, the output result of the current node is not limited to including the task output and the related output. The task output is the task result obtained by executing the current subtask, that is, the task output value, for example, a resource quantity value. The related output is a value of an attribute parameter irrelevant to the task result but capable of indicating the execution of the current subtask, for example, a value corresponding to the execution duration, a value corresponding to the execution times, and the like.
[0072] Optionally, in the case that the execution parameter of the downstream node is a task parameter corresponding to the task output, the output value of the task output is used to assign the task parameter, and the downstream node is scheduled by using the task parameter with the specific value. In the case that the execution parameter of the downstream node is an attribute parameter corresponding to the related output, the attribute value of the related output is used to assign the attribute parameter, and the downstream node is scheduled by using the attribute parameter with the specific value.
[0073] Optionally, the assignment list stores reference assignments corresponding to the task output and the related output respectively. The execution parameter can include the task parameter and the attribute parameter.
[0074] In the embodiments of the present application, the output result of the node is divided into the task output and the related output, and the corresponding reference assignments are stored in the assignment list respectively, so that the specific assignment can be performed for different types of execution parameters in the downstream node, and the flexibility of the node scheduling is further improved through the type of the assignable execution parameter.
[0075] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all described as a series of action combinations, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other order or at the same time. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0076] According to another aspect of the embodiments of the present application, a task scheduling device for implementing the task scheduling method is also provided. As shown in Figure 5 the device includes:
[0077] The determining unit 502 is configured to determine, from the scheduling logic of the target task, an upstream node list corresponding to the current node that is to execute the current subtask, wherein the scheduling logic includes scheduling conditions and execution parameters for nodes corresponding to respective subtasks in the target task, and the upstream node list includes upstream nodes that are located before the current node and directly connected to the current node in the scheduling logic;
[0078] The assignment unit 504 is configured to, in the case that a key upstream node in the upstream node list meets the scheduling condition of the current node, assign execution parameters in the current node by using node results corresponding to respective upstream nodes in the upstream node list, wherein the key upstream node is a node whose execution result indicates execution success, and the node result includes an output result of the key upstream node and assignment results of non-key upstream nodes in the upstream node list.
[0079] The scheduling unit 506 is configured to schedule the current node to execute the current subtask according to the execution parameters after the assignment.
[0080] Optionally, the task scheduling apparatus further includes a first determination unit configured to determine that the execution result of the key upstream node meets the scheduling condition of the current node, before the execution parameters of the current node are assigned by using the node result of each upstream node in the upstream node list, in a case where the number of nodes of the key upstream node is greater than a first threshold.
[0081] Optionally, the task scheduling apparatus further includes a second determination unit configured to determine that the execution result of the key upstream node meets the scheduling condition of the current node, before the execution parameters of the current node are assigned by using the node result of each upstream node in the upstream node list, in a case where the node proportion of the key upstream node in the upstream node list is greater than a second threshold.
[0082] Optionally, the task scheduling apparatus further includes a third determination unit configured to determine that the execution result of the key upstream node meets the scheduling condition of the current node, before the execution parameters of the current node are assigned by using the node result of each upstream node in the upstream node list, in a case where the key upstream node includes a specific upstream node, wherein the specific upstream node is a preselected node.
[0083] Optionally, the task scheduling apparatus further includes a delivery unit configured to, after the current node is scheduled to execute the current subtask according to the execution parameters after the assignment, include:
[0084] A first delivery module configured to, in a case where the execution result of the current node in executing the current subtask indicates execution success, deliver an output result obtained after the current node executes the current subtask to a downstream node of the current node.
[0085] A second delivery module configured to, in a case where the execution result of the current node in executing the current subtask indicates execution failure, determine a reference assignment from a preconfigured assignment list, and deliver the reference assignment to a downstream node of the current node.
[0086] Optionally, the assignment unit 504 includes:
[0087] A traversal module configured to traverse the upstream node list, sequentially take each upstream node as a current upstream node, and perform the following operations:
[0088] A determination module configured to determine a current execution result of the current upstream node.
[0089] The output module is configured to determine that the current upstream node is a critical upstream node when the current execution result of the current upstream node indicates that the execution is successful; and to obtain a current output result of the current upstream node and assign a corresponding current execution parameter with the current output result when the current upstream node is the critical upstream node, wherein the execution parameter of the current node includes the current execution parameter.
[0090] The searching module is configured to determine that the current upstream node is a non-critical upstream node when the current execution result of the current upstream node indicates that the execution is failed; and to search for a current reference assignment configured for the current upstream node in the assignment list and assign a corresponding current execution parameter with the current reference assignment when the current upstream node is the non-critical upstream node.
[0091] Optionally, the output result of the current node in the task scheduling device includes a task output and a related output, wherein the task output is an output value obtained by executing a current subtask of the current node, and the related output is an attribute value used to indicate the execution of the current subtask, and the attribute value includes an execution duration.
[0092] In the embodiments of the present application, the scheduling condition of the current node is determined by determining an upstream node list of the current node, determining whether the scheduling condition of the current node is met according to a critical upstream node in the upstream node list, and assigning an execution parameter of the current node with a node result of the upstream node when the scheduling condition of the current node is met, and the current node is scheduled to execute a current subtask according to the assigned execution parameter. The scheduling condition of the current node is determined by the critical upstream node in the upstream node, and the execution parameter of the current node is assigned according to the node result of the upstream node. The technical effect is achieved that the scheduling condition of the current node is determined by the critical upstream node whose execution result indicates that the execution is successful, and the node result of the upstream node is used as the execution parameter of the current node, so that the scheduling condition of the node is flexibly configured, and the scheduling execution of the current node is flexibly controlled by using the node result of the upstream node. Therefore, the technical problem that the task scheduling cannot be flexibly adjusted is solved.
[0093] According to another aspect of the embodiments of the present application, an electronic device for implementing the above task scheduling method is also provided, which can be a terminal device or a server as shown in the drawings. Figure 1 The electronic device in the present embodiment is taken as a server for example. As shown in the drawings, the electronic device includes a memory 602 and a processor 604, the memory 602 stores a computer program, and the processor 604 is configured to execute the steps in any of the above method embodiments by using the computer program. Figure 6
[0094] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0095] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0096] S1, determining, from the scheduling logic of the target task, a list of upstream nodes corresponding to the current node that will execute the current subtask, wherein the scheduling logic includes scheduling conditions and execution parameters for nodes corresponding to each of the multiple subtasks in the target task, and the list of upstream nodes includes upstream nodes that are located before the current node in the scheduling logic and are directly connected to the current node;
[0097] S2, when the key upstream node in the upstream node list meets the scheduling conditions of the current node, using the node results corresponding to each upstream node in the upstream node list to assign values to the execution parameters in the current node, where the key upstream node is the node whose execution result indicates successful execution, and the node result includes the output result of the key upstream node and the assignment results of the non-key upstream nodes in the upstream node list;
[0098] S3, schedule the current node to execute the current subtask according to the assigned execution parameters.
[0099] Alternatively, those skilled in the art will appreciate that Figure 6 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an IOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 6 It does not limit the structure of the above electronic device. For example, the electronic device may also include Figure 6 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 6 Different configurations shown.
[0100] The memory 602 can be used to store software programs and modules, such as program instructions / modules corresponding to the task scheduling method and device in the embodiments of the present application. The processor 604 executes various functions and data processing by running the software programs and modules stored in the memory 602, that is, implements the task scheduling method described above. The memory 602 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 602 can further include a memory remotely arranged with respect to the processor 604, which can be connected to the terminal through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. Specifically, the memory 602 can be used to store, but is not limited to, upstream node list, scheduling conditions, execution parameters, and the like. As an example, as shown in Figure 6 The memory 602 can include, but is not limited to, the determination unit 502, the assignment unit 504, and the scheduling unit 506 in the task scheduling device described above. In addition, other module units in the task scheduling device described above can also be included, which will not be described in detail in this example.
[0101] Optionally, the transmission device 606 is used to receive or send data via a network. Specific examples of the above-mentioned network can include wired networks and wireless networks. In one example, the transmission device 606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers through a network cable to communicate with the Internet or a local area network. In one example, the transmission device 606 is a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.
[0102] In addition, the electronic device described above further includes a display 608 for displaying the upstream node list, and a connection bus 610 for connecting various module components in the electronic device.
[0103] In other embodiments, the terminal device or server described above can be a node in a distributed system, where the distributed system can be a blockchain system, which can be a distributed system formed by the plurality of nodes communicating through a network. Among them, the nodes can form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, a terminal, and other electronic devices, can become a node in the blockchain system by joining the peer-to-peer network.
[0104] According to an aspect of the present application, a computer program product or computer program is provided, which comprises computer instructions 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 to cause the computer device to perform the method provided in any of the various optional implementations of the task scheduling aspect. Wherein the computer program is configured to execute the steps in any of the method embodiments when executed.
[0105] Optionally, in the embodiment, the computer readable storage medium described above can be configured to store a computer program for executing the following steps:
[0106] S1, determining, from a scheduling logic of a target task, an upstream node list corresponding to a current node that is to execute a current subtask, wherein the scheduling logic comprises scheduling conditions and execution parameters for executing nodes corresponding to a plurality of subtasks in the target task, and the upstream node list comprises upstream nodes that are located before the current node and directly connected to the current node in the scheduling logic;
[0107] S2, in a case where a key upstream node in the upstream node list meets a scheduling condition of the current node, assigning values to execution parameters in the current node by using node results corresponding to each upstream node in the upstream node list, wherein the key upstream node is a node whose execution result indicates execution success, and the node result comprises an output result of the key upstream node and assignment results of non-key upstream nodes in the upstream node list;
[0108] S3, scheduling the current node to execute the current subtask according to the execution parameters after the assignment.
[0109] Optionally, in the embodiment, those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device by a program, and the program can be stored in a computer readable storage medium, and the storage medium can include a flash disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0110] The serial numbers of the above embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
[0111] The integrated units in the above embodiments, if implemented in the form of software function units and sold or used as independent products, can be stored in the above computer-readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions to make one or more computer devices (which can be personal computers, servers or network devices, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
[0112] In the above embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0113] In several embodiments provided in the present application, it should be understood that the disclosed client can be implemented by other ways. Among them, the above-described device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some interfaces, units or modules, and can be electrical or other forms.
[0114] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected to achieve the purpose of the embodiment according to actual needs.
[0115] In addition, each functional unit in each embodiment of the present application can be integrated in a processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software function unit.
[0116] The above is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.
Claims
1. A task scheduling method, characterized by, The method comprises the following steps: determining, from scheduling logic of a target task, a list of upstream nodes corresponding to a current node that is to execute a current subtask, wherein the scheduling logic comprises scheduling conditions and execution parameters for nodes corresponding to a plurality of subtasks in the target task, and the list of upstream nodes comprises a plurality of upstream nodes that are located before the current node in the scheduling logic and are directly connected to the current node; in a case where a key upstream node in the list of upstream nodes meets a scheduling condition of the current node, assigning values to execution parameters in the current node by using node results corresponding to each upstream node in the list of upstream nodes, wherein the key upstream node is a node whose execution result indicates execution success, and the node result comprises an output result of the key upstream node and assignment results of non-key upstream nodes in the list of upstream nodes; scheduling the current node to execute the current subtask according to the execution parameters after the values are assigned; before the step of assigning values to the execution parameters in the current node by using the node results corresponding to each upstream node in the list of upstream nodes, the method further comprises: in a case where a proportion of nodes occupied by the key upstream node in the list of upstream nodes is greater than a second threshold value, determining that an execution result corresponding to the key upstream node meets the scheduling condition of the current node; after the step of scheduling the current node to execute the current subtask according to the execution parameters after the values are assigned, the method further comprises: in a case where an execution result of the current node executing the current subtask indicates execution success, passing an output result obtained after the current node executes the current subtask to a downstream node of the current node; in a case where the execution result of the current node executing the current subtask indicates execution failure, determining a reference assignment from a preconfigured assignment list and passing the reference assignment to the downstream node of the current node.
2. The method of claim 1, wherein, before the step of assigning values to the execution parameters in the current node by using the node results corresponding to each upstream node in the list of upstream nodes, the method further comprises: in a case where a number of nodes of the key upstream node is greater than a first threshold value, determining that the execution result corresponding to the key upstream node meets the scheduling condition of the current node.
3. The method of claim 1, wherein, before the step of assigning values to the execution parameters in the current node by using the node results corresponding to each upstream node in the list of upstream nodes, the method further comprises: in a case where the key upstream node comprises a specific upstream node, determining that the execution result corresponding to the key upstream node meets the scheduling condition of the current node, wherein the specific upstream node is a preselected node.
4. The method of claim 1, wherein, the step of assigning values to the execution parameters in the current node by using the node results corresponding to each upstream node in the list of upstream nodes comprises: traversing the list of upstream nodes, taking each upstream node as a current upstream node in turn, and performing the following operations: determining a current execution result of the current upstream node; In a case where the current execution result of the current upstream node indicates successful execution, it is determined that the current upstream node is the critical upstream node; in a case where the current upstream node is the critical upstream node, a current output result of the current upstream node is obtained, and the current output result is used to assign a corresponding current execution parameter, wherein the execution parameter of the current node includes the current execution parameter; In a case where the current execution result of the current upstream node indicates failed execution, it is determined that the current upstream node is the non-critical upstream node; in a case where the current upstream node is the non-critical upstream node, a current reference assignment configured for the current upstream node is searched for in the assignment list, and a corresponding current execution parameter of the current reference assignment is used for assignment.
5. The method of any one of claims 1 to 4, characterized in that: The output result of the current node includes a task output and a related output, wherein the task output is an output value obtained by scheduling the current subtask, and the related output is an attribute value for indicating execution of the current subtask, and the attribute value includes an execution duration.
6. A task scheduling apparatus characterized by comprising: including: A determination unit is configured to determine, from scheduling logic of a target task, an upstream node list corresponding to a current node that is to execute a current subtask, wherein the scheduling logic includes scheduling conditions and execution parameters for executing nodes corresponding to a plurality of subtasks in the target task, and the upstream node list includes a plurality of upstream nodes that are located before the current node and directly connected to the current node in the scheduling logic; An assignment unit is configured to, in a case where a critical upstream node in the upstream node list reaches a scheduling condition of the current node, assign execution parameters in the current node by using node results corresponding to each upstream node in the upstream node list, wherein the critical upstream node is a node whose execution result indicates successful execution, and the node result includes an output result of the critical upstream node and an assignment result of a non-critical upstream node in the upstream node list; A scheduling unit is configured to schedule the current node to execute the current subtask according to the assigned execution parameters. The device is further configured to, before the assignment of the execution parameters in the current node by using the node results corresponding to each upstream node in the upstream node list, determine that the execution result corresponding to the critical upstream node reaches the scheduling condition of the current node in a case where a node proportion of the critical upstream node in the upstream node list is greater than a second threshold. The device is further configured to, after the current node executes the current subtask according to the execution parameter after the assignment, if an execution result of the current node executing the current subtask indicates that the execution is successful, deliver an output result obtained after the current node executes the current subtask to a downstream node of the current node; if the execution result of the current node executing the current subtask indicates that the execution is failed, determine a reference assignment from a pre-configured assignment list, and deliver the reference assignment to the downstream node of the current node.
7. A computer readable storage medium, characterized in that, The computer readable storage medium comprises a stored program, and the program is configured to execute the method in any one of claims 1 to 5 when executed.
8. An electronic device comprising a memory and a processor, characterized in that The memory stores a computer program, and the processor is configured to execute the method in any one of claims 1 to 5 by using the computer program.
Citation Information
Patent Citations
Task processing flow arrangement method and device and electronic equipment
CN111967849A