CN114546629B - Task execution system, method, server, and computer-readable storage medium - Google Patents

Task execution system, method, server, and computer-readable storage medium Download PDF

Info

Publication number
CN114546629B
CN114546629B CN202210434691.0A CN202210434691A CN114546629B CN 114546629 B CN114546629 B CN 114546629B CN 202210434691 A CN202210434691 A CN 202210434691A CN 114546629 B CN114546629 B CN 114546629B
Authority
CN
China
Prior art keywords
task
message
time point
snapshot
execution result
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.)
Active
Application number
CN202210434691.0A
Other languages
Chinese (zh)
Other versions
CN114546629A (en
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.)
Shenzhen Meiyunji Network Technology Co ltd
Original Assignee
Shenzhen Meiyunji Network 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 Shenzhen Meiyunji Network Technology Co ltd filed Critical Shenzhen Meiyunji Network Technology Co ltd
Priority to CN202210434691.0A priority Critical patent/CN114546629B/en
Publication of CN114546629A publication Critical patent/CN114546629A/en
Application granted granted Critical
Publication of CN114546629B publication Critical patent/CN114546629B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a task execution system, a task execution method, a server and a computer readable storage medium. The task execution system may include: the dispatcher is configured to generate a task message based on a task scheduling record corresponding to the task description snapshot and push the generated task message to a task message queue; the message pusher is configured to push the task message to be pushed in the task message queue to the executor; and the executor is configured to execute the received task message when the pushed task message is received. The method and the device can control the execution of the task message more flexibly.

Description

Task execution system, method, server and computer readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a task execution system, a task execution method, a server, and a computer-readable storage medium.
Background
The development of computer technology and the popularity of the internet provide convenience for commodity transactions. Internet-based computer systems are being used to conduct activities related to the transaction of goods, providing convenience to sellers and buyers. Such computer systems include online shopping systems, enterprise resource planning systems, and the like.
In existing computer systems, tasks such as sending mail, adjusting commodity prices, etc. may be represented using task descriptions, such tasks may be referred to as business system tasks, and task messages may be generated based on task descriptions. When the task message is generated, the generated task message is executed by the computer system immediately without controlling the execution timing of the task message.
In the prior computer system, the execution timing of the task message is not controlled, so the technical problem that the execution of the task message cannot be flexibly controlled exists.
Disclosure of Invention
Embodiments of the present application provide a task execution system, a task execution method, a server, and a computer-readable storage medium, which can more flexibly control execution of task messages.
In a first aspect, an embodiment of the present application provides a task execution system, including: the dispatcher is configured to generate a task message based on the task scheduling record corresponding to the task description snapshot and push the generated task message to a task message queue; the message pusher is configured to push the task message to be pushed in the task message queue to the executor; and the executor is configured to execute the received task message when the pushed task message is received.
Optionally, the executor is further configured to, when the task message is executed, generate an execution result message corresponding to the executed task message and push the generated execution result message into an execution result message queue, and/or the message pusher is further configured to push the task message to be pushed to a newly created executor or an idle executor, and/or the task message has a version number, a version number corresponding to a pre-stored task scheduling record is a validation version number, the executor is further configured to, before executing the received task message, compare the version number of the received task message with the validation version number, and execute the received task message when the validation version number is not empty and is equal to the version number of the received task message; the version number of the task message generated by the distributor is the version number corresponding to the task scheduling record on which the task message is generated.
Optionally, the task execution system of the embodiment of the present application further includes: a checker, a snapshot and records processor, and/or a task deleter, wherein the checker is configured to receive an execution result message pushed from an execution result message queue, generate a result log when an execution result type stored in the received execution result message is successful or ignored, and push a task message corresponding to the execution result message of which the execution result type is retried, into the task message queue when the execution result type stored in the received execution result message is retried; the message pusher is also configured to push an execution result message to be pushed in the execution result message queue to the checker; the snapshot and record processor is configured to acquire a task description snapshot, and issue at least one task scheduling record and update the pre-stored task description snapshot based on the pre-stored task description snapshot and the acquired task description snapshot, wherein the issued task scheduling records have the same version number; the task deleter is configured to delete the pre-stored task description snapshot when receiving a deletion instruction, and set a version number corresponding to the deleted task description snapshot to null.
Optionally, the dispatcher, the executor and/or the checker are implemented by a server-less cloud function, the message pusher is implemented by a server-less event bus, the task scheduling record is stored in the task scheduling table, and the task scheduling table is stored in the cloud storage.
Optionally, the task message to be executed indicates that a specific operation is performed from the task start time point to the task end time point, the specific operation is performed at a predetermined cycle, and the executor is further configured to: certain operations are performed when the following formula is satisfied: (current value-start value) mod the number of times in a period ≦ (current value-end value) mod the number of times in the period, where mod represents a remainder operation, the number of time units in the period is the number of time units in one period, the time units including hours, minutes, and seconds, the current value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the current time point, the start value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task start time point, and the end value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task end time point.
In a second aspect, an embodiment of the present application provides a task execution method, including: generating a task message based on a task scheduling record corresponding to the task description snapshot, and pushing the generated task message to a task message queue; pushing the task message to be pushed in the task message queue to an actuator; when the executor receives the pushed task message, the received task message is executed.
Optionally, the task execution method according to the embodiment of the present application further includes: when the task message is executed, an execution result message corresponding to the executed task message is generated by the executor and the generated execution result message is pushed to an execution result message queue, and/or the task message to be pushed is pushed to a newly created executor or an idle executor, and/or the task message has a version number, the version number corresponding to the pre-stored task scheduling record is an effective version number, the version number of the generated task message is a version number corresponding to the task scheduling record on which the task message is generated, and before the received task message is executed, the task execution method further includes: the version number of the received task message is compared to the validation version number, and the received task message is executed by the executor when the validation version number is not null and equal to the version number of the received task message.
Optionally, the task execution method according to the embodiment of the present application further includes: receiving an execution result message pushed from an execution result message queue, generating a result log when an execution result type stored in the received execution result message is successful or ignored, and pushing a task message corresponding to the execution result message of which the execution result type is retried into a task message queue when the execution result type stored in the received execution result message is retried, and/or acquiring a task description snapshot, and issuing at least one task scheduling record and updating the pre-stored task description snapshot based on the pre-stored task description snapshot and the acquired task description snapshot, wherein the issued task scheduling records have the same version number, and/or deleting the pre-stored task description snapshot and setting a version number corresponding to the deleted task description snapshot to be empty when a deletion instruction is received.
Optionally, at least one step of the task execution method of the embodiment of the present application is implemented without a server, the task scheduling record is stored in the task scheduling table, and the task scheduling table is stored in the cloud storage.
Optionally, the task message to be executed indicates that a specific operation is executed from a task start time point to a task end time point, the specific operation is executed in a predetermined period, and when the executor receives the pushed task message, the step of executing the received task message includes: certain operations are performed by the actuators when the following equations are satisfied: (current value-start value) mod the number of times in a period ≦ (current value-end value) mod the number of times in the period, where mod represents a remainder operation, the number of time units in the period is the number of time units in one period, the time units including hours, minutes, and seconds, the current value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the current time point, the start value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task start time point, and the end value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task end time point.
In a third aspect, an embodiment of the present application provides a server, including: the device comprises a memory and a processor, wherein instructions are stored in the memory and are suitable for the processor to load so as to execute the task execution method.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing instructions adapted to be loaded by a processor to perform the above task execution method.
In the task execution system, the method, the server and the computer readable storage medium provided by the embodiment of the application, the task message can be generated, the generated task message is pushed to the task message queue, and the executor executes the task message. Execution of a task message by an executor may be triggered by pushing the task message to the executor. That is, the execution timing of the task message can be controlled by the pushing of the task message. Therefore, the scheme can more flexibly control the execution of the task message. The task message can be pushed when the resources required by the task message execution are in an idle state, so that the utilization rate of the resources required by the task message execution can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a task execution system according to a first embodiment of the present application.
Fig. 2 is a schematic structural diagram of a task execution system according to a second embodiment of the present application.
Fig. 3 is a schematic structural diagram of a task execution system according to a third embodiment of the present application.
Fig. 4 is a schematic structural diagram of a task execution system according to a fourth embodiment of the present application.
Fig. 5 is a flowchart illustrating a task execution method according to a fifth embodiment of the present application.
Fig. 6 is a flowchart illustrating a task execution method according to a sixth embodiment of the present application.
Fig. 7 is a flowchart illustrating a task execution method according to a seventh embodiment of the present application.
Fig. 8 is a flowchart illustrating a task execution method according to an eighth embodiment of the present application.
Fig. 9 is a flowchart illustrating a task execution method according to a ninth embodiment of the present application.
Fig. 10 is a flowchart illustrating a task execution method according to a tenth embodiment of the present application.
Fig. 11 is a schematic structural diagram of a server according to an eleventh embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
The terms "first" and "second", etc. in this application are used to distinguish between different objects, and are not used to describe a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps, operations, components, or modules is not limited to only those steps, operations, components, or modules listed, but may alternatively include other steps, operations, components, or modules not listed, or that may alternatively include other steps, operations, components, or modules inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Embodiments of the present application provide a task execution system, a task execution method, a server, and a computer-readable storage medium, which will be described in detail respectively below. It should be noted that the description sequence of each embodiment below does not limit the specific implementation sequence, and the description sequence includes, but is not limited to, the sequence of step description or operation description and the sequence of system component description.
Referring to a schematic structural diagram of a task execution system shown in fig. 1, according to a first embodiment, the task execution system may include: the dispatcher 100 is configured to generate a task message based on a task scheduling record corresponding to the task description snapshot and push the generated task message to a task message queue; the message pusher 200 is configured to push the task message to be pushed in the task message queue to the executor 300; and an executor 300 configured to execute the received task message when the pushed task message is received.
With diversification of e-commerce platforms, huge transaction scale, large comprehensive service, mass emergence of sellers and more detailed and perfect division of industrial chains, user requirements are more and more increased. The user requirements can be realized by a computer system such as an online shopping system, an enterprise resource planning system and the like. Such a computer system may also be referred to as a business system, and such user requirements may be fulfilled by performing corresponding tasks, which may be business system tasks. In a computer system, user requirements may be recorded by task descriptions, which may be used to represent tasks of sending mail, adjusting prices of goods, and the like. A task description may be generated based on the user input and a task description snapshot may be generated based on the task description. The task description snapshot may record the content of the task description. The task description snapshot can be stored in advance, and the task description snapshots of the two versions can be stored in advance, so that operations such as rollback and the like are facilitated.
As an example, the business system task may be a timing task. The timing task comprises the following steps: tasks performed at a point in time, tasks performed over a period of time, tasks performed periodically.
As an example, the task schedule record may be published after the generation of the task description corresponding to the user's requirements, or may even be published immediately after the generation of the task description. In this case, the task description can be recorded in time, so that the user requirements can be recorded in time. The publishing of the task scheduling record may be implemented in the business system or even by a component in the business system, for example, by the snapshot and record handler described below. In addition, the operation of generating the task message and/or the operation of executing the task message may be activated by a time trigger or may be activated by an event trigger. In case a distributed system is considered, the operation of generating the task message may be performed in the first subsystem, e.g. by a distributor in the first subsystem. The operation of executing the task message may be performed in the second subsystem, e.g., by an executor in the second subsystem. The operation of pushing the task message to the executor may be performed in a third subsystem, i.e. the message pusher may be located in the third subsystem. One or more of the first, second and third subsystems may be a cloud operating system or the like. The first, second and third subsystems may be the same system or different systems.
According to an exemplary embodiment of the present application, the executor 300 is further configured to generate, when the task message is executed, an execution result message corresponding to the executed task message, and push the generated execution result message into the execution result message queue.
As an example, the message pusher 200 is further configured to push a task message to be pushed to a newly created executor or to an idle executor. By configuring the message pusher 200, appropriate executors can be arranged for the execution of task messages, thereby making it possible to more reasonably invoke system resources.
As an example, the task message has a version number, the version number corresponding to the pre-stored task schedule record is an effective version number, the executor 300 is further configured to compare the version number of the received task message with the effective version number before executing the received task message, and execute the received task message when the effective version number is not empty and is equal to the version number of the received task message; the version number of the task message generated by the distributor 100 is a version number corresponding to the task schedule record on which the task message is generated.
Referring to a schematic structural diagram of a task execution system shown in fig. 2 according to a second embodiment, the task execution system may include: the dispatcher 100 is configured to generate a task message based on a task scheduling record corresponding to the task description snapshot and push the generated task message to a task message queue; the message pusher 200 is configured to push the task message to be pushed in the task message queue to the executor 300; an executor 300 configured to execute the received task message when the pushed task message is received; a checker 400 configured to receive an execution result message pushed from the execution result message queue, generate a result log when an execution result type stored in the received execution result message is successful or ignored, and push a task message corresponding to the execution result message of which the execution result type is retried, into the task message queue when the execution result type stored in the received execution result message is retried. The message pusher 200 is further configured to push an execution result message to be pushed in the execution result message queue to the checker 400. By retrying, smooth execution of the task message can be guaranteed. By pushing by the message pusher 200, the checker 400 can be activated to control the working timing of the checker 400.
Referring to a schematic structural diagram of a task execution system shown in fig. 3 according to a third embodiment, the task execution system may include: a snapshot and record processor 500 configured to obtain a task description snapshot, and issue at least one task scheduling record and update the pre-stored task description snapshot based on a pre-stored task description snapshot and the obtained task description snapshot, where the issued task scheduling records have the same version number, that is, the at least one task scheduling record has the same version number; the dispatcher 100 is configured to generate a task message based on a task scheduling record corresponding to the task description snapshot and push the generated task message to a task message queue; the message pusher 200 is configured to push the task message to be pushed in the task message queue to the executor 300; and an executor 300 configured to execute the received task message when the pushed task message is received.
As an example, when a user creates a new requirement or the user changes an old requirement, a new task description may be generated. In this case, a new task description snapshot may be generated based on the new task description to record the content of the task description. The acquired task description snapshot may be compared to a pre-stored task description snapshot. In particular, the contents of the task description snapshots may be compared, and task description snapshots having different contents may be considered different task description snapshots.
For example, the first task description may indicate that at 18:00 to 20:00 modifies the price of item a from 5 to 6 dollars. The second task description may indicate that at 18:30 to 20:30 modifies the price of item a from 5 to 6 dollars. In this case, the first task description snapshot corresponding to the first task description is different from the second task description snapshot corresponding to the second task description.
By way of example, the version number may be represented by an arabic number, the larger the version number, the newer the version. A newer version number may indicate a later generation time.
Through the operation, the change of the task description can be embodied through the task description snapshot and the version number, and the change of the user requirement can also be embodied, so that the user requirement can be accurately reflected.
Referring to a schematic structural diagram of a task execution system shown in fig. 4, according to a fourth embodiment, the task execution system may include: the dispatcher 100 is configured to generate a task message based on a task scheduling record corresponding to the task description snapshot and push the generated task message to a task message queue; a message pusher 200 configured to push a task message to be pushed in a task message queue to the executor 300; an executor 300 configured to execute the received task message when the pushed task message is received; the task deleter 600 is configured to delete the pre-stored task description snapshot when receiving a deletion instruction, and set a version number corresponding to the deleted task description snapshot to null.
By the scheme, task deleting operation can be realized. By deleting the task description snapshot and setting the version number to be null, the task message which does not need to be executed can be accurately identified when the version number is compared to determine whether to execute the task message, so that the task deleting operation is smoothly realized.
As an example, one or more task schedule records may be stored with a task schedule. The task schedule may be stored in memory; the memory may be a local memory or a remote memory, such as a cloud memory or the like. The task scheduling records can be read from the task scheduling table at regular time, and also can be read from the task scheduling table when a specific event occurs. The generated task message may be a task request, and when the task request is processed, a specific business system task, such as sending a mail, adjusting a price of a commodity, and the like, may be performed.
As an example, the distributor 100, the executor 300, and/or the checker 400 are implemented by a Serverless cloud function, and the message pusher 200 is implemented by a Serverless event bus (EventBridge).
When the service system is stopped or restarted due to the on-line or power-off of the service system, the cloud storage and the non-server are independent of the service system, and even if the service system is stopped or restarted, the corresponding scheme of the application can be realized by the cooperation of the non-server and the cloud storage, so that the realization of the user requirement corresponding to the task description snapshot can be ensured. The business system can realize the operation of generating the task description snapshot and/or the operation of issuing the task scheduling record and updating the task description snapshot.
As an example, the task scheduling record may include a plurality of fields, such as a status field and a version number field, the status field may store parameters corresponding to the business system task, and when the business system task is mail transmission, the parameters may include: a mail sending time point, a mail receiving address and mail content; when the business system task is timesharing, the parameters may include: item identification, adjustment period, and expected price.
That is, whether the task message needs to be executed may be determined according to the version number of the task message to be executed and the version number corresponding to the pre-stored task description snapshot.
In an embodiment of the present application, at least one task message is pushed into a task message queue. By comparing the version numbers, whether the version of the task message is matched with the effective version number can be judged, the execution of the task message can be allowed when the version is matched, and the execution of the task message is not allowed when the version is not matched.
In an embodiment of the present application, at least one task message having a version number of at least one task scheduling record may be generated based on the at least one task scheduling record; the task message to be executed can be executed according to the version number of the task message to be executed in the at least one generated task message and the version number corresponding to the pre-stored task description snapshot. When the execution result message is generated, the execution result of the task message may be checked by the execution result type of the execution result message. And generating a result log and retrying the task message according to the execution result type. The result log can be pushed to the business system so that the business system can learn the execution result. Through the scheme, the task message can be retried. That is, the task message that is retried can be re-executed, thereby guaranteeing the success rate of task message execution. Although the task message which needs to be retried is not successfully executed, the reason of the unsuccessful is probably caused by the concurrent exception of the application program, and the task message can be successfully executed through the retrial, so that the task message can be ensured to be successfully executed through the check, and the task can be further ensured to be successfully executed.
As an example, the task message to be executed indicates that a specific operation is performed during a period from a task start time point to a task end time point, the specific operation being performed at a predetermined cycle, the executor 300 is further configured to: certain operations are performed when the following formula is satisfied: (current value-start value) mod the number of times in a period ≦ (current value-end value) mod the number of times in the period, where mod represents a remainder operation, the number of time units in the period is the number of time units in one period, the time units including hours, minutes, and seconds, the current value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the current time point, the start value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task start time point, and the end value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task end time point.
In addition, the remainder operation specifically includes: subtracting the starting value from the current value to obtain a first operation value, and then dividing the first operation value by the time number in the period to further obtain a first remainder; and subtracting the ending value from the current value to obtain a second operation value, and dividing the second operation value by the time number in the period to further obtain a second remainder.
With the above scheme, even if the period of time from the task start time point to the task end time point spans 0:00, the specific operation can be executed on time.
As described above, with the task execution system provided by the embodiment of the present application, a task message may be generated by the dispatcher 100 and pushed to the task message queue; the operation of the actuator 300 may be activated or triggered by the message pusher 200; the message pusher 200 may push a task message to the executor 300 when there is a task message in a task message queue or when a specific time or event occurs; the executor 300 is triggered or activated upon receiving a pushed task message and executes the received task message when triggered or activated, so that flexible control of the execution of the task message can be guaranteed. The technical scheme of the application is also suitable for scenes when the user requirements include tasks of the service system which are executed periodically, such as scenes of sending mails periodically, adjusting commodity prices and the like.
In order to implement the task execution system, correspondingly, the embodiment of the application further provides a task execution method. According to a fifth embodiment, referring to the flowchart of the task execution method shown in fig. 5, the task execution method of the present application may include: generating a task message based on a task scheduling record corresponding to the task description snapshot, and pushing the generated task message to a task message queue; pushing the task message to be pushed in the task message queue to an actuator; when the executor receives the pushed task message, the received task message is executed.
As an example, a task message to be pushed is pushed to a newly created executor or to an idle executor.
According to a sixth embodiment, referring to the flowchart of the task execution method shown in fig. 6, the task execution method according to the embodiment of the present application further includes: when the task message is executed, an execution result message corresponding to the executed task message is generated by the executor, and the generated execution result message is pushed into the execution result message queue.
As an example, the task message has a version number, the version number corresponding to the pre-stored task schedule record is a validation version number, and the version number of the generated task message is a version number corresponding to the task schedule record on which the task message is generated.
According to the seventh embodiment, referring to the flowchart of the task execution method shown in fig. 7, the task execution method according to the exemplary embodiment of the present application includes: generating a task message based on a task scheduling record corresponding to the task description snapshot, and pushing the generated task message to a task message queue; pushing the task message to be pushed in the task message queue to an actuator; when the executor receives the pushed task message, the executor executes the received task message; the version number of the received task message is compared to the validation version number, and the received task message is executed by the executor when the validation version number is not null and equal to the version number of the received task message.
According to the eighth embodiment, referring to the flowchart of the task execution method shown in fig. 8, the task execution method according to the exemplary embodiment of the present application includes: generating a task message based on a task scheduling record corresponding to the task description snapshot, and pushing the generated task message to a task message queue; pushing the task message to be pushed in the task message queue to an actuator; when the executor receives the pushed task message, the executor executes the received task message; receiving an execution result message pushed from the execution result message queue, generating a result log when an execution result type stored in the received execution result message is successful or ignored, and pushing a task message corresponding to the execution result message of which the execution result type is retried into the task message queue when the execution result type stored in the received execution result message is retried.
As an example, when a task message is executed, an execution result message corresponding to the executed task message will be generated, and the generated execution result message will be pushed into an execution result message queue; when the execution result message to be pushed exists in the execution result message queue, the execution result message to be pushed is pushed so as to execute corresponding operations according to the execution result type, wherein the corresponding operations comprise retry operations and result log generation operations.
According to the ninth embodiment, referring to the flowchart of the task execution method shown in fig. 9, the task execution method according to the exemplary embodiment of the present application includes: the method comprises the steps of acquiring a task description snapshot, issuing at least one task scheduling record and updating the pre-stored task description snapshot based on the pre-stored task description snapshot and the acquired task description snapshot, wherein the issued task scheduling records have the same version number; generating a task message based on a task scheduling record corresponding to the task description snapshot, and pushing the generated task message to a task message queue; pushing the task message to be pushed in the task message queue to an actuator; and when the executor receives the pushed task message, executing the received task message.
According to a tenth embodiment, referring to a flowchart of a task execution method shown in fig. 10, a task execution method according to an exemplary embodiment of the present application includes: generating a task message based on a task scheduling record corresponding to the task description snapshot, and pushing the generated task message to a task message queue; pushing the task message to be pushed in the task message queue to an actuator; when the executor receives the pushed task message, the executor executes the received task message; when a deleting instruction is received, deleting the pre-stored task description snapshot, and setting a version number corresponding to the deleted task description snapshot to be null.
As an example, at least one step of the task execution method of the embodiment of the present application is implemented by no server, the task schedule record is stored in the task schedule table, and the task schedule table is stored in the cloud storage.
As an example, the task message to be executed indicates that a specific operation is performed during a period from a task start time point to a task end time point, the specific operation being performed at a predetermined cycle, and when the executor receives the pushed task message, the step of executing the received task message includes: certain operations are performed by the actuators when the following equations are satisfied: (current value-start value) mod the number of times in a period ≦ (current value-end value) mod the number of times in the period, where mod represents a remainder operation, the number of time units in the period is the number of time units in one period, the time units including hours, minutes, and seconds, the current value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the current time point, the start value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task start time point, and the end value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task end time point.
According to an eleventh embodiment, referring to a schematic structural diagram shown in fig. 11, an exemplary embodiment of the present application provides a server, including: a memory 10 and a processor 20, the memory 10 having stored therein instructions adapted to be loaded by the processor 20 to perform the above task execution method.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
According to an exemplary embodiment of the present application, a computer-readable storage medium is provided, which stores a plurality of instructions adapted to be loaded by a processor to perform a task execution method provided by an exemplary embodiment of the present application.
That is, it is understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by instructions controlling associated hardware, and the instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
Through instructions in the exemplary embodiment, the following steps or operations may be performed: generating a task message based on a task scheduling record corresponding to the task description snapshot, and pushing the generated task message to a task message queue; pushing the task message to be pushed in the task message queue to an actuator; when the executor receives the pushed task message, the received task message is executed.
In addition, in the exemplary embodiment of the present application, in a case where it has been determined that it is necessary to push a task message into the task message queue at a predetermined time point, the task message may be pushed at a time point earlier than the predetermined time point, so that it may be possible to avoid that the execution of the task message already existing in the task message queue affects the on-time execution of the task message that needs to be pushed. In exemplary embodiments of the present application, the operations performed by the snapshot and records processor 500, the distributor 100, the executor 300, the checker 400, and/or the task deleter 600, and the corresponding method steps, may be processed asynchronously.
The computer-readable storage medium of the exemplary embodiments of the present application may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the computer-readable storage medium may perform the steps of any task execution method provided in the embodiment of the present application, beneficial effects that can be achieved by any task execution method provided in the embodiment of the present application may be achieved, for which details are given in the foregoing embodiment and are not described herein again.
The principle and the implementation mode of the application are explained by applying a specific example, and the description of the above embodiment is only used for helping to understand the method and the core idea of the application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (6)

1. A task execution system is used for an enterprise resource planning computer system and is characterized by comprising a distributor, a message pusher, an executor, a checker, a snapshot and record processor and a task deleter;
in the computer system, user requirements are realized by executing corresponding tasks, the user requirements are recorded by task descriptions, and the task descriptions are used for representing specific tasks;
the task execution system can generate the task description based on user input and generate a task description snapshot based on the task description, wherein the task description snapshot records the content of the task description, and the task description snapshot is stored in the task execution system in advance;
the task execution system issues a task scheduling record after the task description is generated, the task description is recorded through the task scheduling record, and the issuance of the task scheduling record is realized by the snapshot and record processor;
the dispatcher is configured to generate a task message based on the task scheduling record corresponding to the task description snapshot and push the generated task message into a task message queue; the message pusher is configured to push the task message to be pushed in the task message queue to the executor; the executor is configured to execute the received task message when receiving the pushed task message; the operation of generating the task message and/or the operation of executing the task message can be activated through time triggering;
the executor is further configured to generate an execution result message corresponding to the executed task message when the task message is executed, and push the generated execution result message into an execution result message queue;
the message pusher is also configured to push the task message to be pushed to a newly created executor or an idle executor;
the task message has a version number, the version number corresponding to a pre-stored task scheduling record is an effective version number, the executor is further configured to compare the version number of the received task message with the effective version number before executing the received task message, and execute the received task message when the effective version number is not null and equal to the version number of the received task message; the version number of the task message generated by the distributor is the version number corresponding to the task scheduling record on which the task message is generated;
the checker is configured to receive an execution result message pushed from an execution result message queue, generate a result log when an execution result type stored in the received execution result message is successful or ignored, and push a task message corresponding to the execution result message of which the execution result type is retried into a task message queue when the execution result type stored in the received execution result message is retried; the message pusher is further configured to push an execution result message to be pushed in an execution result message queue to the checker; activating the checker by pushing the message pusher to realize control of the working time of the checker;
the snapshot and record processor is configured to acquire a task description snapshot, and issue at least one task scheduling record and update the pre-stored task description snapshot based on a pre-stored task description snapshot and the acquired task description snapshot, wherein the issued task scheduling records have the same version number;
the task deleter is configured to delete a pre-stored task description snapshot when a deletion instruction is received, and set a version number corresponding to the deleted task description snapshot to null;
when the task is a periodically executed timed task, the task message to be executed indicates that a specific operation is executed from a task start time point to a task end time point, the specific operation being executed at a predetermined cycle, the executor being further configured to:
the specific operation is performed when the following formula is satisfied: (current value-start value) mod number of times in period ≦ (current value-end value) mod number of times in period; mod represents a remainder operation, the number of times in a cycle is the number of time units in a cycle, the time units including hours, minutes, and seconds, the current value is the number of time units elapsed from the start time point of the cycle to which the current time point belongs to the current time point, the start value is the number of time units elapsed from the start time point of the cycle to which the current time point belongs to the task start time point, and the end value is the number of time units elapsed from the start time point of the cycle to which the current time point belongs to the task end time point.
2. The task execution system of claim 1, wherein the dispatcher, the executor, and/or the checker are implemented by a serverless cloud function, the message pusher is implemented by a serverless event bus, task schedule records are stored in a task schedule table, and the task schedule table is stored in a cloud storage.
3. A task execution method for use in a task execution system in an enterprise resource planning computer system, comprising:
generating a task message based on a task scheduling record corresponding to the task description snapshot, and pushing the generated task message to a task message queue;
pushing the task message to be pushed in the task message queue to an actuator;
when the executor receives the pushed task message, executing the received task message;
in the computer system, user requirements are realized by executing corresponding tasks, the user requirements are recorded by task descriptions, and the task descriptions are used for representing specific tasks;
the task execution system can generate the task description based on user input and generate a task description snapshot based on the task description, wherein the task description snapshot records the content of the task description, and the task description snapshot is stored in the task execution system in advance;
the task execution system issues a task scheduling record after the task description is generated, the task description is recorded through the task scheduling record, and the issuance of the task scheduling record is realized by the snapshot and record processor;
when the task message is executed, generating an execution result message corresponding to the executed task message by the executor, and pushing the generated execution result message to an execution result message queue; the task message to be pushed is pushed to a newly created executor or an idle executor;
the task message has a version number, the version number corresponding to the pre-stored task scheduling record is an effective version number, the version number of the generated task message is the version number corresponding to the task scheduling record on which the task message is generated, and before executing the received task message, the task execution method further includes: comparing a version number of a received task message with the validation version number, and executing, by the executor, the received task message when the validation version number is not null and is equal to the version number of the received task message; the operation of generating the task message and/or the operation of executing the task message can be activated through time triggering;
receiving an execution result message pushed from the execution result message queue, generating a result log when an execution result type stored in the received execution result message is successful or ignored, and pushing a task message corresponding to the execution result message of which the execution result type is retried into the task message queue when the execution result type stored in the received execution result message is retried;
the method comprises the steps of acquiring a task description snapshot, issuing at least one task scheduling record and updating the pre-stored task description snapshot based on the pre-stored task description snapshot and the acquired task description snapshot, wherein the issued task scheduling records have the same version number;
when a deleting instruction is received, deleting a pre-stored task description snapshot, and setting a version number corresponding to the deleted task description snapshot to be null;
the task message to be executed indicates that a specific operation is executed from a task start time point to a task end time point, the specific operation is executed in a predetermined period, and when the executor receives the pushed task message, the step of executing the received task message comprises the following steps:
performing, by the actuator, the particular operation when the following formula is satisfied: (current value-start value) mod number of times in a period ≦ (current value-end value) mod number of times in the period, where mod represents a remainder operation, the number of time units in the period is the number of time units in one period, the time units including hours, minutes, and seconds, the current value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the current time point, the start value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task start time point, and the end value is the number of time units elapsed from the start time point of the period to which the current time point belongs to the task end time point.
4. A task execution method according to claim 3, wherein at least one step of the task execution method is implemented by no server, a task schedule record is stored in a task schedule table, and the task schedule table is stored in a cloud storage.
5. A server, comprising: a memory and a processor, the memory having stored therein instructions adapted to be loaded by the processor to perform the task execution method of any of claims 3 to 4.
6. A computer-readable storage medium, characterized in that it stores instructions adapted to be loaded by a processor to perform a method of task execution according to any of claims 3 to 4.
CN202210434691.0A 2022-04-24 2022-04-24 Task execution system, method, server, and computer-readable storage medium Active CN114546629B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210434691.0A CN114546629B (en) 2022-04-24 2022-04-24 Task execution system, method, server, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210434691.0A CN114546629B (en) 2022-04-24 2022-04-24 Task execution system, method, server, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN114546629A CN114546629A (en) 2022-05-27
CN114546629B true CN114546629B (en) 2023-01-24

Family

ID=81667103

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210434691.0A Active CN114546629B (en) 2022-04-24 2022-04-24 Task execution system, method, server, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN114546629B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103049334A (en) * 2012-12-14 2013-04-17 华为技术有限公司 Task processing method and virtual machine
US9436532B1 (en) * 2011-12-20 2016-09-06 Emc Corporation Method and system for implementing independent message queues by specific applications

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109766201A (en) * 2019-01-04 2019-05-17 中国联合网络通信集团有限公司 Task distribution method, server, client and system
CN114003233A (en) * 2021-10-28 2022-02-01 平安国际智慧城市科技股份有限公司 Timed task management method, device, equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9436532B1 (en) * 2011-12-20 2016-09-06 Emc Corporation Method and system for implementing independent message queues by specific applications
CN103049334A (en) * 2012-12-14 2013-04-17 华为技术有限公司 Task processing method and virtual machine

Also Published As

Publication number Publication date
CN114546629A (en) 2022-05-27

Similar Documents

Publication Publication Date Title
US7898679B2 (en) Method and system for scheduling jobs in a computer system
CN1783132B (en) Synchronization of runtime and application state via batching of workflow transactions
EP2600246B1 (en) Batch processing of business objects
CA3176449A1 (en) Sales locking method and system based on a caching
US9189303B2 (en) Shadow queues for recovery of messages
JPH0784815A (en) System and method for processing of fault-tolerant transaction-oriented data
CN113094362B (en) Method and device for reliably delivering and processing asynchronous message
US20070260908A1 (en) Method and System for Transaction Recovery Time Estimation
CN111784329B (en) Service data processing method and device, storage medium and electronic device
CN110941502A (en) Message processing method, device, storage medium and equipment
CN112286661B (en) Task scheduling method and device, storage medium and terminal
CN110740184A (en) Transaction strategy testing system based on micro-service architecture
CN107277022B (en) Process marking method and device
CN115220876A (en) Virtual resource creating method, device, program product, medium and electronic equipment
CN114119129A (en) High-concurrency second killing system
CN114546629B (en) Task execution system, method, server, and computer-readable storage medium
US9170915B1 (en) Replay to reconstruct program state
CN107943567B (en) High-reliability task scheduling method and system based on AMQP protocol
US8234243B2 (en) Third tier transactional commit for asynchronous replication
CN114510337B (en) Task execution method, system and computer readable storage medium
CN111127088B (en) Method, device, computer equipment and storage medium for realizing final consistency
US20060271929A1 (en) Method and system for providing job forecasting in a computer system
CN112825525A (en) Method and apparatus for processing transactions
CN111367705B (en) SQL error reporting processing method and device
CN110765144B (en) Distributed heterogeneous database data processing method and 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
GR01 Patent grant
GR01 Patent grant