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

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

Info

Publication number
CN116360937A
CN116360937A CN202310159974.3A CN202310159974A CN116360937A CN 116360937 A CN116360937 A CN 116360937A CN 202310159974 A CN202310159974 A CN 202310159974A CN 116360937 A CN116360937 A CN 116360937A
Authority
CN
China
Prior art keywords
server
task
processing
target task
time stamp
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
CN202310159974.3A
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 Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202310159974.3A priority Critical patent/CN116360937A/en
Publication of CN116360937A publication Critical patent/CN116360937A/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)
  • Computer And Data Communications (AREA)

Abstract

The disclosure provides a task scheduling method, a device, equipment and a storage medium, which can be applied to the technical field of computers. The method comprises the following steps: acquiring a task set from a configuration database by using a first server, wherein the task set comprises a plurality of tasks; determining a target task to be processed from a plurality of tasks in a task set; determining a second server matched with the target task from a task configuration table, wherein the task configuration table comprises an allocation relation between the target task and the second server for processing the target task by default; under the condition that the first server is different from the second server, acquiring a first processing time stamp of the target task; and under the condition that the difference value between the first processing time stamp and the current time stamp is larger than the preset time threshold value, processing the target task by using the first server.

Description

Task scheduling method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technology, and in particular, to a task scheduling method, apparatus, device, medium, and program product.
Background
Task scheduling is often performed by a server, which typically schedules the server to process tasks according to some fixed scheduling rules, and for each of the tasks, typically assigns a designated server to process the task.
In the process of implementing the disclosed concept, the inventor finds that at least the following problems exist in the related art: the task scheduling method in the related art cannot process the task in time, so that the processing efficiency of the task is low.
Disclosure of Invention
In view of the foregoing, the present disclosure provides a task scheduling method, apparatus, device, medium, and program product.
According to a first aspect of the present disclosure, there is provided a task scheduling method, including:
acquiring a task set from a configuration database by using a first server, wherein the task set comprises a plurality of tasks;
determining a target task to be processed from a plurality of tasks in a task set;
determining a second server matched with the target task from a task configuration table, wherein the task configuration table comprises an allocation relation between the target task and the second server for processing the target task by default;
under the condition that the first server is different from the second server, acquiring a first processing time stamp of the target task;
and under the condition that the difference value between the first processing time stamp and the current time stamp is larger than the preset time threshold value, processing the target task by using the first server.
According to an embodiment of the present disclosure, in a case where it is determined that a difference between the first processing timestamp and the current timestamp is greater than a preset time threshold, processing, with the first server, the target task includes:
updating the first processing time stamp of the target task under the condition that the time difference value between the first processing time stamp and the current time stamp is larger than a preset time threshold value;
under the condition that the first processing time stamp is successfully updated, processing the target task by using a first server;
in the case where it is determined that the first processing time stamp update fails, a first task other than the target task is determined from the plurality of tasks using the first server.
According to an embodiment of the present disclosure, in a case where it is determined that the first server is not the same as the second server, obtaining a first processing timestamp of the target task includes:
determining first server identification information corresponding to a first server according to the first server;
determining second server identification information corresponding to a second server according to the second server;
comparing the first server identification information with the second server identification information to obtain a comparison result;
and under the condition that the comparison result is determined to be used for representing that the first server identification information is different from the second server identification information, acquiring a first processing time stamp of the target task.
According to an embodiment of the present disclosure, determining, from a task configuration table, a second server adapted to a target task includes:
determining target identification information matched with a target task;
and determining a second server which is matched with the target task from the task configuration table according to the target identification information.
According to an embodiment of the present disclosure, the task scheduling method further includes:
determining a second task except the target task from a plurality of tasks in the task set under the condition that the time difference value between the first processing time stamp and the current time stamp is less than or equal to a preset time threshold;
determining a third server matched with the second task from a task configuration table, wherein the task configuration table comprises an allocation relation between the second task and the third server for processing the second task by default;
acquiring a second processing time stamp of a second task under the condition that the first server is determined to be different from the third server;
and processing the second task by using the first server under the condition that the time difference value between the second processing time stamp and the current time stamp is determined to be larger than a preset time threshold value.
According to an embodiment of the present disclosure, the task scheduling method further includes:
Updating a first processing time stamp of the target task in the case that the first server is determined to be the same as the second server;
and processing the target task by using the first server under the condition that the first processing time stamp is successfully updated.
A second aspect of the present disclosure provides a task scheduling device, including:
the first acquisition module is used for acquiring a task set from the configuration database by utilizing a first server, wherein the task set comprises a plurality of tasks;
the first determining module is used for determining a target task to be processed from a plurality of tasks in the task set;
the second determining module is used for determining a second server which is matched with the target task from a task configuration table, wherein the task configuration table comprises an allocation relation between the target task and the second server which processes the target task by default;
the second acquisition module is used for acquiring a first processing time stamp of the target task under the condition that the first server is determined to be different from the second server;
and the first processing module is used for processing the target task by using the first server under the condition that the difference value between the first processing time stamp and the current time stamp is determined to be larger than a preset time threshold value.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method described above.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described method.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above method.
According to the task scheduling method, the device, the equipment, the medium and the program product provided by the disclosure, a task set is obtained from a configuration database by utilizing a first server, wherein the task set comprises a plurality of tasks; determining a target task to be processed from a plurality of tasks in a task set; determining a second server matched with the target task from a task configuration table, wherein the task configuration table comprises an allocation relation between the target task and the second server for processing the target task by default; under the condition that the first server is different from the second server, acquiring a first processing time stamp of the target task; and under the condition that the difference value between the first processing time stamp and the current time stamp is larger than a preset time threshold value, utilizing the technical means of the first server to process the target task. The first server is used for acquiring the task set, the second server of the target task is determined according to the target task in the task set, and the target task is determined to be processed by the first server according to the first processing time stamp of the target task under the condition that the first server and the second server are different, so that the second server of the target task can be switched without manual intervention, the technical problem that the task cannot be processed timely by a task scheduling method in the related technology is at least partially solved, the technical problem of lower processing efficiency of the task is caused, and the technical effect of improving the task processing efficiency is realized.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be more apparent from the following description of embodiments of the disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of a task scheduling method according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a task scheduling method according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a schematic diagram of a configuration database according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart of a task scheduling method according to yet another embodiment of the present disclosure;
FIG. 5 schematically illustrates a block diagram of a task scheduler according to an embodiment of the present disclosure; and
fig. 6 schematically illustrates a block diagram of an electronic device adapted to implement a task scheduling method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
In the technical scheme of the disclosure, the related data (such as including but not limited to personal information of a user) are collected, stored, used, processed, transmitted, provided, disclosed, applied and the like, all conform to the regulations of related laws and regulations, necessary security measures are adopted, and the public welcome is not violated.
The task scheduling method is that a plurality of servers are used for distributing and processing a plurality of tasks, each task is provided with a default processing server, other servers are used as task standby servers, and when a certain server is suspended or down due to abnormality, the other servers need to temporarily take over the tasks originally taken over by the server to ensure the continuous execution of the task. In the related technology, one embodiment is to execute manual task scheduling switching by manually modifying task scheduling configuration and other methods after the system monitors alarms, and the other embodiment is to introduce cluster middleware and complete task scheduling switching by building and configuring the middleware. The manual switching method needs manual intervention, and lacks timeliness and automaticity; the method for adopting the cluster middleware can increase the system volume, improve the system cost and make the system configuration relatively complicated.
In view of this, an embodiment of the present disclosure provides a task scheduling method, including: acquiring a task set from a configuration database by using a first server, wherein the task set comprises a plurality of tasks; determining a target task to be processed from a plurality of tasks in a task set; determining a second server matched with the target task from a task configuration table, wherein the task configuration table comprises an allocation relation between the target task and the second server for processing the target task by default; under the condition that the first server is different from the second server, acquiring a first processing time stamp of the target task; and under the condition that the difference value between the first processing time stamp and the current time stamp is larger than the preset time threshold value, processing the target task by using the first server.
Fig. 1 schematically illustrates an application scenario diagram of a task scheduling method according to an embodiment of the present disclosure.
As shown in fig. 1, an application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is a medium used to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others. There may be a plurality of servers 105.
The user may interact with the server 105 through the network 104 using at least one of the first terminal device 101, the second terminal device 102, the third terminal device 103, to receive or send messages, etc. Various communication client applications, such as a shopping class application, a web browser application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only) may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
The first terminal device 101, the second terminal device 102, the third terminal device 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
The server 105 may be used to process tasks transmitted by the first terminal device 101, the second terminal device 102, and the third terminal device 103 via the network 104, or may be used to process tasks generated by the server 105 itself.
It should be noted that, the task scheduling method provided by the embodiments of the present disclosure may be generally performed by the server 105. Accordingly, the task scheduling device provided by the embodiments of the present disclosure may be generally disposed in the server 105. The task scheduling method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105. Accordingly, the task scheduling device provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The task scheduling method of the disclosed embodiment will be described in detail below with reference to fig. 2 to 4 based on the scenario described in fig. 1.
Fig. 2 schematically illustrates a flow chart of a task scheduling method according to an embodiment of the present disclosure.
As shown in fig. 2, the task scheduling method of this embodiment includes operations S210 to S250.
In operation S210, a task set is obtained from a configuration database using a first server, wherein the task set includes a plurality of tasks.
According to an embodiment of the present disclosure, the task may be an operation that the server needs to perform by the terminal device to send to the server, or may be automatically generated by the server based on its own setting.
According to embodiments of the present disclosure, the configuration database may include state information of the first server, data amount information of a plurality of tasks in the task set, and so on.
Fig. 3 schematically illustrates a schematic diagram of a configuration database according to an embodiment of the present disclosure.
As shown in fig. 3, there may be a plurality of first servers, and each first server may obtain a task set from the configuration database, where the task set includes a plurality of tasks.
In operation S220, a target task to be processed is determined from among a plurality of tasks in the task set.
According to the embodiment of the disclosure, a predetermined time point may be set for each of a plurality of tasks in a task set, and a task satisfying the predetermined time point may be determined as a target task to be processed; the tasks in the task set can be sequenced according to the importance degree of the tasks, the tasks with higher importance degree are sequenced before the tasks with lower importance degree are sequenced after the tasks with lower importance degree, and the target tasks to be processed are determined according to the sequence from front to back.
In operation S230, a second server adapted to the target task is determined from a task configuration table, wherein the task configuration table includes an allocation relationship between the target task and the second server which processes the target task by default.
According to the embodiment of the disclosure, the second server may be one or more determined from a plurality of servers, the task configuration table may be configured according to an operation state of the second server, for example, the operation states of the plurality of servers may be checked, a server with a normal operation state is selected and determined as the second server, and the plurality of tasks are allocated to the second server, so that an allocation relationship between each task of the plurality of tasks and the second server which processes each task by default is determined, and a task configuration table is obtained, so that a second server adapted to the target task may be determined from the task configuration table in the case that the target task is determined.
In operation S240, in case it is determined that the first server is not identical to the second server, a first processing time stamp of the target task is acquired.
According to an embodiment of the present disclosure, in a case where the first server is not the same as the second server, i.e., the first server is not a server that processes the target task by default.
According to an embodiment of the present disclosure, the first processing timestamp may be generated in a case where the target task is allocated to the second server, and may be recorded in the task configuration table, and thus, the first processing timestamp may be obtained from the task configuration table, as shown in the task configuration table of table 1 below, where the takeover start timestamp is a time when the task is allocated to the second server.
TABLE 1 task configuration Table
First server Takeover start time stamp First processing time stamp
Task 1 Second server A XXX XXX
Task 2 Second server B XXX XXX
Task 3 Second server C XXX XXX
XXX XXX XXX XXX
In operation S250, in case it is determined that the difference between the first processing time stamp and the current time stamp is greater than the preset time threshold, the target task is processed using the first server.
According to an embodiment of the present disclosure, the preset time threshold may be 1 second, 5 seconds, 10 seconds, etc., and the preset time threshold may be a time interval during which the target task can wait after the second server is allocated.
According to the embodiment of the disclosure, in a case where the difference between the first processing time stamp and the current time stamp is greater than the preset time threshold, that is, the target task has been unprocessed beyond the preset time threshold, the target task may be processed by using the first server.
According to an embodiment of the disclosure, a task set is obtained from a configuration database by utilizing a first server, wherein the task set comprises a plurality of tasks; determining a target task to be processed from a plurality of tasks in a task set; determining a second server matched with the target task from a task configuration table, wherein the task configuration table comprises an allocation relation between the target task and the second server for processing the target task by default; under the condition that the first server is different from the second server, acquiring a first processing time stamp of the target task; and under the condition that the difference value between the first processing time stamp and the current time stamp is larger than a preset time threshold value, utilizing the technical means of the first server to process the target task. The first server is used for acquiring the task set, the second server of the target task is determined according to the target task in the task set, and the target task is determined to be processed by the first server according to the first processing time stamp of the target task under the condition that the first server and the second server are different, so that the second server of the target task can be switched without manual intervention, the technical problem that the task cannot be processed timely by a task scheduling method in the related technology is at least partially solved, the technical problem of lower processing efficiency of the task is caused, and the technical effect of improving the task processing efficiency is realized.
According to an embodiment of the present disclosure, in a case where it is determined that a difference between the first processing timestamp and the current timestamp is greater than a preset time threshold, processing, with the first server, the target task includes:
updating the first processing time stamp of the target task under the condition that the time difference value between the first processing time stamp and the current time stamp is larger than a preset time threshold value;
under the condition that the first processing time stamp is successfully updated, processing the target task by using a first server;
in the case where it is determined that the first processing time stamp update fails, a first task other than the target task is determined from the plurality of tasks using the first server.
According to an embodiment of the present disclosure, in a case where it is determined that the time difference between the first processing time stamp and the current time stamp is greater than the preset time threshold, i.e., the target task has been unprocessed beyond the predetermined time threshold, the first processing time stamp may be checked and updated to the current time stamp.
According to the embodiment of the disclosure, the time difference value between the first processing time stamp and the current time stamp and the preset time threshold value can be judged while the first processing time stamp is updated, so that the situation that the first processing time stamp of the target task is updated by a plurality of first servers to cause errors is avoided.
According to the embodiment of the disclosure, in the case that the first processing time stamp is determined to be successfully updated, that is, the target task is not processed by other servers, the first server may be updated as a server for processing the target task by default, and the target task is processed by using the first server.
According to the embodiment of the disclosure, in the case that it is determined that the update of the first processing timestamp fails, that is, the time difference between the first processing timestamp of the target task and the current timestamp is not greater than the preset time threshold, that is, the first processing timestamp is updated by other servers, the target task may have been processed, so that the first server does not process the target task any more, and may acquire the first task that has not been processed from the task set, and process the first task as the target task.
According to the embodiment of the disclosure, the problem that the target task is processed by a plurality of servers at the same time can be effectively avoided by using the method for updating the first processing time stamp.
According to an embodiment of the present disclosure, in a case where it is determined that the first server is not the same as the second server, obtaining a first processing timestamp of the target task includes:
determining first server identification information corresponding to a first server according to the first server;
Determining second server identification information corresponding to a second server according to the second server;
comparing the first server identification information with the second server identification information to obtain a comparison result;
and under the condition that the comparison result is determined to be used for representing that the first server identification information is different from the second server identification information, acquiring a first processing time stamp of the target task.
According to an embodiment of the present disclosure, each server may have a server number, the server number may be automatically generated, the first server identification information may be a server number of the first server, and the second server identification information may be a server number of the second server.
According to an embodiment of the present disclosure, the first server identification information may be IP address information of the first server, and the second server identification information may be IP address information of the second server.
According to the embodiment of the disclosure, the first server identification information and the second server identification information can be compared, and a comparison result can be obtained through a text comparison mode.
According to the embodiment of the disclosure, when the comparison result is determined to be different from the second server identification information in the case of representing the first server identification information, that is, the first server is different from the second server, a first processing timestamp of the target task may be obtained;
According to an embodiment of the present disclosure, in a case where the comparison result is determined to be used to characterize that the first server identification information is the same as the second server identification information, that is, the first server is the same as the second server, the target task may be processed with the first server.
According to an embodiment of the present disclosure, determining, from a task configuration table, a second server adapted to a target task includes:
determining target identification information matched with a target task;
and determining a second server which is matched with the target task from the task configuration table according to the target identification information.
According to the embodiment of the disclosure, each target task may have a task number, where the task number may be automatically generated, and the task number is identification information of the task, and the task may include identification information, that is, the target task also includes target identification information, and the target identification information matched with the target task may be removed from the target task.
According to the embodiment of the disclosure, the position of the target task can be determined from the task configuration table according to the target identification information, so that a second server matched with the target task is determined.
According to the embodiment of the disclosure, the second server can be accurately determined from the task configuration table by utilizing the target identification information of the target task, so that the searching efficiency of the second server is improved.
According to an embodiment of the present disclosure, the task scheduling further includes:
determining a second task except the target task from a plurality of tasks in the task set under the condition that the time difference value between the first processing time stamp and the current time stamp is less than or equal to a preset time threshold;
determining a third server matched with the second task from a task configuration table, wherein the task configuration table comprises an allocation relation between the second task and the third server for processing the second task by default;
acquiring a second processing time stamp of a second task under the condition that the first server is determined to be different from the third server;
and processing the second task by using the first server under the condition that the time difference value between the second processing time stamp and the current time stamp is determined to be larger than a preset time threshold value.
According to the embodiment of the disclosure, in the case that the time difference between the first processing time stamp and the current time stamp is determined to be less than or equal to the preset time threshold, that is, the target task does not meet the processed condition, therefore, the first server does not process the target task any more, and can acquire a second task which is not processed yet from the task set, and process the second task as the target task, wherein the second task and the first task can be the same or different.
According to the embodiment of the present disclosure, the determination of the third server adapted to the second task from the task configuration table may refer to the description of operation S230 in the embodiment of the present disclosure, which is not repeated herein.
According to the embodiment of the present disclosure, in the case that it is determined that the first server is different from the third server, the second processing timestamp of the second task is obtained, which may be referred to as description of operation S240 in the embodiment of the present disclosure, and will not be described herein.
According to the embodiment of the present disclosure, when it is determined that the time difference between the second processing timestamp and the current timestamp is greater than the preset time threshold, the first server is used to process the second task, which may be referred to as description of operation S250 in the embodiment of the present disclosure, and will not be repeated herein.
According to the embodiment of the disclosure, by sequentially processing other tasks in the task set, each task can be processed, the problem that the target task cannot be processed due to the fact that a second server for processing the target task by default fails is avoided, and efficiency in a task scheduling process is improved.
According to an embodiment of the present disclosure, the task scheduling further includes:
updating a first processing time stamp of the target task in the case that the first server is determined to be the same as the second server;
And processing the target task by using the first server under the condition that the first processing time stamp is successfully updated.
According to an embodiment of the present disclosure, in a case where it is determined that the first server is the same as the second server, that is, the first server is a server that processes the target task by default, the current timestamp may be acquired, and the first processing timestamp of the target task is updated according to the current timestamp.
According to an embodiment of the present disclosure, in a case where the first processing time stamp of the target task is successfully updated, that is, the target task is not processed by other servers, the target task may be updated with the first server.
According to the embodiment of the disclosure, the target task can be ensured not to be processed by a plurality of servers at the same time by means of a database lock.
According to the embodiment of the disclosure, the problem that the target task is processed by a plurality of servers at the same time can be effectively avoided by using the method for updating the first processing time stamp.
Fig. 4 schematically illustrates a flow chart of a task scheduling method according to a further embodiment of the present disclosure.
As shown in fig. 4, the task scheduling method includes operations S401 to S411.
In operation S401, a task set is acquired from a configuration database using a first server.
In operation S402, a target task to be processed is determined from a plurality of tasks in a task set.
In operation S403, a second server adapted to the target task is determined from the task configuration table.
In operation S404, it is determined whether the first server and the second server are identical, operation S405 is performed in the case where it is determined that the first server is not identical to the second server, and operation S407 is performed in the case where it is determined that the first server is identical to the second server.
In operation S405, a first processing time stamp of a target task is acquired.
In operation S406, it is determined whether the time difference between the first processing time stamp and the current time stamp is greater than a preset time threshold, operation S407 is performed if it is determined that the time difference is greater than the preset time threshold, and operation S410 is performed if it is determined that the time difference is less than or equal to the preset time threshold.
In operation S407, the first processing time stamp of the target task is updated.
In operation S408, it is determined whether the first processing time stamp is updated successfully, and in the case where it is determined that the first processing time stamp is updated successfully, operation S409 is performed; in case it is determined that the first processing time stamp update fails, operation S410 is performed.
In operation S409, the target task is processed with the first server.
In operation S410, it is determined whether there is a target task to be processed in the task set, in the case where it is determined that there is a target task to be processed in the task set, operation S402 is performed, and in the case where it is determined that there is no target task to be processed in the task set, operation S411 is performed.
In operation S411, the process is completed.
According to the embodiment of the disclosure, the processing conditions of the target task include two types, the first type is that under the condition that a first server and a second server are different, the first server is updated to be the server for processing the target task by default by judging the time difference value between the first processing time stamp of the target task and the current time stamp, and under the condition that the time difference value is larger than a preset time threshold value, the target task is processed by the first server; the second is to process the target task by the first server in the case where the first server and the second server are the same, that is, the first server is a server which defaults to process the target task.
Based on the task scheduling method, the disclosure also provides a task scheduling device. The device will be described in detail below in connection with fig. 5.
Fig. 5 schematically shows a block diagram of a task scheduling device according to an embodiment of the present disclosure.
As shown in fig. 5, the task scheduling device 500 of this embodiment includes a first acquisition module 510, a first determination module 520, a second determination module 530, a second acquisition module 540, and a first processing module 550.
The first obtaining module 510 is configured to obtain, with a first server, a task set from a configuration database, where the task set includes a plurality of tasks. In an embodiment, the first obtaining module 510 may be configured to perform the operation S210 described above, which is not described herein.
The first determining module 520 is configured to determine a target task to be processed from a plurality of tasks in the task set. In an embodiment, the first determining module 520 may be configured to perform the operation S220 described above, which is not described herein.
The second determining module 530 is configured to determine a second server adapted to the target task from a task configuration table, where the task configuration table includes an allocation relationship between the target task and a second server that processes the target task by default. In an embodiment, the second determining module 530 may be configured to perform the operation S230 described above, which is not described herein.
The second obtaining module 540 is configured to obtain a first processing timestamp of the target task if it is determined that the first server is different from the second server. In an embodiment, the second obtaining module 540 may be used to perform the operation S240 described above, which is not described herein.
The first processing module 550 is configured to process the target task with the first server if it is determined that the difference between the first processing timestamp and the current timestamp is greater than the preset time threshold. In an embodiment, the first processing module 550 may be configured to perform the operation S250 described above, which is not described herein.
According to an embodiment of the present disclosure, the first processing module configured to process, with the first server, the target task if it is determined that the difference between the first processing timestamp and the current timestamp is greater than a preset time threshold includes:
the first processing unit is used for updating the first processing time stamp of the target task under the condition that the time difference value between the first processing time stamp and the current time stamp is larger than a preset time threshold value;
the second processing unit is used for processing the target task by using the first server under the condition that the first processing time stamp is successfully updated;
And a third processing unit configured to determine, when it is determined that the first processing time stamp update fails, a first task other than the target task from the plurality of tasks using the first server.
According to an embodiment of the present disclosure, the second obtaining module applied to obtain the first processing timestamp of the target task in the case that it is determined that the first server is not the same as the second server includes:
the first acquisition unit is used for determining first server identification information corresponding to the first server according to the first server;
a second obtaining unit, configured to determine, according to a second server, second server identification information corresponding to the second server;
the second acquisition unit is used for comparing the first server identification information with the second server identification information to obtain a comparison result;
the first obtaining unit is used for obtaining a first processing time stamp of the target task under the condition that the comparison result is determined to be used for representing that the first server identification information is different from the second server identification information.
According to an embodiment of the present disclosure, the second determining module for determining, from the task configuration table, a second server adapted to the target task includes:
The first determining unit is used for determining target identification information matched with the target task;
and the second determining unit is used for determining a second server which is matched with the target task from the task configuration table according to the target identification information.
According to an embodiment of the present disclosure, the task scheduling device further includes:
a third determining module, configured to determine a second task other than the target task from the plurality of tasks in the task set if it is determined that the time difference between the first processing time stamp and the current time stamp is less than or equal to a preset time threshold;
a fourth determining module, configured to determine a third server adapted to the second task from a task configuration table, where the task configuration table includes an allocation relationship between the second task and a third server that processes the second task by default;
the third acquisition module is used for acquiring a second processing time stamp of the second task under the condition that the first server is determined to be different from the third server;
and the second processing module is used for processing the second task by using the first server under the condition that the time difference value between the second processing time stamp and the current time stamp is larger than the preset time threshold value.
According to an embodiment of the present disclosure, the task scheduling device further includes:
The updating module is used for updating the first processing time stamp of the target task under the condition that the first server is determined to be the same as the second server;
and the third processing module is used for processing the target task by using the first server under the condition that the first processing time stamp is successfully updated.
According to an embodiment of the present disclosure, any of the first acquisition module 510, the first determination module 520, the second determination module 530, the second acquisition module 540, and the first processing module 550 may be combined in one module to be implemented, or any of the modules may be split into a plurality of modules. Alternatively, at least some of the functionality of one or more of the modules may be combined with at least some of the functionality of other modules and implemented in one module. According to embodiments of the present disclosure, at least one of the first acquisition module 510, the first determination module 520, the second determination module 530, the second acquisition module 540, and the first processing module 550 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or as hardware or firmware in any other reasonable manner of integrating or packaging the circuitry, or as any one of or a suitable combination of any of the three. Alternatively, at least one of the first acquisition module 510, the first determination module 520, the second determination module 530, the second acquisition module 540, and the first processing module 550 may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
Fig. 6 schematically illustrates a block diagram of an electronic device adapted to implement a task scheduling method according to an embodiment of the present disclosure.
As shown in fig. 6, an electronic device 600 according to an embodiment of the present disclosure includes a processor 601 that 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. The processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 601 may also include on-board memory for caching purposes. The processor 601 may comprise a single processing unit or a plurality of processing units for performing different actions of the method flows according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The processor 601 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or the RAM 603. Note that the program may be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, the electronic device 600 may also include an input/output (I/O) interface 605, the input/output (I/O) interface 605 also being connected to the bus 604. The electronic device 600 may also include one or more of the following components 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.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium described above carries one or more programs, which when executed, implement the task scheduling method according to the embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: 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), 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 disclosure, 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. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 602 and/or RAM 603 and/or one or more memories other than ROM 602 and RAM 603 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowcharts. The program code, when executed in a computer system, causes the computer system to implement the task scheduling method provided by embodiments of the present disclosure.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and/or installed from the removable medium 611. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
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 embodiments of the present disclosure are performed when the computer program is executed by the processor 601. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
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 disclosure. 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.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be provided in a variety of combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (10)

1. A task scheduling method, comprising:
acquiring a task set from a configuration database by using a first server, wherein the task set comprises a plurality of tasks;
Determining a target task to be processed from a plurality of tasks in the task set;
determining a second server matched with the target task from a task configuration table, wherein the task configuration table comprises an allocation relation between the target task and the second server for processing the target task by default;
acquiring a first processing time stamp of the target task under the condition that the first server is determined to be different from the second server;
and under the condition that the difference value between the first processing time stamp and the current time stamp is determined to be larger than a preset time threshold value, the first server is utilized to process the target task.
2. The method of claim 1, wherein the processing the target task with the first server if the difference between the first processing timestamp and the current timestamp is determined to be greater than a preset time threshold comprises:
updating the first processing time stamp of the target task under the condition that the time difference value between the first processing time stamp and the current time stamp is larger than a preset time threshold value;
processing the target task with the first server if it is determined that the first processing timestamp is successfully updated;
And in the case that the first processing time stamp update is determined to be failed, determining a first task except the target task from the plurality of tasks by using the first server.
3. The method of claim 1, wherein the obtaining a first processing timestamp of the target task if the first server is determined to be different from the second server comprises:
determining first server identification information corresponding to the first server according to the first server;
determining second server identification information corresponding to the second server according to the second server;
comparing the first server identification information with the second server identification information to obtain a comparison result;
and under the condition that the comparison result is determined to be used for representing that the first server identification information is different from the second server identification information, acquiring a first processing time stamp of the target task.
4. A method according to any one of claims 1 to 3, wherein the determining a second server from a task configuration table that is adapted to the target task comprises:
determining target identification information matched with the target task;
And determining a second server which is matched with the target task from the task configuration table according to the target identification information.
5. A method according to any one of claims 1 to 3, further comprising:
determining a second task other than the target task from the plurality of tasks in the task set if the time difference between the first processing time stamp and the current time stamp is determined to be less than or equal to a preset time threshold;
determining a third server matched with the second task from the task configuration table, wherein the task configuration table comprises an allocation relation between the second task and the third server for processing the second task by default;
acquiring a second processing time stamp of the second task under the condition that the first server is determined to be different from the third server;
and processing the second task by using the first server under the condition that the time difference value between the second processing time stamp and the current time stamp is determined to be larger than a preset time threshold value.
6. A method according to any one of claims 1 to 3, further comprising:
updating a first processing timestamp of the target task if it is determined that the first server is the same as the second server;
And processing the target task by using the first server under the condition that the first processing time stamp is successfully updated.
7. A task scheduling device, comprising:
the first acquisition module is used for acquiring a task set from the configuration database by utilizing a first server, wherein the task set comprises a plurality of tasks;
the first determining module is used for determining a target task to be processed from a plurality of tasks in the task set;
the second determining module is used for determining a second server matched with the target task from a task configuration table, wherein the task configuration table comprises an allocation relation between the target task and the second server for processing the target task by default;
the second acquisition module is used for acquiring a first processing time stamp of the target task under the condition that the first server is determined to be different from the second server;
and the first processing module is used for processing the target task by using the first server under the condition that the difference value between the first processing time stamp and the current time stamp is determined to be larger than a preset time threshold value.
8. An electronic device, comprising:
one or more processors;
A memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method according to any of claims 1-6.
10. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 6.
CN202310159974.3A 2023-02-21 2023-02-21 Task scheduling method, device, equipment and storage medium Pending CN116360937A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310159974.3A CN116360937A (en) 2023-02-21 2023-02-21 Task scheduling method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310159974.3A CN116360937A (en) 2023-02-21 2023-02-21 Task scheduling method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116360937A true CN116360937A (en) 2023-06-30

Family

ID=86912629

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310159974.3A Pending CN116360937A (en) 2023-02-21 2023-02-21 Task scheduling method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116360937A (en)

Similar Documents

Publication Publication Date Title
CN107644075B (en) Method and device for collecting page information
CN113900834A (en) Data processing method, device, equipment and storage medium based on Internet of things technology
CN114090113B (en) Method, device, equipment and storage medium for dynamically loading data source processing plug-in
CN115965474A (en) Service processing method, device, equipment and storage medium
CN113191889A (en) Wind control configuration method, configuration system, electronic device and readable storage medium
CN116360937A (en) Task scheduling method, device, equipment and storage medium
CN114721882B (en) Data backup method and device, electronic equipment and storage medium
CN110851483A (en) Method, apparatus, electronic device, and medium for screening objects
CN114363172B (en) Decoupling management method, device, equipment and medium for container group
CN113760835B (en) Log management method, middle platform system, electronic equipment and storage medium
CN113468053B (en) Application system testing method and device
CN115080434A (en) Case execution method, device, equipment and medium
CN115484149B (en) Network switching method, network switching device, electronic equipment and storage medium
CN116049026A (en) Recommended resource reading method and device, electronic equipment and storage medium
CN114338697A (en) Method and device for providing shared cloud service, electronic equipment and storage medium
CN116775307A (en) Service processing method, device, equipment and storage medium
CN113419922A (en) Method and device for processing batch job running data of host
CN116975200A (en) Method, device, equipment and medium for controlling working state of server
CN117149570A (en) Data processing method, device, equipment and storage medium
CN114218330A (en) ES cluster selection method, ES cluster selection device, ES cluster selection apparatus, ES cluster selection medium, and program product
CN118171858A (en) Resource processing method and device, electronic equipment and storage medium
CN116627536A (en) Application deployment method and device, electronic equipment and storage medium
CN117170805A (en) Batch job processing method and device, electronic equipment and storage medium
CN114861054A (en) Information acquisition method and device, electronic equipment and storage medium
CN117271277A (en) Alarming method, device, equipment and storage medium for abnormal service

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