CN114253690A - Task scheduling method and device, electronic equipment and computer readable storage medium - Google Patents

Task scheduling method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN114253690A
CN114253690A CN202111563927.2A CN202111563927A CN114253690A CN 114253690 A CN114253690 A CN 114253690A CN 202111563927 A CN202111563927 A CN 202111563927A CN 114253690 A CN114253690 A CN 114253690A
Authority
CN
China
Prior art keywords
node
task
task scheduling
scheduling
nodes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111563927.2A
Other languages
Chinese (zh)
Inventor
何晓晔
杨朴
刘波
郑浩
代莉
龚才语
王军
何山
谭鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Communications Construction Co Ltd
Original Assignee
Chongqing Communications Construction Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Communications Construction Co Ltd filed Critical Chongqing Communications Construction Co Ltd
Priority to CN202111563927.2A priority Critical patent/CN114253690A/en
Publication of CN114253690A publication Critical patent/CN114253690A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a task scheduling method, a task scheduling device, an electronic device and a computer readable storage medium, wherein a target scheduling node is determined from started task scheduling nodes, and the target scheduling node selects a target task execution node.

Description

Task scheduling method and device, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of task scheduling technologies, and in particular, to a task scheduling method, a task scheduling apparatus, an electronic device, and a computer-readable storage medium.
Background
In a conventional task scheduling system, when a plurality of task scheduling nodes are started in the system, for a certain task plan execution instruction, when the plurality of started task scheduling nodes are in a running state at the same time, each task scheduling node selects a task execution node, so that for the same task plan execution request, the plurality of task scheduling nodes select the task execution node at the same time, and can be repeatedly scheduled, thereby easily generating error data.
Disclosure of Invention
An object of the embodiments of the present application is to provide a task scheduling method, a task scheduling device, an electronic device, and a computer-readable storage medium, so as to solve the problem that in an existing task scheduling process, multiple task scheduling nodes work simultaneously, which results in repeated scheduling and error data generation.
The embodiment of the application provides a task scheduling method, which comprises the following steps:
monitoring the starting condition of a task scheduling node;
when the number of the currently started task scheduling nodes is larger than 1, determining a target scheduling node from the currently started task scheduling nodes;
when a task plan execution instruction is received, the target scheduling node is used for selecting the target task execution node to perform task scheduling to realize the corresponding task plan after the task plan corresponding to the task plan execution instruction is obtained.
In the implementation process, a target scheduling node is determined from the started task scheduling nodes, and the target scheduling node selects a target task execution node.
Further, the determining a target scheduling node from the currently started task scheduling nodes includes:
and selecting the target scheduling node according to the starting sequence of the currently started task scheduling node.
In the implementation process, a target scheduling node is selected from the started task scheduling nodes based on the starting sequence of the task scheduling nodes, and the reasonability and the availability of the target scheduling node are ensured as much as possible.
Further, the selecting the target scheduling node according to the starting sequence of the currently started task scheduling node includes:
selecting a task scheduling node with the latest starting time from the currently started task scheduling nodes as the target scheduling node;
or the like, or, alternatively,
and when the number of the currently started task scheduling nodes is more than 1, taking the started 2 nd task scheduling node as the target scheduling node.
In the implementation process, the task scheduling node with the latest starting time is selected from the currently started task scheduling nodes as the target scheduling node, and the target task scheduling node is refreshed in real time, so that the rationality and the availability of the target scheduling node are further ensured, or the started 2 nd task scheduling node is used as the target scheduling node, so that the frequent switching of the target scheduling node can be avoided.
Further, the method further comprises: each task scheduling node is registered with a task plan, and the method further comprises the following steps:
determining a plan synchronization node from the currently started task scheduling nodes;
the plan synchronization node is used for communicating with the task scheduling nodes except the task scheduling node, acquiring synchronization information and sending the synchronization information to the task scheduling nodes except the task scheduling node, wherein the synchronization information comprises information of the task plan registered on each task scheduling node.
In the implementation process, the plan synchronization node is communicated with the started task scheduling nodes except the task scheduling node, and synchronization information is sent, so that when other task scheduling nodes are selected as target scheduling nodes, the task plan corresponding to the task plan execution instruction can be accurately acquired in time.
Further, the determining a plan synchronization node from the currently started task scheduling nodes includes:
and selecting the task scheduling node with the earliest starting time from the started task scheduling nodes as the plan synchronization node.
In the implementation process, the task scheduling node with the earliest starting time is selected as the plan synchronization node, and the switching frequency of the plan synchronization node is reduced as much as possible.
Further, the method further comprises:
and when a first standby node of the target scheduling node exists in the started task scheduling nodes, if the target scheduling node is down, selecting the latest started node from the first standby node as a new target scheduling node.
In the implementation process, when the target scheduling node is down, the new target scheduling node is determined from the first standby node, so that the task scheduling stability is improved, and the risk and loss caused by the down are reduced.
Further, the method further comprises:
and when a second standby node of the scheduled synchronization nodes exists in the started task scheduling nodes, if the scheduled synchronization nodes are down, selecting the task scheduling node which is started earliest from the second standby nodes as a new scheduled synchronization node.
In the implementation process, when the scheduled synchronous node goes down, a new scheduled synchronous node is determined from the second standby node, so that the task scheduling stability is improved, and the risk and loss caused by the down are reduced.
An embodiment of the present application further provides a task scheduling apparatus, including:
the monitoring unit is used for monitoring the starting condition of the task scheduling node;
a determining unit, configured to determine a target scheduling node from the currently started task scheduling nodes when the number of the currently started task scheduling nodes is greater than 1; when a task plan execution instruction is received, the target scheduling node is used for selecting the target task execution node to perform task scheduling to realize the corresponding task plan after the task plan corresponding to the task plan execution instruction is obtained.
An embodiment of the present application further provides an electronic device, which includes a processor and a memory, where the memory stores a computer program, and the processor executes the computer program to implement any one of the above task scheduling methods.
The embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by at least one processor, the computer program is configured to implement any one of the task scheduling methods described above.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a task scheduling method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a task scheduling method according to a second embodiment of the present application;
fig. 3 is a schematic structural diagram of a task scheduling device according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The first embodiment is as follows:
in order to solve the problem that multiple task scheduling nodes work simultaneously in the existing task scheduling process, which results in repeated scheduling and error data generation, the present embodiment provides a task scheduling method, and a specific process is shown in fig. 1, which includes:
s101: and monitoring the starting condition of the task scheduling node.
S102: and when the number of the currently started task scheduling nodes is more than 1, determining a target scheduling node from the currently started task scheduling nodes.
When receiving a task plan execution instruction, the target scheduling node in step S102 is configured to select the target task execution node to perform task scheduling to implement the corresponding task plan after obtaining the task plan corresponding to the task plan execution instruction. For example, the target scheduling node may select an idle target task execution node to perform task scheduling to implement a corresponding task plan. It is understood that the task scheduling node may register the task plan in the database after being confirmed as the target scheduling node, may register the task plan after being started, or the target scheduling node may obtain the corresponding task plan from the following plan synchronization node.
It should be noted that, if the number of currently started task scheduling nodes is 1, the task scheduling node may be directly used as a target scheduling node.
In step S102, the target scheduling node may be selected according to the starting sequence of the currently started task scheduling node, for example, the task scheduling node with the latest starting time may be selected from the currently started task scheduling nodes as the target scheduling node, so that the target task scheduling node may be refreshed in real time, and the reliability of the selected target task scheduling node is ensured. Of course, in other embodiments, the task scheduling node with the earliest start time may be selected as the target scheduling node, or the task scheduling node that is started second or third may be selected as the target scheduling node, where the specific selection rule may be flexibly set in advance by a developer. Of course, in other embodiments, a target scheduling node may also be randomly selected from the started task scheduling nodes, or the selection may also be performed according to other rules as long as it is ensured that a target scheduling node is selected.
In this embodiment, a task plan may be registered in each started task scheduling node, and at this time, a plan synchronization node may be determined from currently started task scheduling nodes; the plan synchronization node is used for communicating with the task scheduling nodes except the task scheduling node, acquiring synchronization information and sending the synchronization information to the task scheduling nodes except the task scheduling node, wherein the synchronization information comprises information of the task plan registered on each task scheduling node.
In some other embodiments, the synchronization information may further include node information of each task scheduling node, where the node information of each scheduling node may include start time of the node and/or current role identity information of the node, where the role identity information refers to whether the node is currently an ordinary task scheduling node identity, a target scheduling node identity, or a planned synchronization node identity, and thus, each task scheduling node in the scheduling system may obtain information of task scheduling nodes other than itself through the planned synchronization node.
Similarly, in this embodiment, the scheduled synchronization node may be determined according to the starting sequence of the started task scheduling nodes, for example, the task scheduling node with the earliest starting time may be selected as the scheduled synchronization node, so that the switching frequency of the scheduled synchronization node may be reduced. In other embodiments, other selection rules may be used to select the plan synchronization node, for example, the selection may be randomly performed among the task scheduling nodes excluding the target scheduling node, and of course, if only one started task scheduling node is provided, the task scheduling node may simultaneously serve as the target scheduling node and the plan synchronization node.
It should be noted that the electronic device executing the step S101 and the step S102 may determine a plan synchronization node from the started task scheduling nodes, for example, a plan synchronization node may be determined directly according to a starting sequence of the started task scheduling nodes, and then select a target scheduling node from the started task scheduling nodes through the plan synchronization node, that is, the step S101 and the step S102 are implemented by the plan synchronization node, and the selection of the subsequent new plan synchronization node and the new target scheduling node may be implemented by the electronic device through the plan synchronization node, that is, the step is implemented by the plan synchronization node. Of course, in other embodiments, after the electronic device performs the steps S101 and S102 to determine the target scheduling node, the target scheduling node may also implement selection of a subsequent new plan synchronization node and a new target scheduling node. In other embodiments, the functions corresponding to the above method steps may also be implemented by other program nodes of the electronic device.
In this embodiment, preferably, one plan synchronization node may be selected from the started task scheduling nodes, but in other embodiments, the number of plan synchronization nodes may be multiple. When a task scheduling node updates a task plan, the task scheduling node may send the updated task plan to a plan synchronization node, and then the plan synchronization node notifies other task scheduling nodes of the updated task plan as synchronization information. If the node for updating the task plan is the plan synchronization node, the node can directly synchronize the updated task plan to other task scheduling nodes.
In this embodiment, when a first standby node of a current target scheduling node exists in started task scheduling nodes, if it is monitored that the target scheduling node is down, one node may be selected from the first standby node as a new target scheduling node, where a selection principle for selecting the new target scheduling node may be the same as or different from a previous principle for selecting the target scheduling node, for example, a latest started node may be selected from the first standby node as the new target scheduling node. The first standby node may be a node except the current target scheduling node in the currently started task scheduling node, or may be a node except the current target scheduling node and the plan synchronization node in the currently started task scheduling node.
Similarly, in this embodiment, when a second standby node of the scheduled synchronization node exists in the started task scheduling nodes, if it is monitored that the scheduled synchronization node goes down, the earliest started task scheduling node may be selected from the second standby node as a new scheduled synchronization node, where a selection principle for selecting the new scheduled synchronization node may be the same as or different from a previous principle for selecting the scheduled synchronization node, for example, the earliest started node may be selected from the second standby node as a new target scheduling node. The second standby node may be a node except the current scheduled synchronization node in the currently started task scheduling node, or may be a node except the current target scheduling node and the scheduled synchronization node in the currently started task scheduling node.
It should be noted that, in another embodiment, the task plan, the determined target scheduling node, the node identification information of the plan synchronization node or the standby node may be stored in a common database, so that the other task scheduling nodes may also directly obtain the current specific situation of the scheduling system through the common database, and the plan synchronization node does not need to perform information synchronization in each task scheduling node.
Finally, it should be noted that the task scheduling node may be deployed on one electronic device, or may be deployed on multiple electronic devices.
According to the task scheduling method provided by the embodiment, the target task execution node is selected through one target scheduling node to perform task scheduling, a corresponding task plan is realized, each task scheduling node does not seize task execution in a form-locked manner any more, a large number of thread waiting resources are avoided, meanwhile, repeated scheduling and generation of error data can be avoided, in addition, the stability of task scheduling is improved through the standby node, risks and losses caused by downtime are reduced, and the method has the characteristics of high efficiency and high availability.
Example two:
in order to better understand the solution provided by the present invention, this embodiment describes in detail a process of determining a role of a task scheduling node when the task scheduling node is started, and a specific flow is shown in fig. 2, which includes:
s201: and starting the task scheduling node A.
S202: and judging whether a plan synchronization node exists in the started task scheduling nodes, if so, turning to S204, and if not, turning to S203.
It should be noted that, in this embodiment, information of each task scheduling node may be stored in a node information database, node identification information of a target scheduling node, a scheduled synchronization node, and a standby node may be stored in the node information database, and the scheduled synchronization node may maintain information in the node information database, perform real-time update, and clean invalid node information.
In another embodiment, step S202 may be replaced by determining whether the number of started task scheduling nodes is greater than 1, if so, going to S204, and if not, going to S203.
S203: and taking the task scheduling node A as a target scheduling node and a plan synchronization node.
The target scheduling node in this embodiment may select one available target task execution node from the executive program clients registered to the service to perform task scheduling, so as to implement a corresponding task plan, and when a next task is triggered, the target scheduling node may also select one available target task execution node to perform task scheduling. The plan synchronization node is used for synchronizing the updated task plan to other task scheduling nodes, meanwhile, the plan synchronization node can inform the task execution node to switch to a specified target scheduling node for service, the corresponding target task execution node can be accessed to the corresponding target scheduling node for registration according to socket service, a normal web api access mode is provided, and when the target task execution node receives a task execution instruction sent by the target scheduling node, the task is immediately written into an execution queue and is started to be executed.
Of course, in other embodiments, the target scheduling node may directly notify the corresponding target task execution node to perform the task scheduling service.
It should be noted that, when the target scheduling node in this embodiment receives a task return request of the current target task execution node, a new target task execution node may be reselected for an unexecuted task in the execution program queue to perform task execution. In particular, the target task execution node may send a task back request to the target scheduling node when the current task is heavy, or blocked.
S204: and judging whether the current planning synchronization node and the target scheduling node are the same node, if so, turning to S205, and if not, turning to S206.
The plan synchronization node and the target task scheduling node are the same node, which shows that only one task scheduling node is started currently.
In another embodiment, step S204 may be replaced by determining whether the number of started task scheduling nodes is equal to 2, if so, going to S205, and if not, going to S206.
S205: and marking the task scheduling node A as a target scheduling node, canceling the identity of the last target scheduling node as the target scheduling node, and taking the last target scheduling node as a plan synchronization node and a standby node.
S206: and marking the task scheduling node A as a standby node.
The standby node in this embodiment may be subsequently activated as a target scheduling node or a scheduled synchronization node, specifically, the standby node with the earliest start time may be activated as the scheduled synchronization node, and the standby node with the latest start time may be activated as the target scheduling node. It should be noted that, in the method provided in this embodiment, the scheduled synchronization node is determined first, and it may be understood that, in other embodiments, the scheduled synchronization node may also not be determined, or the scheduled synchronization node may be determined after the target scheduling node is determined, and a specific flow may be flexibly set by a developer.
It should be further noted that, in this embodiment, communication between task scheduling nodes may be implemented based on a socket service, specifically: the plan synchronization node is registered as a socket server, the standby node and the target scheduling node are registered as socket clients, and the plan synchronization node broadcasts and sends a task plan to carry out plan synchronization.
In this embodiment, the 1 st started task scheduling node is first used as a target scheduling node and a plan synchronization node; when the 2 nd started task scheduling node is available, the 1 st started task scheduling node is converted into a planning synchronization node and a standby node, and meanwhile, the 2 nd started task scheduling node is designated as a target scheduling node; the 3 rd to n th started task scheduling nodes can be connected with the plan synchronization node through the database information after being started, the nodes are used as standby nodes, the plan synchronization node can maintain all the task scheduling nodes to enter the database, and the node weight is set according to the starting time or the registration time of the nodes and is used as a next target scheduling node or a plan synchronization node alternative target.
When the target scheduling node goes down, the planning synchronization node can select a new target scheduling node from the standby nodes randomly or according to the weight value, broadcast the message, and send a switching instruction to the task execution node through the http protocol to switch the scheduling service end. The weight value here may be a value determined according to the start time.
When the scheduled synchronous node goes down, the second weighted task scheduling node enters a synchronous and standby role from the standby node, for example, the task scheduling node with the earliest starting time except the scheduled synchronous node is selected from the currently started task scheduling nodes as a new scheduled synchronous node, and meanwhile, other task scheduling nodes can be searched by the node information database and are connected to the current scheduled synchronous node.
Briefly, in a specific embodiment, a plurality of task scheduling nodes may be deployed on one or more electronic devices, a node that is started first may be registered as a plan synchronization node and a target scheduling node, and a task plan may be registered, and after being started, other nodes except a task scheduling node that is started in a second order may obtain information of the plan synchronization node through a node database, and establish a bidirectional communication connection with the plan synchronization node, and then the plan synchronization node may be set as a standby node whose starting time sequence is a weight, and a node that is started in the second order may be set as a target scheduling node by the plan synchronization node, and the weight value is automatically updated to a minimum value (to avoid becoming a next plan synchronization node), and all the started nodes may have registered the task plan, and if a task plan execution instruction is received at this time, and selecting a target task execution node to perform task scheduling to realize a corresponding task plan, and keeping silent (ignoring the trigger task) after judging that the other nodes are not in the role of the target scheduling node.
The plan synchronization node in the embodiment is realized based on the real-time performance of two-way communication, and the high availability and reliability of task scheduling are ensured.
When a task scheduling node in the cluster modifies the task plan, the task scheduling node can actively inform the plan synchronization node of the task plan change, and the plan synchronization node immediately synchronizes the latest task plan to all task scheduling nodes, so that the effectiveness and the accuracy of scheduling node plan triggering are ensured.
In addition, when the standby node in the cluster goes down, the standby node can broadcast to each node in time through the scheduled synchronous node, update the weight value of each node and set the highest mark. When the scheduling node is down, the next node (determined by the weight value generated by the starting time sequence, and the default starting time is the lowest) is activated immediately as a new target scheduling node, and the task can be ensured to be triggered normally.
When the synchronous node is crashed unfortunately, all task scheduling nodes in the cluster can immediately sense the crash, and the node with the highest weight value (the node with the earliest starting time in the surviving nodes except the scheduling node) in the rest cluster nodes can be automatically activated as a new planned synchronous node immediately, and the node database informs all other nodes of establishing bidirectional communication connection with the node (all nodes with the highest non-weight values acquire a new planned synchronous node connection mode in a mode of automatically starting the database to search for the planned synchronous node). Thereby achieving high availability of the scheduler. Meanwhile, the roles of the plan synchronization node and the target scheduling node in the cluster mode may not be in the same program, so that the reliability of the program can be effectively improved.
The target scheduling node is used as a node actually having task triggering authority, and can find a target task execution node with sufficient resources and good state from the execution nodes to actually execute the task. Meanwhile, the system can establish real-time connection with the task execution node in a bidirectional communication mode, receive state information and performance monitoring information of the task execution node and use the state information and the performance monitoring information as a reference basis for selecting the target task execution node. When a certain target task execution node goes down, the target scheduling program ignores the node and distributes the task to other available execution nodes. Meanwhile, when the target task execution node is down or the task is returned, the task which is not executed or is not successful can be distributed to other task execution nodes.
When the target scheduling node is changed and the new target scheduling node is activated, the new target scheduling node can be actively pushed to the target task execution node through a certain form (such as a web interface), the connection between the new target scheduling node and the target task execution node is updated, and the new target scheduling node can be ensured to be smoothly accessed to all task execution nodes.
According to the task scheduling method provided by the embodiment, each started task scheduling program is divided into 3 roles through a socket service, the roles can be any role in a target scheduling node, a plan synchronization node and a standby node, long connection is kept among the connected nodes based on the characteristics of socket communication, when one node is in a state, the plan synchronization node can inform other nodes, the other nodes can immediately perceive, when the plan synchronization node is abnormal, the standby node can immediately perceive and realize switching, and the task scheduling node is in real-time communication with the task execution node, so that the target scheduling node can flexibly select the target task execution node to carry out task scheduling to realize task planning.
Example three:
based on the same inventive concept, the present embodiment provides a task scheduling device, please refer to fig. 3, it should be understood that specific functions of the task scheduling device can refer to the description above, and detailed descriptions are appropriately omitted herein to avoid redundancy. The task scheduling device includes at least one software functional unit that can be stored in memory in the form of software or firmware or solidified in the operating system of the device. Specifically, the task scheduling device includes a monitoring unit 301 and a determining unit 302, where the monitoring unit 301 is configured to monitor a starting condition of task scheduling nodes, and the determining unit 302 is configured to determine a target scheduling node from currently started task scheduling nodes when the number of currently started task scheduling nodes is greater than 1; the target scheduling node is used for selecting a target task execution node to perform task scheduling so as to realize a corresponding task plan.
When a task plan execution instruction is received, the target scheduling node in this embodiment is configured to select the target task execution node to perform task scheduling to implement a corresponding task plan after the task plan corresponding to the task plan execution instruction is obtained. For example, the target scheduling node may select an idle target task execution node to perform task scheduling to implement a corresponding task plan. It is to be understood that the task scheduler node may register the task plan in the database after being identified as the target scheduler node, or may register the task plan upon startup.
It should be noted that, if the number of currently started task scheduling nodes is 1, the determining unit 302 may directly use the task scheduling node as the target scheduling node.
The determining unit 302 may select a target scheduling node according to a starting sequence of a currently started task scheduling node, for example, a task scheduling node with the latest starting time may be selected from the currently started task scheduling nodes as the target scheduling node, so that the target task scheduling node may be refreshed in real time, and reliability of the selected target task scheduling node is ensured. Of course, in other embodiments, a target scheduling node may also be randomly selected from the started task scheduling nodes, or the selection may also be performed according to other rules as long as it is ensured that a target scheduling node is selected.
In this embodiment, a task plan may be registered in each started task scheduling node, and at this time, a plan synchronization node may be determined from currently started task scheduling nodes; the plan synchronization node is used for communicating with the task scheduling nodes except the task scheduling node, acquiring synchronization information and sending the synchronization information to the task scheduling nodes except the task scheduling node, wherein the synchronization information comprises information of the task plan registered on each task scheduling node.
In some other embodiments, the synchronization information may further include node information of each task scheduling node, where the node information of each scheduling node may include start time of the node and/or current role identity information of the node, where the role identity information refers to whether the node is currently an ordinary task scheduling node identity, a target scheduling node identity, or a planned synchronization node identity, and thus, each task scheduling node in the scheduling system may obtain information of task scheduling nodes other than itself through the planned synchronization node.
Likewise, in this embodiment, the determining unit 302 may determine the schedule synchronization node according to the starting sequence of the started task scheduling nodes, for example, the task scheduling node with the earliest starting time may be selected as the schedule synchronization node, so that the switching frequency of the schedule synchronization node may be reduced. In other embodiments, other selection rules may be used to select the plan synchronization node, for example, the selection may be randomly performed among the task scheduling nodes excluding the target scheduling node, and of course, if only one started task scheduling node is provided, the task scheduling node may simultaneously serve as the target scheduling node and the plan synchronization node.
It should be noted that, in another example, the task scheduling device may first determine the plan synchronization node from the started task scheduling nodes through the determining unit 302, for example, may determine a plan synchronization node directly according to the starting sequence of the started task scheduling nodes, and then select the target scheduling node from the started task scheduling nodes through the plan synchronization node, where the selection of the subsequent new plan synchronization node and the new target scheduling node may be implemented by the plan synchronization node, and of course, may also be implemented by the target scheduling node.
In this embodiment, preferably, one plan synchronization node may be selected from the started task scheduling nodes, but in other embodiments, the number of plan synchronization nodes may be multiple. When a task scheduling node updates a task plan, the task scheduling node may send the updated task plan to a plan synchronization node, and then the plan synchronization node notifies other task scheduling nodes of the updated task plan as synchronization information. If the node for updating the task plan is the plan synchronization node, the node can directly synchronize the updated task plan to other task scheduling nodes.
The task scheduling apparatus provided in this embodiment may further include a first selecting unit, where when a first standby node of a current target scheduling node exists in the started task scheduling nodes, if it is monitored that the target scheduling node is down, the first selecting unit is configured to select one node from the first standby nodes as a new target scheduling node, where a selection principle of selecting the new target scheduling node may be the same as or different from a previous principle of selecting the target scheduling node, for example, a latest started node may be selected from the first standby nodes as the new target scheduling node. The first standby node may be a node except the current target scheduling node in the currently started task scheduling node, or may be a node except the current target scheduling node and the plan synchronization node in the currently started task scheduling node.
The task scheduling apparatus provided in this embodiment may further include a second selecting unit, where when a second standby node of the scheduled synchronization nodes exists in the started task scheduling nodes, if it is detected that the scheduled synchronization nodes are down, the second selecting unit is configured to select the task scheduling node that is started earliest from the second standby nodes as a new scheduled synchronization node, where a selection principle of selecting the new scheduled synchronization node may be the same as or different from a principle of selecting the scheduled synchronization node before, for example, the node that is started earliest may be selected from the second standby nodes as a new target scheduling node. The second standby node may be a node except the current scheduled synchronization node in the currently started task scheduling node, or may be a node except the current target scheduling node and the scheduled synchronization node in the currently started task scheduling node.
It should be understood that, for the sake of brevity, the contents described in some embodiments are not repeated in this embodiment.
The task scheduling device provided by this embodiment determines a target scheduling node through the determining unit, and selects a target task execution node from the target scheduling node to perform task scheduling, so as to implement a corresponding task plan, and each task scheduling node no longer seizes task execution in a form-locked manner, thereby avoiding occurrence of a large amount of thread waiting resources, and simultaneously avoiding repeated scheduling and generation of error data.
Example four:
referring to fig. 4, the electronic device includes a processor 401 and a memory 402, where the memory 402 stores a computer program, the processor 401 and the memory 402 implement communication through a communication bus, and the processor 401 executes the computer program to implement the steps of the task scheduling method in the first embodiment and/or the second embodiment, which are not described herein again. It will be appreciated that the configuration shown in fig. 4 is merely illustrative and that the electronic device may include more or fewer components than shown in fig. 4 or have a different configuration than shown in fig. 4.
The processor 401 may be an integrated circuit chip having signal processing capabilities. The processor 401 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. Which may implement or perform the various methods, steps, and logic blocks disclosed in the embodiments of the present application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The Memory 402 may include, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read Only Memory (PROM), Erasable Read Only Memory (EPROM), Electrically Erasable Read Only Memory (EEPROM), and the like.
The present embodiment further provides a computer-readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash Memory, a usb (universal serial bus) Card, an MMC (Multimedia Card) Card, etc., where one or more programs for implementing the above steps are stored in the computer-readable storage medium, and the one or more programs can be executed by the one or more processors 401 to implement the steps of the task scheduling method in the first embodiment and/or the second embodiment, which is not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A method for task scheduling, comprising:
monitoring the starting condition of a task scheduling node;
when the number of the currently started task scheduling nodes is larger than 1, determining a target scheduling node from the currently started task scheduling nodes;
when a task plan execution instruction is received, the target scheduling node is used for selecting the target task execution node to perform task scheduling to realize the corresponding task plan after the task plan corresponding to the task plan execution instruction is obtained.
2. The task scheduling method of claim 1, wherein said determining a target scheduling node from said currently started task scheduling nodes comprises:
and selecting the target scheduling node according to the starting sequence of the currently started task scheduling node.
3. The task scheduling method of claim 2, wherein the selecting the target scheduling node according to the starting order of the currently started task scheduling node comprises:
selecting a task scheduling node with the latest starting time from the currently started task scheduling nodes as the target scheduling node;
or the like, or, alternatively,
and when the number of the currently started task scheduling nodes is more than 1, taking the started 2 nd task scheduling node as the target scheduling node.
4. The method of task scheduling according to claim 1, wherein each of the task scheduling nodes has a task plan registered thereon, the method further comprising:
determining a plan synchronization node from the currently started task scheduling nodes;
the plan synchronization node is used for communicating with the task scheduling nodes except the task scheduling node, acquiring synchronization information and sending the synchronization information to the task scheduling nodes except the task scheduling node, wherein the synchronization information comprises information of the task plan registered on each task scheduling node.
5. The task scheduling method of claim 4, wherein said determining a plan synchronization node from among the currently started task scheduling nodes comprises:
and selecting the task scheduling node with the earliest starting time from the started task scheduling nodes as the plan synchronization node.
6. A method for task scheduling according to any of claims 1-5, wherein the method further comprises:
and when a first standby node of the target scheduling node exists in the started task scheduling nodes, if the target scheduling node is down, selecting the latest started node from the first standby node as a new target scheduling node.
7. A method of task scheduling according to claim 4 or 5 wherein the method further comprises:
and when a second standby node of the scheduled synchronization nodes exists in the started task scheduling nodes, if the scheduled synchronization nodes are down, selecting the task scheduling node which is started earliest from the second standby nodes as a new scheduled synchronization node.
8. A task scheduling apparatus, comprising:
the monitoring unit is used for monitoring the starting condition of the task scheduling node;
a determining unit, configured to determine a target scheduling node from the currently started task scheduling nodes when the number of the currently started task scheduling nodes is greater than 1; when a task plan execution instruction is received, the target scheduling node is used for selecting the target task execution node to perform task scheduling to realize the corresponding task plan after the task plan corresponding to the task plan execution instruction is obtained.
9. An electronic device, comprising a processor and a memory, the memory having stored therein a computer program, the processor executing the computer program to implement the method of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by at least one processor, implements the method according to any one of claims 1-7.
CN202111563927.2A 2021-12-20 2021-12-20 Task scheduling method and device, electronic equipment and computer readable storage medium Pending CN114253690A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111563927.2A CN114253690A (en) 2021-12-20 2021-12-20 Task scheduling method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111563927.2A CN114253690A (en) 2021-12-20 2021-12-20 Task scheduling method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114253690A true CN114253690A (en) 2022-03-29

Family

ID=80796044

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111563927.2A Pending CN114253690A (en) 2021-12-20 2021-12-20 Task scheduling method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114253690A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204418A (en) * 2021-05-19 2021-08-03 中国建设银行股份有限公司 Task scheduling method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204418A (en) * 2021-05-19 2021-08-03 中国建设银行股份有限公司 Task scheduling method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113014634B (en) Cluster election processing method, device, equipment and storage medium
CN106933659B (en) Method and device for managing processes
CN110417600B (en) Node switching method and device of distributed system and computer storage medium
CN112333249B (en) Business service system and method
WO2019057193A1 (en) Data deletion method and distributed storage system
CN111404730B (en) State synchronization method and device of virtual router, electronic equipment and storage medium
CN108664520B (en) Method and device for maintaining data consistency, electronic equipment and readable storage medium
CN113660350A (en) Distributed lock coordination method, device, equipment and storage medium
CN112015595B (en) Master-slave database switching method, computing device and storage medium
CN111159233A (en) Distributed caching method, system, computer device and storage medium
CN109257396B (en) Distributed lock scheduling method and device
CN113760468A (en) Distributed election method, device, system and medium
CN114253690A (en) Task scheduling method and device, electronic equipment and computer readable storage medium
JP2009026221A (en) Business process operation management system, method, process operation management device, and its program
CN111506388B (en) Container performance detection method, container management platform and computer storage medium
JP2010044553A (en) Data processing method, cluster system, and data processing program
CN112631756A (en) Distributed regulation and control method and device applied to space flight measurement and control software
CN111835809B (en) Work order message distribution method, work order message distribution device, server and storage medium
CN112698929A (en) Information acquisition method and device
CN111092956A (en) Resource synchronization method, device, storage medium and equipment
CN114816866A (en) Fault processing method and device, electronic equipment and storage medium
CN114138472A (en) Service data processing method, device and system
CN115220993A (en) Process monitoring method, device, vehicle and storage medium
CN113055203B (en) Method and device for recovering exception of SDN control plane
CN113703930A (en) Task scheduling method, device and system and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination