CN117331662A - Task scheduling method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN117331662A
CN117331662A CN202311267141.5A CN202311267141A CN117331662A CN 117331662 A CN117331662 A CN 117331662A CN 202311267141 A CN202311267141 A CN 202311267141A CN 117331662 A CN117331662 A CN 117331662A
Authority
CN
China
Prior art keywords
task
scheduling
scheduling node
node
scheduled
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
CN202311267141.5A
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.)
China Unicom Smart Connection Technology Ltd
Original Assignee
China Unicom Smart Connection Technology 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 China Unicom Smart Connection Technology Ltd filed Critical China Unicom Smart Connection Technology Ltd
Priority to CN202311267141.5A priority Critical patent/CN117331662A/en
Publication of CN117331662A publication Critical patent/CN117331662A/en
Pending legal-status Critical Current

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention discloses a task scheduling method, a task scheduling device, electronic equipment and a storage medium, which are applied to a current scheduling node. The method comprises the following steps: acquiring task identifiers of all tasks to be scheduled in a service cluster, and determining scheduling node query indexes of all the tasks to be scheduled according to the task identifiers and the total number of available scheduling nodes in a task scheduling node list; determining the task to be scheduled of the current scheduling node from each task to be scheduled according to the scheduling node query index of each task to be scheduled and the position index of the current scheduling node in the task scheduling node list, and obtaining a target task; and scheduling the target task to a service server for execution. The embodiment of the invention can enable the dispatch service to be decentralised, integrally improve the availability of the dispatch service, and avoid dependence on the distributed coordination service.

Description

Task scheduling method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a task scheduling method, a task scheduling device, an electronic device, and a storage medium.
Background
In the prior art, when scheduling a service task in a service cluster, a scheduling service is central, namely a master node and a slave node are selected from a plurality of task scheduling nodes by means of a distributed coordination service, and then the master node completes the high-availability scheduling service.
However, the prior art relies on distributed coordination service, so that the service dependence is increased, and the availability of scheduling service is reduced; task scheduling can only be executed by a main node, when the task quantity is large, a single-point bottleneck is formed, and capacity expansion cannot be realized; and when the master node is not available, scheduling execution of all tasks is affected during the process of re-performing the master node selection.
Disclosure of Invention
The embodiment of the invention provides a task scheduling method, a task scheduling device, electronic equipment and a storage medium, which can enable scheduling service to be decentralised, integrally improve the availability of the scheduling service and avoid dependence on distributed coordination service.
In a first aspect, an embodiment of the present invention provides a task scheduling method, applied to a current scheduling node, including: acquiring task identifiers of all tasks to be scheduled in a service cluster;
determining scheduling node query indexes of the tasks to be scheduled according to the task identifications and the total number of available scheduling nodes in a task scheduling node list;
determining the task to be scheduled of the current scheduling node from the tasks to be scheduled according to the scheduling node query index of the tasks to be scheduled and the position index of the current scheduling node in the task scheduling node list, and obtaining a target task; and
and dispatching the target task to a service server for execution.
In a second aspect, an embodiment of the present invention provides a task scheduling device, integrated in a current scheduling node, including:
the task acquisition module is used for acquiring task identifiers of all tasks to be scheduled in the service cluster;
the scheduling node query index determining module is used for determining the scheduling node query index of each task to be scheduled according to the task identification and the total number of available scheduling nodes in the task scheduling node list;
the target task acquisition module is used for determining the tasks to be scheduled of the current scheduling node from the tasks to be scheduled according to the scheduling node query indexes of the tasks to be scheduled and the position indexes of the current scheduling node in the task scheduling node list to obtain target tasks; and
and the scheduling module is used for scheduling the target task to the corresponding service server for execution.
In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements a task scheduling method according to any one of the embodiments of the present invention when the processor executes the program.
In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a task scheduling method according to any of the embodiments of the present invention.
According to the task scheduling method, the device, the electronic equipment and the storage medium, the target task executed by each current scheduling node is calculated and determined according to the total number of the currently available scheduling nodes in the task scheduling node list and the task identification of each service task, so that the scheduling service is decentralised, when one of the scheduling nodes is unavailable, only the task distributed to the node is influenced, the scheduling of all the tasks is prevented from being influenced during the unavailable period of the single scheduling service, and the overall availability of the scheduling service is improved; the invention can also make each task scheduling node carry out task scheduling, the processing logic is consistent, the stateless operation of the scheduling node is realized, the dynamic capacity reduction and expansion can be carried out according to the requirement, and the cost is reduced on the premise of ensuring the overall working efficiency of the service cluster; the scheme of the invention is simple to realize and has better portability; in addition, the invention can avoid depending on distributed coordination service, and is beneficial to solving the general problem of distributed task scheduling class by embedding the abstract common module into business application.
Drawings
In order to more clearly illustrate the technical solutions of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and should not be considered as limiting the scope, and that other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a task scheduling method according to an embodiment of the present invention;
FIG. 2 is another flow chart of a task scheduling method according to an embodiment of the present invention;
FIG. 3 is another flow chart of a task scheduling method according to an embodiment of the present invention;
FIG. 4 is another flow chart of a task scheduling method according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a task scheduler according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Fig. 1 is a schematic flow chart of a task scheduling method according to an embodiment of the present invention, where the method may be performed by a task scheduling device according to an embodiment of the present invention, and the device may be implemented in software and/or hardware. In a specific embodiment, the apparatus may be integrated in an electronic device, such as a computer, a server, etc. The following embodiments will be described taking the integration of the device in an electronic apparatus as an example. Referring to fig. 1, the method may specifically include the steps of:
step 101, obtaining task identifiers of each task to be scheduled in the service cluster, so as to be beneficial to determining query indexes of corresponding scheduling nodes according to the task identifiers of each task to be scheduled.
Specifically, the task identifier of the task to be scheduled may be a unique code of each task to be scheduled.
Optionally, the process of acquiring the task identifier of each task to be scheduled in the service cluster may be performed at regular time, or may be performed by triggering when a preset triggering condition is met.
Step 102, determining a scheduling node query index of each task to be scheduled according to the task identification and the total number of available scheduling nodes in the task scheduling node list. The method is beneficial to determining target tasks to be scheduled when the scheduling node is required to be scheduled according to the scheduling node query index.
Optionally, the task scheduling node list includes task scheduling nodes of all the service tasks for scheduling the service clusters in the service clusters arranged according to a preset rule.
Optionally, the task scheduling node list may include an identifier of each task scheduling node, an IP address of each task scheduling node, and an operation state of each task scheduling node.
Optionally, the available scheduling node is each task scheduling node in the task scheduling node list.
Optionally, the available scheduling node is a task scheduling node with a normal running state in each task scheduling node of the task scheduling node list.
Alternatively, the remainder value corresponding to each task to be scheduled can be calculated by dividing the unique code of each task to be scheduled by the total number of the available scheduling nodes, and the scheduling node query index corresponding to the task to be scheduled is obtained by using the remainder value.
Specifically, the remainder value may be directly determined as the scheduling node query index, and the specific process may be expressed as:
BrokerIndex=TaskId%BrokerCount
wherein, the Broker index represents a scheduling node query index of a task to be scheduled; the TaskId represents a unique code of the task to be scheduled; the Broker count represents the total number of available scheduling nodes.
Step 103, determining the task to be scheduled of the current scheduling node from each task to be scheduled according to the scheduling node query index of each task to be scheduled and the position index of the current scheduling node in the task scheduling node list, and obtaining a target task, so that the current scheduling node can obtain the target task to be scheduled on the premise of not relying on distributed coordination service and decentralizing, avoid relying on the distributed coordination service, avoid influencing the scheduling of all tasks during the unavailable period of single scheduling service, and improve the overall availability of the scheduling service.
Specifically, the position index of the current scheduling node in the task scheduling node list may be a sequence number of the current scheduling node in a sequence of all task scheduling nodes in the task scheduling node list.
Specifically, the position index of the current scheduling node in the task scheduling node list may be determined according to the sequence number of the current scheduling node in the sequence of all task scheduling nodes in the task scheduling node list. Specifically, for example, the location index includes the sequence number of the current scheduling node.
Optionally, the target task may be determined according to a correspondence between a query index of a scheduling node of each task to be scheduled and a position index of the current scheduling node.
Preferably, the task to be scheduled, of which the numerical value of the number in the scheduling node query index is the same as the numerical value of the number in the position index of the current scheduling node, is determined as the target task of the current scheduling node.
Optionally, the numerical value of the number in the query index of the scheduling node may also be a multiple value of the numerical value of the number in the position index of the current scheduling node, or a value with other corresponding relations.
104, scheduling the target task to a service server for execution, based on steps 101-103, calculating and determining the target task executed by each current scheduling node according to the total number of currently available scheduling nodes in a task scheduling node list and the task identification of each service task, so that the scheduling service is de-centralized, when one of the scheduling nodes is unavailable, only the task distributed to the node is influenced, the scheduling of all the tasks is prevented from being influenced during the unavailable period of the single scheduling service, and the overall availability of the scheduling service is improved; the invention can also support dynamic contraction and expansion, which is beneficial to reducing the cost on the premise of ensuring the overall working efficiency of the service cluster; the scheme of the invention is simple to realize and has better portability; in addition, the invention can avoid depending on distributed coordination service, and is beneficial to solving the general problem of distributed task scheduling class by embedding the abstract common module into business application.
In an alternative embodiment of the present invention, the scheduling of the target task to the service server for execution includes: adding the target task into a cache of the current scheduling node, and determining a preliminary scheduling target task according to the next execution time of the target task; adding the task to be scheduled to the time round buffer of the current scheduling node; and scheduling the preliminary scheduling target task from the time round buffer memory to the service server for execution at the next execution time.
Specifically, the data structure of the time round buffer can facilitate the target task to be conveniently scheduled to the service server for execution.
Specifically, the process of determining the preliminary scheduling target task according to the next execution time of the target task includes: judging whether the target task is a target task for preliminary scheduling according to whether the next execution time of the target task is within a first preset time length, for example, within 30 seconds to 1 minute, and if so, judging the target task as the target task for preliminary scheduling.
In an alternative embodiment of the present invention, the process of scheduling the preliminary scheduling target task from the time round buffer to the service server at the next execution time includes: taking out target tasks which need to be executed every second from the time round cache every second, and pushing the target tasks to a task scheduling pool of a current scheduling node; acquiring a business server for executing the target task which needs to be executed every second from a database, and executing the target task which needs to be executed every second by utilizing the business server; and updating the execution result of the target task executed every second and updating the next scheduling time of the target task.
Further describing the task scheduling method in another embodiment, as shown in fig. 2, the method may include the following steps:
step 201, it is monitored whether the task scheduling node list is changed.
In an optional embodiment of the present invention, the process of monitoring whether the task scheduling node list changes includes: acquiring the total number of available scheduling nodes in a task scheduling node list and the position index of the available scheduling nodes in the task scheduling node list; and determining that the task scheduling node list is changed when the total number of available scheduling nodes acquired at the present time is different from the total number of available scheduling nodes acquired at the last time and/or the position index of the available scheduling nodes acquired at the present time in the task scheduling node list is different from the position index of the available scheduling nodes acquired at the last time in the task scheduling node list.
Specifically, the process of obtaining the total number of available scheduling nodes in the task scheduling node list and the position index of the available scheduling nodes in the task scheduling node list may be performed at regular time, for example, every second preset time period, where the second preset time period may specifically be 5-15 seconds.
Optionally, the process of monitoring whether the task scheduling node list changes includes: acquiring the total number of available scheduling nodes in a task scheduling node list and the position index of the current scheduling node in the task scheduling node list; and determining that the task scheduling node list is changed when the total number of available scheduling nodes acquired at the present time is different from the total number of available scheduling nodes acquired at the last time and/or the position index of the current scheduling node acquired at the present time in the task scheduling node list is different from the position index of the current scheduling node acquired at the last time in the task scheduling node list.
Specifically, when the total number of available scheduling nodes in the task scheduling node list changes, the situation that the newly added available scheduling nodes have no scheduling tasks to be scheduled or the available scheduling nodes become unavailable nodes is indicated, and the situation that the tasks to be scheduled have no scheduling nodes to be scheduled exists; when the position index in the task scheduling node changes, the method also indicates that a newly available scheduling node exists or the available scheduling node becomes an unavailable node, so that all the available nodes including the current scheduling node need to be triggered to re-pick up each task to be scheduled in the service cluster.
Step 202, if the task scheduling node list is monitored to change, task identifiers of all tasks to be scheduled in the service cluster are obtained.
Step 203, determining a scheduling node query index of each task to be scheduled according to the task identification and the total number of available scheduling nodes in the task scheduling node list.
Step 204, determining the task to be scheduled of the current scheduling node from the tasks to be scheduled according to the scheduling node query index of each task to be scheduled and the position index of the current scheduling node in the task scheduling node list, and obtaining the target task.
And step 205, scheduling the target task to a service server for execution.
According to the embodiment of the invention, the target task of the current dispatching node can be adjusted in real time according to the number and running state of the task dispatching nodes, and the change of the task dispatching list is caused, so that the load balancing of each dispatching node in the cluster can be realized.
Further describing the task scheduling method in another embodiment of the present invention, as shown in fig. 3, the task scheduling method may include the following steps:
step 301, sending running state information and address information of a current scheduling node to a management node, where the running state information is used to determine that the current scheduling node is an available scheduling node, and the address information is used to determine a position index of the current scheduling node by the management node, where the position index is used to add the current scheduling node to a task scheduling node list by the management node.
Specifically, step 301 may be performed when creating a task scheduling node list, or when expanding the task scheduling node list.
Specifically, the process of sending the running state information and the address information of the current scheduling node to the management node may be performed at regular time, for example, once every third preset time length, where the third preset time length may be 3-6 seconds, preferably 5 seconds, so as to accurately determine the running state of the task scheduling node in the task scheduling node list, and further enable the current scheduling node to obtain a proper amount of target task.
Specifically, the address information may be an IP address, and the operation state information may be information whether the current scheduling node operates normally, which may be obtained by whether heartbeat information exists.
Specifically, the IP address of the current scheduling node may be sent to the management node by means of a heartbeat.
Optionally, the IP address is sent to the management node, and at the same time, the heartbeat time is sent to the management node, so that the management node adds the heartbeat time to the task scheduling node list.
Optionally, when the management node determines the position index of the current scheduling node, each task scheduling node in the task scheduling node list may be ordered according to a predetermined rule, and the position index of the current scheduling node may be obtained according to the ordering sequence number of the current scheduling node.
Step 302, a task identifier of each task to be scheduled in the service cluster is obtained.
Step 303, determining a scheduling node query index of each task to be scheduled according to the task identification and the total number of available scheduling nodes in the task scheduling node list.
Step 304, determining the task to be scheduled of the current scheduling node from the tasks to be scheduled according to the scheduling node query index of each task to be scheduled and the position index of the current scheduling node in the task scheduling node list, and obtaining the target task.
And step 305, scheduling the target task to the service server for execution.
In an optional specific embodiment of the present invention, the task scheduling method of the present invention further includes stopping sending the running state information of the current scheduling node to the management node, so that the management node moves the current scheduling node out of the task scheduling node list.
The alternative embodiment is suitable for when the number of the scheduling nodes in the service cluster is too large and the capacity reduction is needed. Can facilitate the convenient capacity shrinking.
Specifically, the management node may determine, according to the heartbeat time, whether the current scheduling node in the task scheduling node list is an unavailable scheduling node, specifically may determine, as an available scheduling node, a current scheduling node having a latest heartbeat time within a fourth preset duration, determine, as an unavailable scheduling node, a current scheduling node having a latest heartbeat time outside the fourth preset duration, and may shift the unavailable heartbeat node out of the task scheduling node list. The fourth predetermined period of time may be, for example, 25 to 35 seconds, preferably 30 seconds. The unavailable scheduling node may be, for example, a downtime or capacity shrinking scheduling node.
The embodiment of the invention can acquire the task scheduling list which comprises the running state of each task scheduling node and is determined by the position index of each task scheduling node, and can be beneficial to determining the target task of the current scheduling node based on the total number of available scheduling nodes in the task scheduling list and the position index of the current scheduling node.
Further describing the task scheduling method in another embodiment of the present invention, as shown in fig. 4, the task scheduling method may include the following steps:
step 401, obtaining task identifiers of each task to be scheduled in the service cluster.
Step 402, determining a scheduling node query index of each task to be scheduled according to the task identification and the total number of available scheduling nodes in the task scheduling node list.
Step 403, determining the task to be scheduled of the current scheduling node from the tasks to be scheduled according to the scheduling node query index of each task to be scheduled and the position index of the current scheduling node in the task scheduling node list, and obtaining the target task.
And step 404, scheduling the target task to a service server for execution.
Step 405, obtain the execution result of the target task.
Step 406, if the execution result of the target task is failure, determining the target task as the target task to be executed again, and obtaining the execution time of failure in executing the target task to be executed again.
Step 407, if the execution time of the failure of executing the target task to be executed again last time is within the time range determined according to the preset rule, directly determining the next execution time of the target task to be executed again as the current time.
Specifically, the preset rule may be a time range determined according to the current time and the fifth preset duration, or may be a time range determined according to the next execution time of the target task with the latest next execution time, the current time and the sixth preset duration.
Optionally, the time range determined according to the preset rule may be a fifth preset duration before the current time, and the fifth preset duration may be 30 seconds to 1 minute, preferably 1 minute.
The embodiment of the invention performs compensation scheduling execution of the failed task, and can be beneficial to reducing adverse effects caused by task execution failure.
Fig. 5 is a block diagram of a task scheduling device according to an embodiment of the present invention, where the task scheduling device is integrated in a current scheduling node and is adapted to execute the task scheduling method according to the embodiment of the present invention. As shown in fig. 5, the apparatus may specifically include:
the task obtaining module 501 is configured to obtain task identifiers of tasks to be scheduled in a service cluster. The query index of the corresponding scheduling node can be determined according to the task identification of each task to be scheduled.
The scheduling node query index determining module 502 is configured to determine a scheduling node query index of each task to be scheduled according to the task identifier and the total number of available scheduling nodes in the task scheduling node list. And the target task to be scheduled when the scheduling node is needed is determined according to the scheduling node query index.
The target task obtaining module 503 is configured to determine, according to the scheduling node query index of each task to be scheduled and the position index of the current scheduling node in the task scheduling node list, the task to be scheduled of the current scheduling node from each task to be scheduled, and obtain a target task, so that the current scheduling node can obtain the target task to be scheduled on the premise of not relying on the distributed coordination service and decentralizing, avoid relying on the distributed coordination service, avoid affecting scheduling of all tasks during the unavailable period of the single scheduling service, and improve the overall availability of the scheduling service.
And the scheduling module 504 is used for scheduling the target task to the corresponding service server for execution. The combination of the modules 501-503 can enable the current dispatching node to pick up the target task to be dispatched on the premise of not depending on the distributed coordination service and decentralizing, avoid depending on the distributed coordination service, avoid influencing the dispatching of all tasks during the unavailable period of the single dispatching service, and improve the overall availability of the dispatching service. The processing logic is consistent when each task scheduling node performs task scheduling, so that stateless rows of the scheduling nodes are realized, dynamic capacity reduction and expansion can be performed as required, and the cost is reduced on the premise of ensuring the overall working efficiency of the service cluster; the scheme of the invention is simple to realize and has better portability; in addition, the invention can avoid depending on distributed coordination service, and is beneficial to solving the general problem of distributed task scheduling class by embedding the abstract common module into business application.
Optionally, the scheduling module 504 may be specifically configured to add the target task to a cache of the current scheduling node, and determine a preliminary scheduling target task according to a next execution time of the target task; adding the task to be scheduled to the time round buffer of the current scheduling node; and scheduling the preliminary scheduling target task from the time round buffer memory to the service server for execution at the next execution time.
Optionally, the task scheduling device of the present invention further includes: and the list change monitoring module is used for monitoring whether the task scheduling node list changes.
Optionally, the above list change monitoring module may be specifically configured to obtain a total number of available scheduling nodes in the task scheduling node list and a position index of the available scheduling nodes in the task scheduling node list.
And determining that the task scheduling node list is changed when the total number of available scheduling nodes acquired at the present time is different from the total number of available scheduling nodes acquired at the last time and/or the position index of the available scheduling nodes acquired at the present time in the task scheduling node list is different from the position index of the available scheduling nodes acquired at the last time in the task scheduling node list.
Optionally, the scheduling node query index determining module 502 may be specifically configured to obtain a task identifier of each task to be scheduled in the service cluster if it is monitored that the task scheduling node list is changed.
Optionally, the task scheduling method of the present invention further includes: the information transmission control module is used for transmitting running state information and address information of the current dispatching node to the management node, the running state information is used for determining that the current dispatching node is an available dispatching node by the management node, the address information is used for determining a position index of the current dispatching node by the management node, and the position index is used for adding the current dispatching node into the task dispatching node list by the management node.
Optionally, the information sending control module is further configured to stop sending the running state information of the current scheduling node to the management node, so that the management node moves the current scheduling node out of the task scheduling node list.
In an alternative embodiment of the present invention, the task scheduling device of the present invention further includes: the target task processing module is used for acquiring an execution result of the target task; if the execution result of the target task is failure, determining the target task as the target task to be executed again, and acquiring the execution time of failure of executing the target task to be executed again; and if the failed execution time of the target task to be executed again in the last time is within the preset duration before the current time, directly determining the next execution time of the target task to be executed again as the current time.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above. The specific working process of the functional module described above may refer to the corresponding process in the foregoing method embodiment, and will not be described herein.
The embodiment of the invention also provides electronic equipment, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the task scheduling method provided by any embodiment is realized when the processor executes the program.
The embodiment of the invention also provides a computer readable medium, on which a computer program is stored, the program implementing the task scheduling method provided in any of the above embodiments when executed by a processor.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing an electronic device of an embodiment of the present invention. The electronic device shown in fig. 6 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments of the invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules and/or units involved in the embodiments of the present invention may be implemented in software, or may be implemented in hardware. The described modules and/or units may also be provided in a processor, e.g., may be described as: a processor includes a task acquisition module, a scheduling node query index determination module, a target task acquisition module, and a scheduling module. The names of these modules do not constitute a limitation on the module itself in some cases.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer-readable medium carries one or more programs which, when executed by one of the devices, cause the device to implement: acquiring task identifiers of all tasks to be scheduled in a service cluster; determining scheduling node query indexes of each task to be scheduled according to the task identification and the total number of available scheduling nodes in a task scheduling node list; determining the task to be scheduled of the current scheduling node from each task to be scheduled according to the scheduling node query index of each task to be scheduled and the position index of the current scheduling node in the task scheduling node list, and obtaining a target task; and scheduling the target task to a service server for execution.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A task scheduling method, characterized in that it is applied to a current scheduling node, the task scheduling method comprising:
acquiring task identifiers of all tasks to be scheduled in a service cluster;
determining scheduling node query indexes of the tasks to be scheduled according to the task identifications and the total number of available scheduling nodes in a task scheduling node list;
determining the task to be scheduled of the current scheduling node from the tasks to be scheduled according to the scheduling node query index of the tasks to be scheduled and the position index of the current scheduling node in the task scheduling node list, and obtaining a target task; and
and dispatching the target task to a service server for execution.
2. The task scheduling method according to claim 1, further comprising, before acquiring a task identifier of each task to be scheduled in the service cluster:
monitoring whether the task scheduling node list changes;
and if the task scheduling node list is monitored to be changed, triggering and executing task identifiers of all tasks to be scheduled in the acquired service cluster.
3. The task scheduling method according to claim 2, wherein the monitoring whether the task scheduling node list is changed comprises:
acquiring the total number of available scheduling nodes in the task scheduling node list and the position index of the available scheduling nodes in the task scheduling node list;
and determining that the task scheduling node list is changed when the total number of available scheduling nodes acquired at the time is different from the total number of available scheduling nodes acquired at the last time and/or the position index of the available scheduling nodes acquired at the time in the task scheduling node list is different from the position index of the available scheduling nodes acquired at the last time in the task scheduling node list.
4. The task scheduling method according to claim 1, further comprising, before acquiring a task identifier of each task to be scheduled in the service cluster:
and sending running state information and address information of the current scheduling node to a management node, wherein the running state information is used for determining that the current scheduling node is the available scheduling node by the management node, the address information is used for determining a position index of the current scheduling node by the management node, and the position index is used for adding the current scheduling node into the task scheduling node list by the management node.
5. The task scheduling method according to claim 4, characterized in that the task scheduling method further comprises:
and stopping sending the running state information of the current scheduling node to the management node so that the management node moves the current scheduling node out of the task scheduling node list.
6. The task scheduling method according to claim 1, wherein the scheduling the target task to a service server for execution includes:
adding the target task into a cache of the current scheduling node, and determining a target task for preliminary scheduling according to the next execution time of the target task; and
adding the task of the preliminary scheduling target into a time round cache of the current scheduling node;
and scheduling the task to be scheduled from the time round buffer to the service server for execution at the next execution time.
7. The task scheduling method according to claim 6, characterized in that the task scheduling method further comprises:
acquiring an execution result of the target task;
if the execution result of the target task is failure, determining the target task as a target task to be executed again, and acquiring the execution time of failure in executing the target task to be executed again; and
if the execution time of the failure of executing the target task to be executed again last time is within the time range determined according to the preset rule, the next execution time of the target task to be executed again is directly determined as the current time.
8. A task scheduling device integrated in a current scheduling node, the task scheduling device comprising:
the task acquisition module is used for acquiring task identifiers of all tasks to be scheduled in the service cluster;
the scheduling node query index determining module is used for determining the scheduling node query index of each task to be scheduled according to the task identification and the total number of available scheduling nodes in the task scheduling node list;
the target task acquisition module is used for determining the tasks to be scheduled of the current scheduling node from the tasks to be scheduled according to the scheduling node query indexes of the tasks to be scheduled and the position indexes of the current scheduling node in the task scheduling node list to obtain target tasks; and
and the scheduling module is used for scheduling the target task to the corresponding service server for execution.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the task scheduling method of any one of claims 1 to 7 when executing the program.
10. A computer readable storage medium having stored thereon a computer program, characterized in that the program, when executed by a processor, implements the task scheduling method according to any one of claims 1 to 7.
CN202311267141.5A 2023-09-27 2023-09-27 Task scheduling method and device, electronic equipment and storage medium Pending CN117331662A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311267141.5A CN117331662A (en) 2023-09-27 2023-09-27 Task scheduling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311267141.5A CN117331662A (en) 2023-09-27 2023-09-27 Task scheduling method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117331662A true CN117331662A (en) 2024-01-02

Family

ID=89274834

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311267141.5A Pending CN117331662A (en) 2023-09-27 2023-09-27 Task scheduling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117331662A (en)

Similar Documents

Publication Publication Date Title
US10949254B2 (en) Systems and methods for scheduling tasks
CN108182111B (en) Task scheduling system, method and device
US20200328984A1 (en) Method and apparatus for allocating resource
CN111950988B (en) Distributed workflow scheduling method and device, storage medium and electronic equipment
CN107545338B (en) Service data processing method and service data processing system
CN109408205B (en) Task scheduling method and device based on hadoop cluster
CN109257399B (en) Cloud platform application program management method, management platform and storage medium
CN109766172B (en) Asynchronous task scheduling method and device
CN114020470A (en) Resource allocation method, device, readable medium and electronic equipment
CN111258726B (en) Task scheduling method and device
CN110673959A (en) System, method and apparatus for processing tasks
CN112231108A (en) Task processing method and device, computer readable storage medium and server
CN112099937A (en) Resource management method and device
CN109428926B (en) Method and device for scheduling task nodes
CN113986534A (en) Task scheduling method and device, computer equipment and computer readable storage medium
CN113722056A (en) Task scheduling method and device, electronic equipment and computer readable medium
CN115328741A (en) Exception handling method, device, equipment and storage medium
CN109828830B (en) Method and apparatus for managing containers
CN105260244A (en) Task scheduling method and device for distributed system
CN114911617A (en) Resource allocation method, device, equipment and medium
CN114116173A (en) Method, device and system for dynamically adjusting task allocation
CN111831503B (en) Monitoring method based on monitoring agent and monitoring agent device
CN116821187A (en) Database-based data processing method and device, medium and electronic equipment
CN117331662A (en) Task scheduling method and device, electronic equipment and storage medium
CN108984770A (en) Method and apparatus for handling data

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