CN113254184A - Task scheduling method, device, scheduling system and storage medium - Google Patents

Task scheduling method, device, scheduling system and storage medium Download PDF

Info

Publication number
CN113254184A
CN113254184A CN202110658691.4A CN202110658691A CN113254184A CN 113254184 A CN113254184 A CN 113254184A CN 202110658691 A CN202110658691 A CN 202110658691A CN 113254184 A CN113254184 A CN 113254184A
Authority
CN
China
Prior art keywords
scheduling
message
service
task
target
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
CN202110658691.4A
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 Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology 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 China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202110658691.4A priority Critical patent/CN113254184A/en
Publication of CN113254184A publication Critical patent/CN113254184A/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

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 invention discloses a task scheduling method, which is applied to scheduling equipment, wherein the scheduling equipment comprises a scheduling service instance, and the method comprises the following steps: reading a target scheduling message of a first message queue; judging the service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue; and if the service state is that the service is opened, determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory. The invention also discloses a task scheduling device, a scheduling system and a computer readable storage medium. By utilizing the task scheduling method, the technical effect of improving the scheduling efficiency is achieved.

Description

Task scheduling method, device, scheduling system and storage medium
Technical Field
The present invention relates to the field of data scheduling, and in particular, to a task scheduling method, device, scheduling system, and computer-readable storage medium.
Background
In the existing scheduling scheme, information such as an execution time expression, execution content, execution script and the like is configured by task management equipment based on scheduling information to obtain a scheduling task, and the scheduling task is executed by scheduling equipment corresponding to the scheduling information.
However, the task scheduling efficiency is low by adopting the existing task scheduling method.
Disclosure of Invention
The invention mainly aims to provide a task scheduling method, a task scheduling device, a task scheduling system and a computer readable storage medium, and aims to solve the technical problem that the scheduling efficiency is low by adopting the existing scheduling method in the prior art.
In order to achieve the above object, the present invention provides a task scheduling method, which is applied to a scheduling device, wherein the scheduling device includes a scheduling service instance, and the method includes the following steps:
reading a target scheduling message of a first message queue;
judging the service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue;
and if the service state is that the service is opened, determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory.
Optionally, after the step of determining the service state of the configured scheduling service instance, the method further includes:
if the service state is that the service is suspended, configuring the execution time of the target scheduling message by using a preset minimum delay time so as to obtain a new target scheduling message;
and adding the new target scheduling message to a third message queue so that the third message queue adds the new target scheduling message to the first message queue when the preset minimum delay time is reached.
Optionally, if the service state is that the service is opened, the step of determining, in the local storage, a selected execution script corresponding to the target scheduling message for executing the scheduling task includes:
if the service state is that the service is opened, acquiring instance version information and queue version information of the scheduling service instance, wherein the queue version information is version information corresponding to the first message queue, the second message queue and the third message queue;
and when the instance version information and the queue version information meet preset conditions and the task state information of the target scheduling message is that a task is started, determining the selected execution script in a local memory, wherein the task state information is broadcasted by the second message queue.
Optionally, the target scheduling message has a target delay time, the target scheduling message is added from the third message queue to the first message queue when the target delay time arrives, and the target scheduling message is created by the task management device and sent to the third message queue;
the service state information and the task state information are created by the task management device and sent to the second message queue.
Optionally, the target scheduling message includes a target trigger name and a target task name; said step of determining said selected execution script in said local memory comprises:
indexing a selected instance name and a selected method name in the local memory using the target trigger name and the target task name;
indexing the selected execution script in the local memory using the selected instance name and the selected method name.
Optionally, before the step of indexing the selected instance name and the selected method name in the local storage by using the target trigger name and the target task name, the method further includes:
receiving a preset execution script sent by the first message queue, a preset trigger name corresponding to the preset execution script and a preset method name corresponding to the preset execution script, wherein the preset execution script comprises the selected execution script, the preset trigger name comprises the selected trigger name, and the preset method name comprises the selected method name;
and storing the preset execution script, the preset trigger name and the preset method name in the local memory.
Optionally, after the step of indexing the selected execution script in the local memory using the selected instance name and the selected method name, the method further comprises:
receiving version updating data broadcasted by the second message queue, wherein the version updating data is sent to the second message queue by the task management equipment;
and updating the scheduling service instance by utilizing the version updating data.
In addition, to achieve the above object, the present invention further provides a task scheduling apparatus, applied to a scheduling device, where the scheduling device includes a scheduling service instance, and the apparatus includes:
the reading module is used for reading the target scheduling message of the first message queue;
the judging module is used for judging the service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue;
and the determining module is used for determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory if the service state is that the service is started.
In addition, to achieve the above object, the present invention further provides a scheduling system, where the scheduling system includes a task management device and a scheduling device, the task management device includes a message queue module, the message queue module includes any one of the first message queue and the second message queue, and the scheduling device includes: memory, a processor and a computer program stored on the memory and running on the processor, which computer program, when executed by the processor, carries out the steps of the scheduling method as defined in any one of the preceding claims.
Furthermore, to achieve the above object, the present invention also proposes a computer readable storage medium having a computer program stored thereon, which when executed by a processor implements the steps of the scheduling method according to any one of the above.
The technical scheme of the invention provides a task scheduling method which is applied to scheduling equipment, wherein the scheduling equipment comprises a scheduling service instance, and the method comprises the following steps: reading a target scheduling message of a first message queue; judging the service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue; and if the service state is that the service is opened, determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory.
In the existing scheduling method, technicians need to manually configure the service state of the scheduling service instance in the scheduling device, so that when the scheduling device is used for task scheduling, the consumed time is long, and the scheduling efficiency is low. In the invention, the scheduling equipment configures the service state of the scheduling service instance based on the service state information broadcasted by the second message queue, and does not need the user to manually configure the service state, so that the time consumption is less, and the scheduling efficiency is higher. Therefore, the task scheduling method achieves the technical effect of improving the scheduling efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a scheduling device of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a method for scheduling tasks according to the present invention;
FIG. 3 is a flowchart illustrating a task scheduling method according to a second embodiment of the present invention;
FIG. 4 is a block diagram of a task scheduler according to an embodiment of the present invention;
FIG. 5 is a block diagram of a scheduling system according to an embodiment of the present invention;
fig. 6 is a block diagram of a scheduling system according to another embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The main solution of the embodiment of the application is as follows: a task scheduling method is provided and applied to scheduling equipment, wherein the scheduling equipment comprises a scheduling service instance, and the method comprises the following steps: reading a target scheduling message of a first message queue; judging the service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue; and if the service state is that the service is opened, determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory.
In the prior art, information such as an execution time expression, execution content, an execution script and the like is configured by task management equipment based on a scheduling message to obtain a scheduling task, and the scheduling equipment corresponding to the scheduling message executes the scheduling task, so that the task scheduling efficiency is low. The method of the application has the advantages that the scheduling equipment performs the configuration of the service state of the scheduling service instance based on the service state information broadcasted by the second message queue, and does not need the user to manually perform the configuration of the service state, so that the consumed time is short, and the scheduling efficiency is high. Therefore, the task scheduling method achieves the technical effect of improving the scheduling efficiency.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a scheduling device of a hardware operating environment according to an embodiment of the present invention.
Generally, a scheduling apparatus includes: at least one processor 301, a memory 302 and a computer program stored on said memory and executable on said processor, said computer program being configured to implement the steps of the scheduling method as described before.
The processor 301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 301 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 301 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. Processor 301 may also include an AI (Artificial Intelligence) processor for processing relevant scheduling method operations such that the scheduling method model may be trained autonomously, improving efficiency and accuracy.
Memory 302 may include one or more computer-readable storage media, which may be non-transitory. Memory 302 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 302 is used to store at least one instruction for execution by processor 301 to implement the scheduling methods provided by method embodiments herein.
In some embodiments, the terminal may further include: a communication interface 303 and at least one peripheral device. The processor 301, the memory 302 and the communication interface 303 may be connected by a bus or signal lines. Various peripheral devices may be connected to communication interface 303 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 304, a display screen 305, and a power source 306.
The communication interface 303 may be used to connect at least one peripheral device related to I/O (Input/Output) to the processor 301 and the memory 302. In some embodiments, processor 301, memory 302, and communication interface 303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 301, the memory 302 and the communication interface 303 may be implemented on a single chip or circuit board, which is not limited in this embodiment.
The Radio Frequency circuit 304 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 304 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 304 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 304 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 304 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 304 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 305 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 305 is a touch display screen, the display screen 305 also has the ability to capture touch signals on or over the surface of the display screen 305. The touch signal may be input to the processor 301 as a control signal for processing. At this point, the display screen 305 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 305 may be one, the front panel of the electronic device; in other embodiments, the display screens 305 may be at least two, respectively disposed on different surfaces of the electronic device or in a folded design; in still other embodiments, the display screen 305 may be a flexible display screen disposed on a curved surface or a folded surface of the electronic device. Even further, the display screen 305 may be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display screen 305 may be made of LCD (liquid crystal Display), OLED (Organic Light-Emitting Diode), and the like.
The power supply 306 is used to power various components in the electronic device. The power source 306 may be alternating current, direct current, disposable or rechargeable. When the power source 306 includes a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology. Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the scheduling apparatus and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the scheduling method as described above. Therefore, a detailed description thereof will be omitted. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in embodiments of the computer-readable storage medium referred to in the present application, reference is made to the description of embodiments of the method of the present application. Determining by way of example, the program instructions may be deployed to be executed on one scheduling device or on multiple scheduling devices located at one site or distributed across multiple sites and interconnected by a communication network.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The computer-readable storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Based on the above hardware structure, an embodiment of the scheduling method of the present invention is provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a task scheduling method according to a first embodiment of the present invention, where the method is used for scheduling devices, and the method includes the following steps:
step S11: and reading the target scheduling message of the first message queue.
In a specific implementation process, the first message queue refers to a message queue for storing scheduling messages consumed immediately, the terminal device obtains the scheduling messages in the first message queue in real time, and the target scheduling message is the scheduling message read in real time at any moment in the first message queue. Specifically, the target scheduling message is added to the first queue message (a specific adding time is described below) through the third message queue by the task management device, and the purpose of adding the scheduling message for task scheduling to the message queue is to decouple the sending and execution of the scheduling message, so that the subsequent scheduling device can be used at any time, and the flexible and efficient technical effect of task scheduling is achieved.
Step S12: judging the service state of the configured scheduling service instance; and the service state of the scheduling service instance is configured by receiving the service state information broadcasted by the second message queue.
It should be noted that the execution subject of the present invention is a scheduling device, the scheduling device is installed with a computer program, and when the scheduling device executes the computer program, the scheduling method of the present invention is implemented. The scheduling device also comprises a scheduling service instance, the scheduling device completes the final scheduling task through the scheduling service instance, namely, executes the selected execution script of the invention, and one scheduling device can comprise a plurality of scheduling service instances or one scheduling service instance.
The scheduling information is created and issued by the task management device (also called scheduling server), and the target scheduling information is the scheduling information issued by the task management device when the task scheduling method of the present invention is executed.
The scheduling messages issued by the task management device are all delayed, and after the task management device creates the scheduling messages, the scheduling messages are sent to a third message queue (also called a delay queue). When one scheduling message in the third message queue arrives at the corresponding delay time, the third message queue adds the scheduling message to the first message queue (also called a task queue); the scheduling messages in the first message queue will be consumed immediately by the scheduling device, i.e. the scheduling messages in the first message queue will be read immediately.
It is to be understood that the target scheduling message has a target delay time, the target scheduling message is added from the third message queue to the first message queue when the target delay time is reached, and the target scheduling message is created by the task management device and sent to the third message queue.
It should be noted that, based on the operation or requirement of the user, the task management device creates the target scheduling message and adds the target scheduling message to the third message queue, where the target scheduling message sets a delay time (the messages in the delay message queue all have delay times, and the delay times corresponding to different messages are different and can be long or short, and for immediate execution, the delay time is set to be the shortest delay time, for example, 1ms), and the delay time of the target scheduling message is the target delay time; when the target delay time is reached, the third message queue takes out the target scheduling message and puts the target scheduling message into the first message queue, and then step S11 is executed without waiting; and a certain scheduling message in the third message queue needs to wait for the delay time corresponding to the scheduling message to arrive, and then the scheduling message can be added into the first message queue for direct consumption.
It should be noted that, the number of scheduling devices generally used for task scheduling is plural, and the second message queue is a broadcast queue, that is, a message is issued in a broadcast manner. In some embodiments, the scheduling device may also include one, the second message queue being a point-to-point message queue.
The service state information comprises start service information and pause service information, the service state of the scheduling service instance is that the service is started after the scheduling device performs service state configuration of the scheduling service instance based on the start service information, and the service state of the scheduling service instance is that the service is paused after the scheduling device performs service state configuration of the scheduling service instance based on the pause service information.
Step S13: and if the service state is that the service is opened, determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory.
It should be noted that, only when the service state is that the service is opened, the target scheduling message may be continuously consumed, that is, the step of determining the selected execution script for executing the scheduling task corresponding to the target scheduling message in the local memory is performed.
If the service state is that the service is suspended, configuring the execution time of the target scheduling message by using a preset minimum delay time so as to obtain a new target scheduling message; and adding the new target scheduling message to a third message queue so that the third message queue adds the new target scheduling message to the first message queue when the preset minimum delay time is reached.
It should be noted that the preset minimum delay time may be set by the user based on the requirement, for example, 1 ms. When the service state is that the service is suspended, the scheduling device cannot consume the target scheduling message, and needs to configure a new execution time (consumption time of the scheduling message), that is, configure a new delay time (the new delay time is the preset minimum delay time), and add the new delay time to the third message queue, so as to enable the third message queue, and when the preset minimum delay time is reached, add the new target scheduling message to the first message queue, so as to implement the step of re-consumption.
Further, if the service state is that the service is opened, the step of determining a selected execution script corresponding to the target scheduling message for executing the scheduling task in the local memory includes:
if the service state is that the service is opened, acquiring instance version information and queue version information of the scheduling service instance, wherein the queue version information is version information corresponding to the first message queue, the second message queue and the third message queue; and when the instance version information and the queue version information meet preset conditions and the task state information of the target scheduling message is that a task is started, determining the selected execution script in a local memory, wherein the task state information is broadcasted by the second message queue.
It should be noted that the service status information and the task status information are created by the task management device and sent to the second message queue. When a plurality of scheduling devices are provided, the first message queue is a broadcast queue, that is, the service state information includes service state information corresponding to the plurality of scheduling devices, the task state information includes task state information corresponding to a plurality of target scheduling messages, and the service state information and the task state information are respectively sent in a broadcast message manner.
Generally, the preset condition is that the instance version information and the queue version information are consistent. When the instance version information and the queue version information are that the instance version number is lower than the queue version number, the target scheduling message may be configured with a minimum delay time (e.g., 1ms), and the configured target scheduling message is added to the third message queue, so as to continue to make the configured target scheduling message execute the steps of the task scheduling method of the present invention. If the instance version information and the queue version information indicate that the instance version number is higher than the queue version number, discarding the target scheduling message, returning to step S11 again, and waiting for reading a new target scheduling message in the first message queue to continue executing the steps of the scheduling method of the present invention.
In addition, when the instance version information and the queue version information meet preset conditions and the configured task state is that the task is suspended, a timing task expression of the target scheduling message is obtained, and the next execution time and the current time are determined by using the timing task expression; taking the difference between the next execution time and the current time as a configuration delay time; configuring the target scheduling message by using the configuration delay time to obtain a configured target scheduling message; and adding the configured target scheduling message to the third message queue to continue executing the task scheduling step of the invention.
Specifically, the target scheduling message includes a target trigger name and a target task name; said step of determining said selected execution script in said local memory comprises: indexing a selected instance name and a selected method name in the local memory using the target trigger name and the target task name; indexing the selected execution script in the local memory using the selected instance name and the selected method name.
It should be noted that the trigger names and task names included in different scheduling messages are different, and the corresponding instance names and method names are different; different instance names and method names correspond to different execution scripts; it is understood that the instance name and method name definitions are referred to as a key from which the corresponding value (execution script) is found.
Further, before the step of indexing a selected instance name and a selected method name in the local memory using the target trigger name and the target task name, the method further comprises: receiving a preset execution script sent by the first message queue, a preset trigger name corresponding to the preset execution script and a preset method name corresponding to the preset execution script, wherein the preset execution script comprises the selected execution script, the preset trigger name comprises the selected trigger name, and the preset method name comprises the selected method name; and storing the preset execution script, the preset trigger name and the preset method name in the local memory.
It will be appreciated that the execution script is also published by the second message queue, received and stored by the scheduling device, to enable utilization of the execution script.
In other embodiments, if the corresponding execution script is not found in the local memory, the native system stored in the scheduling device may search for the corresponding selected execution script, and when the selected execution script is found, step S13 is executed. If the selected execution script is found, the scheduling is stopped.
It should be noted that, the message attributes of the scheduling messages in the first message queue and the third message queue of the present invention refer to table 1, where table 1 is as follows:
TABLE 1
Figure BDA0003113261200000101
Figure BDA0003113261200000111
Referring to table 1, the target scheduling message includes a target trigger name and a target task name, the scheduling messages in the second message queue and the third message queue both have their own triggers and their own target tasks, the triggers and the tasks are combined information, and the corresponding selected combined information (selected instance name and selected method name) needs to be determined according to the combined information.
It can be understood that the selected execution script corresponding to the target scheduling message is determined by locally storing the target trigger and the target task in the target scheduling message as a basis, that is, the corresponding relationship is that the target trigger and the target task are used as the combination information, and the script is correspondingly executed.
Further, after the step of indexing the selected execution script in the local memory using the selected instance name and the selected method name, the method further comprises: receiving version updating data broadcasted by the second message queue, wherein the version updating data is sent to the second message queue by the task management equipment; and updating the scheduling service instance by utilizing the version updating data.
That is, the version of the scheduling service instance in the scheduling device can be flexibly updated, and the version is updated based on the version update data issued by the task management device through the second message queue, so as to ensure that the version information and the queue version information of the scheduling service instance in the scheduling device meet the preset condition.
In some embodiments, the first message queue has four types, and the specific definition of the four types refers to table 2, where table 2 is as follows:
TABLE 2
Figure BDA0003113261200000112
Figure BDA0003113261200000121
For the four different types of messages in table 2, the attribute information included in them refers to table 3, table 4, table 5, and table 6, where table 1 is the attribute at least included in the VERSION message, table 4 is the attribute at least included in the SERVICE message, table 5 is the attribute at least included in the TASK message, and table 6 is the attribute at least included in the NEW _ TASK message. Tables 3, 4, 5 and 6 are as follows:
TABLE 3
Figure BDA0003113261200000122
TABLE 4
Properties Description of the invention
node And scheduling the name of the service node, and if the name is null, indicating that all the nodes need to be processed
option Operation, if 1, then on, if 2, then off
TABLE 5
Figure BDA0003113261200000123
TABLE 6
Figure BDA0003113261200000131
Referring to fig. 3, fig. 3 is a flowchart illustrating a task scheduling method according to a second embodiment of the present invention.
Specifically, the explanation will be made by taking fig. 3 as an example. When the scheduling device comprises a plurality of scheduling devices, each scheduling device at least comprises one scheduling service instance, the scheduling device needs to judge whether the service state of each scheduling service instance in each scheduling device is opened or not after reading the target scheduling message of the first message queue type, and when a selected scheduling service instance with the service state of being opened exists in all scheduling service instances, the scheduling device continues to determine whether the instance version information is matched with the queue version information or not; when the instance version information is matched with the queue version information, whether the task state of the target scheduling message is started or not is continuously judged; if the example version information is that the example version number is high, the target scheduling message cannot be consumed, discarding the target scheduling message, and if the queue version information is that the queue version number is high, configuring minimum delay time for the target scheduling message, and adding the minimum delay time to a third message queue; when the task state is that the task is started, whether the task state of the target scheduling message in the corresponding selected scheduling service instance is started or not is continuously judged, namely, one target scheduling message cannot be executed by all the selected scheduling service instances and is only executed by one part; when the task state of the target scheduling message is pause, determining the execution time for executing the target scheduling message next time (the execution time is usually the time after the current execution time) based on the timing task expression of the target scheduling message, configuring the target scheduling message by using the execution time, and adding the target scheduling message to a third message queue so as to continue to enable the configured target scheduling message to be consumed by other service instances to execute the steps of the scheduling method; and when the task state of the target scheduling message is closed, discarding the target scheduling message.
When the service states of the scheduling service instances are all suspended, the target scheduling message may be configured with a minimum delay time (e.g., 1ms), and the configured target scheduling message is added to the third message queue, so as to continue to be consumed by other service instances, so as to execute the steps of the scheduling method of the present invention.
When the task state of the target scheduling message in the corresponding selected scheduling service instance is on, the timed task expression type in each target scheduling message is continuously judged, when the timed task expression type is timed execution, the difference between the current execution time and the current time needs to be determined, when the current execution time of one target scheduling message is after the current time, the target scheduling message is added to a third message queue (the difference between the current execution time and the current time is used as delay time for configuring the target scheduling message), and when the current execution time of one target scheduling message is before the current time, the target scheduling message is directly consumed.
When the task state of the target scheduling message in the corresponding selected scheduling service instance is started and the type of the timing task expression is interval execution, the target scheduling message is directly consumed, the timing task expression in the target scheduling message is utilized to calculate the next execution time, the target scheduling message is configured by utilizing the next execution time, and the configured target scheduling message is added to a third message queue.
When the task state of the corresponding selected scheduling service instance is suspension, a target scheduling message may be configured with a minimum delay time (e.g., 1ms), and the configured target scheduling message is added to the third message queue, so as to continue to make the configured target scheduling message perform the steps of the scheduling method of the present invention.
The technical scheme of the invention provides a task scheduling method which is applied to scheduling equipment, wherein the scheduling equipment comprises a scheduling service instance, and the method comprises the following steps: reading a target scheduling message of a first message queue; judging the service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue; and if the service state is that the service is opened, determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory.
In the existing scheduling method, technicians need to manually configure the service state of the scheduling service instance in the scheduling device, so that when the scheduling device is used for task scheduling, the consumed time is long, and the scheduling efficiency is low. In the invention, the scheduling equipment configures the service state of the scheduling service instance based on the service state information broadcasted by the second message queue, and does not need the user to manually configure the service state, so that the time consumption is less, and the scheduling efficiency is higher. Therefore, the task scheduling method achieves the technical effect of improving the scheduling efficiency.
The invention receives version updating data, dynamic scripts, service state information, task state information and the like in the second message queue, so that the scheduling service has the capability of expanding scheduling tasks during running, the service state and the task state can be flexibly adjusted, the remote updating of the version of the scheduling service instance and the remote updating of the execution script can be realized, and the updating process is flexible and convenient; meanwhile, the service state information and the task state information sent by the second message queue can be used for dynamically managing the scheduling instances and the scheduling tasks (scheduling messages) (service state configuration and task state configuration), and even managing the specified tasks of the specified scheduling instances, so that the task scheduling flexibility is good.
Referring to fig. 4, fig. 4 is a block diagram of a task scheduling apparatus according to an embodiment of the present invention, the apparatus is used for scheduling devices, and based on the same inventive concept as the foregoing embodiment, the apparatus includes:
a reading module 10, configured to read a target scheduling message of a first message queue;
a judging module 20, configured to judge a service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue;
a determining module 30, configured to determine, if the service state is that the service is opened, a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory.
It should be noted that, since the steps executed by the apparatus of this embodiment are the same as the steps of the foregoing method embodiment, the specific implementation and the achievable technical effects thereof can refer to the foregoing embodiment, and are not described herein again.
Referring to fig. 5, fig. 5 is a block diagram of a scheduling system according to an embodiment of the present invention; fig. 6 is a block diagram of a scheduling system according to another embodiment of the present invention. The scheduling system includes a task management device and a scheduling device, the task management device includes a message queue module, the message queue module includes any one of the first message queue and the second message queue, and the scheduling device includes: memory, a processor and a computer program stored on the memory and running on the processor, which computer program, when executed by the processor, carries out the steps of the scheduling method as defined in any one of the preceding claims.
It should be noted that, referring to fig. 5, the task management device may be a hardware device, which includes a message queue module; as an embodiment, referring to fig. 6, the task management device may also include a first subtask device for setting the message queue module and a second subtask device for task configuration. In a specific implementation process, both the devices in fig. 5 and fig. 6 may be configured to execute the task scheduling method in the foregoing embodiment, as long as an independent message queue module is provided and task scheduling is performed by using the method in the foregoing embodiment, separation of scheduling and execution may be achieved, where scheduling is based on a queue and execution is based on a code, and efficiency of task scheduling is further improved. Therefore, for various implementation manners in this embodiment, reference may be made to the implementation manners and achieved technical effects in the foregoing embodiments, and details are not described here.
In some embodiments, the message queue module further comprises a third message queue. The embodiments related to each device and module in the scheduling system refer to the above description, and are not described herein again.
The above description is only an alternative embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A task scheduling method is applied to scheduling equipment, wherein the scheduling equipment comprises a scheduling service instance, and the method comprises the following steps:
reading a target scheduling message of a first message queue;
judging the service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue;
and if the service state is that the service is opened, determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory.
2. The method of claim 1, wherein after the step of determining the configured service status of the scheduled service instance, the method further comprises:
if the service state is that the service is suspended, configuring the execution time of the target scheduling message by using a preset minimum delay time so as to obtain a new target scheduling message;
and adding the new target scheduling message to a third message queue so that the third message queue adds the new target scheduling message to the first message queue when the preset minimum delay time is reached.
3. The method of claim 2, wherein said step of determining a selected execution script in a local memory for executing a scheduled task corresponding to said target scheduling message if said service status is service open comprises:
if the service state is that the service is opened, acquiring instance version information and queue version information of the scheduling service instance, wherein the queue version information is version information corresponding to the first message queue, the second message queue and the third message queue;
and when the instance version information and the queue version information meet preset conditions and the task state information of the target scheduling message is that a task is started, determining the selected execution script in a local memory, wherein the task state information is broadcasted by the second message queue.
4. The method of claim 3, wherein the target scheduling message has a target delay time, the target scheduling message being added from the third message queue to the first message queue upon arrival of the target delay time, the target scheduling message being created by a task management device and sent to the third message queue;
the service state information and the task state information are created by the task management device and sent to the second message queue.
5. The method of claim 4, wherein the target scheduling message includes a target trigger name and a target task name; said step of determining said selected execution script in said local memory comprises:
indexing a selected instance name and a selected method name in the local memory using the target trigger name and the target task name;
indexing the selected execution script in the local memory using the selected instance name and the selected method name.
6. The method of claim 5, wherein prior to the step of indexing a selected instance name and a selected method name in the local memory using the target trigger name and the target task name, the method further comprises:
receiving a preset execution script sent by the first message queue, a preset trigger name corresponding to the preset execution script and a preset method name corresponding to the preset execution script, wherein the preset execution script comprises the selected execution script, the preset trigger name comprises the selected trigger name, and the preset method name comprises the selected method name;
and storing the preset execution script, the preset trigger name and the preset method name in the local memory.
7. The method of claim 6, wherein after the step of indexing the selected execution script in the local memory using the selected instance name and the selected method name, the method further comprises:
receiving version updating data broadcasted by the second message queue, wherein the version updating data is sent to the second message queue by the task management equipment;
and updating the scheduling service instance by utilizing the version updating data.
8. A task scheduling apparatus, applied to a scheduling device, where the scheduling device includes a scheduling service instance, the apparatus includes:
the reading module is used for reading the target scheduling message of the first message queue;
the judging module is used for judging the service state of the configured scheduling service instance; the service state of the scheduling service instance is configured by receiving service state information broadcasted by a second message queue;
and the determining module is used for determining a selected execution script corresponding to the target scheduling message and used for executing the scheduling task in a local memory if the service state is that the service is started.
9. A scheduling system comprising a task management device and a scheduling device, the task management device comprising a message queue module, the message queue module comprising a first message queue and a second message queue according to any one of claims 1-7, the scheduling device comprising: memory, processor and computer program stored on the memory and running on the processor, which computer program, when executed by the processor, carries out the steps of the scheduling method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the scheduling method according to any one of claims 1 to 7.
CN202110658691.4A 2021-06-11 2021-06-11 Task scheduling method, device, scheduling system and storage medium Pending CN113254184A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110658691.4A CN113254184A (en) 2021-06-11 2021-06-11 Task scheduling method, device, scheduling system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110658691.4A CN113254184A (en) 2021-06-11 2021-06-11 Task scheduling method, device, scheduling system and storage medium

Publications (1)

Publication Number Publication Date
CN113254184A true CN113254184A (en) 2021-08-13

Family

ID=77187833

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110658691.4A Pending CN113254184A (en) 2021-06-11 2021-06-11 Task scheduling method, device, scheduling system and storage medium

Country Status (1)

Country Link
CN (1) CN113254184A (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105701099A (en) * 2014-11-25 2016-06-22 阿里巴巴集团控股有限公司 Method and device used for executing task in distributed environment, and distributed task execution system
US20170054828A1 (en) * 2015-08-21 2017-02-23 The Boeing Company Integrated Scheduling of General Messages and Time-Critical Messages
CN106484530A (en) * 2016-09-05 2017-03-08 努比亚技术有限公司 A kind of distributed task dispatching O&M monitoring system and method
CN106815066A (en) * 2015-11-30 2017-06-09 阿里巴巴集团控股有限公司 A kind of timed task dispatching method, apparatus and system
US20180232255A1 (en) * 2017-02-16 2018-08-16 Nasdaq Technology Ab Methods and systems of scheduling computer processes or tasks in a distributed system
CN109766194A (en) * 2018-11-29 2019-05-17 南瑞集团有限公司 The implementation method and its system of message based lower coupling plan target component
CN110245008A (en) * 2018-03-09 2019-09-17 阿里巴巴集团控股有限公司 Timed task processing method, system and equipment
CN110515709A (en) * 2019-07-25 2019-11-29 北京达佳互联信息技术有限公司 Task scheduling system, method, apparatus, electronic equipment and storage medium
CN111221662A (en) * 2019-10-16 2020-06-02 贝壳技术有限公司 Task scheduling method, system and device
CN112506631A (en) * 2020-12-04 2021-03-16 天目数据(福建)科技有限公司 Task scheduling method, platform and storage medium based on electric power big data model
CN112596885A (en) * 2020-12-25 2021-04-02 网易(杭州)网络有限公司 Task scheduling method, device, equipment and storage medium
CN112905339A (en) * 2021-02-08 2021-06-04 中国工商银行股份有限公司 Task scheduling execution method, device and system

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105701099A (en) * 2014-11-25 2016-06-22 阿里巴巴集团控股有限公司 Method and device used for executing task in distributed environment, and distributed task execution system
US20170054828A1 (en) * 2015-08-21 2017-02-23 The Boeing Company Integrated Scheduling of General Messages and Time-Critical Messages
CN106815066A (en) * 2015-11-30 2017-06-09 阿里巴巴集团控股有限公司 A kind of timed task dispatching method, apparatus and system
CN106484530A (en) * 2016-09-05 2017-03-08 努比亚技术有限公司 A kind of distributed task dispatching O&M monitoring system and method
US20180232255A1 (en) * 2017-02-16 2018-08-16 Nasdaq Technology Ab Methods and systems of scheduling computer processes or tasks in a distributed system
CN110245008A (en) * 2018-03-09 2019-09-17 阿里巴巴集团控股有限公司 Timed task processing method, system and equipment
CN109766194A (en) * 2018-11-29 2019-05-17 南瑞集团有限公司 The implementation method and its system of message based lower coupling plan target component
CN110515709A (en) * 2019-07-25 2019-11-29 北京达佳互联信息技术有限公司 Task scheduling system, method, apparatus, electronic equipment and storage medium
CN111221662A (en) * 2019-10-16 2020-06-02 贝壳技术有限公司 Task scheduling method, system and device
CN112506631A (en) * 2020-12-04 2021-03-16 天目数据(福建)科技有限公司 Task scheduling method, platform and storage medium based on electric power big data model
CN112596885A (en) * 2020-12-25 2021-04-02 网易(杭州)网络有限公司 Task scheduling method, device, equipment and storage medium
CN112905339A (en) * 2021-02-08 2021-06-04 中国工商银行股份有限公司 Task scheduling execution method, device and system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
IMAN SADOOGHI等: "Achieving Efficient Distributed Scheduling with Message Queues in the Cloud for Many-Task Computing and High-Performance Computing", 2014 14TH IEEE/ACM INTERNATIONAL SYMPOSIUM ON CLUSTER, CLOUD AND GRID COMPUTING, pages 404 - 413 *
屈志坚等: "调度中心流计算集群排队模型的CQB并行均衡控制方法", 中国电机工程学报, vol. 38, no. 19, pages 5704 - 5713 *
彭田;刘晓建;黄玮琦;: "OpenStack云平台的虚拟机调度算法研究", 电脑知识与技术, no. 18 *

Similar Documents

Publication Publication Date Title
CN108540965B (en) Internet of things communication method and device based on LoRa technology and storage medium
EP2749988B1 (en) Method and device for application program operation, mobile terminal
CN112988362B (en) Task processing method and device, electronic equipment and storage medium
CN110493892B (en) Network connection method and device, storage medium and communication terminal
CN112883036B (en) Index creation method, device, storage server and storage medium
CN112689172A (en) Program playing method and device, set top box and storage medium
CN112612526B (en) Application program control method, device, terminal equipment and storage medium
CN111399874A (en) System upgrading method and device, storage medium and intelligent wearable device
CN115226048B (en) Data transmission method, device, equipment and storage medium
CN113918280A (en) Dynamic adjustment method of virtual machine resources, terminal device and storage medium
CN112583907A (en) Connection method and device, smart home equipment and computer readable storage medium
CN112351097A (en) Device control method, device, sending end and storage medium
CN106954191B (en) Broadcast transmission method, apparatus and terminal device
CN111949187A (en) Electronic whiteboard content editing and sharing method, system, equipment and server
CN113564865A (en) Remote control method and device for washing machine, electronic equipment and storage medium
CN113254184A (en) Task scheduling method, device, scheduling system and storage medium
CN113225234B (en) Asset detection method, device, terminal equipment and computer readable storage medium
CN112350895B (en) Keep-alive method and device for application program, equipment and computer readable storage medium
CN113382014B (en) Negotiation processing method, device, terminal equipment and storage medium
CN111542037B (en) Instruction transmission method, apparatus and storage medium
WO2022127546A1 (en) Gateway service processing method, gateway, receiving terminal, gateway service processing system, and storage medium
CN114222370A (en) Networking communication time slot allocation method, device and system
CN112346885A (en) Electronic device control method, device, equipment and computer readable storage medium
CN109426572B (en) Task processing method and device and electronic equipment
JP2021532663A (en) Information receiving method, information transmitting method, terminal and network side device

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