Task processing method, device, equipment and medium

By creating the latest version cluster and sending trigger messages when scheduled tasks are upgraded, the problem of task failure caused by scheduled task upgrades is solved, and the reliability of task execution and efficient resource management are achieved.

CN114020310BActive Publication Date: 2025-09-16BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111327369.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-10
Publication Date
2025-09-16
Estimated Expiration
2041-11-10

AI Technical Summary

Technical Problem

During the scheduled task upgrade process, the executing task is prone to failure, resulting in reliability issues in task execution.

Method used

By parsing the upgrade message to obtain service parameter information, the first cluster with the latest version is created among all clusters under the target service, and a trigger message is sent to the first cluster according to the task trigger time to enable it to execute the task, avoiding terminating tasks in existing clusters during the upgrade.

Benefits of technology

It achieves seamless switching during the task upgrade process, avoids task execution failure, improves the reliability of task execution, and releases resources of clusters with non-latest versions through resource recycling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114020310B_ABST
    Figure CN114020310B_ABST
Patent Text Reader

Abstract

The disclosed embodiments relate to a task processing method, apparatus, device, and medium, wherein the method comprises: in response to receiving an upgrade message, parsing the upgrade message to obtain service parameter information; creating a first cluster under the corresponding target service based on the service parameter information, wherein the first cluster is the cluster with the latest version among all clusters under the target service; and sending a trigger message to the first cluster according to the task trigger time, so that the first cluster executes the task according to the trigger message. The above technical solution solves the problem of ongoing task failure caused by upgrades, avoids task execution failures caused by upgrades, and improves the reliability of task execution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, and in particular to a task processing method, apparatus, device, and medium. Background Art

[0002] In business scenarios, there is a need to perform specified operations periodically. Therefore, scheduled tasks are often set up for these periodic operations and are used to periodically execute these operations. With the widespread use of scheduled tasks, upgrading them is crucial.

[0003] In related technologies, scheduled tasks are scheduled through a platform and are dispatched to an execution side for execution. When there is a scheduled task being executed on the execution side, if the scheduled task is upgraded, the scheduled task being executed will fail. Summary of the Invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a task processing method, apparatus, device and medium.

[0005] The present disclosure provides a task processing method, the method comprising:

[0006] In response to receiving the upgrade message, parsing the upgrade message to obtain service parameter information;

[0007] Creating a first cluster under the corresponding target service according to the service parameter information, wherein the first cluster is a cluster having the latest version among all clusters under the target service;

[0008] A trigger message is sent to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message.

[0009] The present disclosure provides another task processing method, which includes:

[0010] Creating a first cluster, wherein the first cluster is a cluster having the latest version among all clusters;

[0011] Receiving a trigger message, wherein the trigger message is sent by the robot service according to the trigger time of the task;

[0012] The task is executed in the first cluster according to the trigger message.

[0013] The present disclosure also provides a task processing device, comprising:

[0014] a parsing module, configured to, in response to receiving an upgrade message, parse the upgrade message to obtain service parameter information;

[0015] An upgrade module, configured to create a first cluster under the corresponding target service according to the service parameter information, wherein the first cluster is a cluster having the latest version among all clusters under the target service;

[0016] The triggering module is configured to send a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message.

[0017] The present disclosure also provides another task processing device, comprising:

[0018] A creation module, configured to create a first cluster, wherein the first cluster is a cluster having the latest version among all clusters;

[0019] A receiving module, configured to receive a trigger message, wherein the trigger message is sent by the robot service according to the trigger time of the task;

[0020] An execution module is configured to execute the task in the first cluster according to the trigger message.

[0021] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing instructions executable by the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the task processing method provided by the embodiment of the present disclosure.

[0022] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the task processing method provided by the embodiment of the present disclosure.

[0023] The technical solution provided by the embodiments of the present disclosure has the following advantages over the prior art: the task processing solution provided by the embodiments of the present disclosure, wherein the robot service parses the upgrade message to obtain service parameter information, and creates a first cluster under the corresponding target service based on the service parameter information, wherein the first cluster is the cluster with the latest version among all clusters under the target service, and the robot service sends a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message. The above technical solution is adopted, and by creating a new cluster when the task is upgraded, the tasks currently being executed in the existing cluster will not be terminated during the upgrade, thus solving the problem of the failure of the tasks being executed during the upgrade, avoiding the failure of the task execution due to the upgrade, and improving the reliability of the task execution. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.

[0025] Figure 1 A flowchart of a task processing method provided by an embodiment of the present disclosure;

[0026] Figure 2 A schematic diagram of a task scheduling provided by an embodiment of the present disclosure;

[0027] Figure 3 A flowchart of another task processing method provided by an embodiment of the present disclosure;

[0028] Figure 4 A schematic diagram of task monitoring provided by an embodiment of the present disclosure;

[0029] Figure 5 A schematic diagram of a task trigger provided by an embodiment of the present disclosure;

[0030] Figure 6 A flowchart of another task processing method provided by an embodiment of the present disclosure;

[0031] Figure 7 A schematic diagram of a task execution provided by an embodiment of the present disclosure;

[0032] Figure 8 A schematic diagram of the structure of a task processing device provided in an embodiment of the present disclosure;

[0033] Figure 9 A schematic diagram of the structure of another task processing device provided by an embodiment of the present disclosure;

[0034] Figure 10 A schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0035] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0036] The present disclosure provides a task processing method, which is described below in conjunction with specific embodiments.

[0037] Figure 1 This is a flow chart of a task processing method provided by an embodiment of the present disclosure. The method can be executed by a task processing device, wherein the device can be implemented using software and / or hardware and can generally be integrated into an electronic device. Figure 1 As shown, the method includes:

[0038] Step 101: In response to receiving an upgrade message, parse the upgrade message to obtain service parameter information.

[0039] The method of the embodiment of the present disclosure can be applied to robot services, wherein the robot service can be pre-set to perform operations related to scheduling, triggering, upgrading, monitoring, etc. of tasks, including but not limited to receiving upgrade messages, parsing upgrade messages, triggering tasks, etc.

[0040] In the disclosed embodiments, a robot service receives an upgrade message. For example, an application platform sends the upgrade message to the robot service, where the upgrade message may be an HTTP (Hypertext Transfer Protocol) event. The robot service parses the upgrade message to obtain service parameter information, where the service parameter information is used for task upgrades.

[0041] Step 102: Create a first cluster under the corresponding target service according to the service parameter information.

[0042] In an embodiment of the present disclosure, the robot service upgrades the execution task according to the service parameter information. Optionally, the target service corresponding to the service parameter information is determined, and a first cluster is created under the target service, wherein the first cluster is the cluster with the latest version among all clusters under the target service.

[0043] In actual business scenarios, multiple services can be encapsulated based on business infrastructure components. Optionally, in task processing scenarios, a corresponding task execution service can be set for each of these multiple services. The target service can be any of the multiple task execution services, and the target service can include at least one cluster, each of which can include at least one instance.

[0044] In this embodiment, the version information of each cluster under the target service can be used to determine whether each cluster has the latest version. As an example, the number of clusters under the target service is obtained. If the target service includes only one cluster, this cluster is the cluster with the latest version among all clusters under the target service. If the target service includes multiple clusters, the binary file running in each cluster can be obtained and used to determine whether the cluster has the latest version.

[0045] The following example illustrates the upgrade process.

[0046] As an example, the robot service calls the application programming interface of the code release management module, performs a compilation and packaging operation according to the service parameter information, and obtains a target file. The target file can be generated by compiling and packaging the code repository. In addition, the robot service calls the application programming interface of the cloud engine module, creates a first cluster under the target service according to the target file, so that the first cluster runs the target file. In this example, refer to Figure 2 After parsing and obtaining service parameter information, the robot service compiles, packages, and creates a cluster for the target service's code repository. During the compilation and packaging process, it periodically sends requests to the code release management module to rotate until the compilation and packaging are successful. During the cluster creation process, it periodically sends requests to the cloud engine module to rotate until the cluster is successfully created. The requests sent by the robot service, for example, are HTTP requests. This reduces the human burden and time required to deploy new tasks, compared to manual deployment.

[0047] Step 103: Send a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message.

[0048] The tasks in this embodiment can be scheduled tasks, for example, tasks that are triggered periodically or at a specified time. Scheduled tasks are very common in actual development. For example, periodic message reminders, automatic cancellation of unpaid orders on e-commerce platforms after 30 minutes, and early morning data aggregation and backup can all be implemented through scheduled tasks. The robot service sends a trigger message to the first cluster, and the first cluster executes the task based on the trigger message.

[0049] The following example illustrates the triggering and execution of a task.

[0050] As an example, see Figure 2 The robot service obtains the parameter information of the task by reading the dynamic configuration center and creates a scheduler based on the parameter information. The parameter information of the task includes but is not limited to the task identifier, address information, and personalized configuration parameters such as tenant identifier, user identifier, full execution or partial execution, etc. The address information includes, for example, a service identifier, which can be used to determine the corresponding execution service. For example, for a target service, the scheduler obtains the first cluster running the latest version of the code under the target service through the cluster state management module. The first cluster includes at least one instance. The scheduler obtains the specified address of the instance under the first cluster through the service discovery module and regularly sends trigger messages to the specified address according to the trigger time. After receiving the trigger message, the instance executes the task corresponding to the trigger message.

[0051] For example, consider two clusters. Cluster 1 is included under the target service. The Robot Service sends a trigger message to Cluster 1, causing it to execute tasks based on the trigger message. Furthermore, in response to receiving the upgrade message, the Robot Service creates Cluster 2 under the target service. At this point, the Robot Service sends a trigger message to Cluster 2, causing it to execute tasks based on the trigger message. Because the old Cluster 1 isn't immediately deleted during the upgrade process, tasks currently executing in Cluster 1 don't terminate. Instead, a seamless switch is achieved by creating Cluster 2 and scheduling new tasks to it.

[0052] The task processing solution provided by the embodiment of the present disclosure is that the robot service parses the upgrade message to obtain service parameter information, and creates a first cluster under the corresponding target service based on the service parameter information, wherein the first cluster is the cluster with the latest version among all clusters under the target service, and the robot service sends a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message. The above technical solution solves the problem of the failure of the task being executed due to the upgrade by creating a new cluster when the task is upgraded, and avoids the failure of the task execution due to the upgrade. In addition, by sending a trigger message to the first cluster, seamless switching can be achieved, improving the reliability of task execution.

[0053] Based on the above embodiment, each time an upgrade is performed, a first cluster with the latest version among all clusters under the target service will be created. Then, when a task is triggered, a trigger message is sent to the first cluster so that the first cluster executes the task according to the trigger message, thereby solving the problem of failure of the task being executed when the task is upgraded and improving the reliability of task execution. However, after multiple upgrades, there will be multiple clusters with non-latest versions in the target service. Since a trigger message is sent to the first cluster when a task is triggered, clusters with non-latest versions will be idle. Therefore, in the embodiment of the present disclosure, idle clusters with non-latest versions can be deleted to release resources and achieve resource recovery. The following is combined with Figure 3 Provide explanation.

[0054] Figure 3 A flowchart of another task processing method provided by an embodiment of the present disclosure is shown as follows: Figure 3 As shown, the method includes:

[0055] Step 301: Obtain the task processing status and version information of each cluster in all clusters under the target service.

[0056] In this embodiment, the robot service analyzes all clusters under the target service and obtains the task processing status and version information of each cluster.

[0057] Among them, the task processing status may include a working state and an idle state. When tasks in all instances under a cluster are completed, the task processing state of the cluster is determined to be an idle state. When there are uncompleted tasks in any instance under the cluster, the task processing state of the cluster is determined to be a working state.

[0058] The version information of the cluster can be determined based on the binary files running in the cluster.

[0059] Step 302: Determine a second cluster from all clusters under the target service.

[0060] The task processing status of the second cluster is idle, and the version information of the second cluster is not the latest version. As an example, the target service includes cluster 1 and cluster 2, where both clusters 1 and 2 are idle, cluster 2 is the first cluster with the latest version, and cluster 1's version information is not the latest version. In this case, cluster 1 under the target service is determined to be the second cluster.

[0061] In some embodiments, the robotic service periodically sends status requests to each cluster in the target service. Each cluster determines the status of its own executing tasks based on the status requests and returns this information to the robotic service. The robotic service then updates the status of the executing tasks based on the returned status information, such as the task's execution progress and resource usage. This enables task monitoring and timely updates of task status, ensuring the timeliness of the status of the executing tasks in each cluster's instances.

[0062] Step 303: Execute a deletion operation on the second cluster.

[0063] In this embodiment, refer to Figure 4 , you can perform a deletion operation on the second cluster under the target service that is not the latest version and is in an idle state, which can release resources and achieve resource recovery.

[0064] Based on the above embodiment, the task triggering scheme is described below.

[0065] In one embodiment of the present disclosure, sending a trigger message to the first cluster according to the trigger time of the task includes: obtaining parameter information of the task; creating a scheduler corresponding to the task locally according to the parameter information of the task; and sending a hypertext protocol request to the first cluster according to the trigger time of the task based on the scheduler.

[0066] As an example, a local task library can be developed to automatically parse task expressions, which can be in string format. Based on the parsed expression, a scheduler corresponding to the task is created in the operating system. The scheduler triggers the task by sending an HTTP request at the trigger time. This triggering solution enables the creation of a local scheduler to trigger tasks, eliminating the need for external triggers. Scheduling accuracy reaches the second level, improving scheduling precision.

[0067] In one embodiment of the present disclosure, sending a trigger message to the first cluster according to the trigger time of the task includes: generating a trigger message using a clock or a hypertext protocol as a trigger source of the task; and sending the trigger message to a message queue, so that the message queue sends the trigger message to the first cluster.

[0068] In this embodiment, with the help of the trigger platform, the clock or HTTP is used as the trigger source, and the parameters are serialized into a trigger message. Figure 5 By adding a trigger message to a message queue, the message queue sends the trigger message to the corresponding target service (for example, Service 1 or Service 2 in the figure). The target service converts the trigger message into one or more executable subtasks. By designing a lightweight trigger platform, scheduling accuracy can be improved to meet the precision requirements of task triggering scenarios.

[0069] Optionally, in the above embodiment, when the trigger source is HTTP, it can be directly dispatched to the first cluster for processing.

[0070] The task processing solution provided by the embodiments of the present disclosure can improve the scheduling accuracy of tasks, reduce scheduling delays, and start tasks in a timely manner.

[0071] The task processing method of the embodiment of the present disclosure is described below with respect to the target service side.

[0072] Figure 6 A flowchart of another task processing method provided by an embodiment of the present disclosure is shown as follows: Figure 6 As shown, the method includes:

[0073] Step 601: Create a first cluster.

[0074] In embodiments of the present disclosure, the target service may be applied, wherein the first cluster is the cluster with the latest version among all clusters under the target service. Optionally, the target service may include at least one cluster, each of which may include at least one instance. Whether each cluster has the latest version can be determined based on the version information of each cluster under the target service. The cluster version information can be determined based on the binary files running on the cluster.

[0075] Step 602: Receive a trigger message.

[0076] Among them, the trigger message is sent by the robot service according to the trigger time of the task;

[0077] In this embodiment, the robotics service sends a trigger message to the first cluster according to the task's trigger time. For example, the target service includes Cluster 1 and Cluster 2. Cluster 2 is created by the robotics service in response to receiving the upgrade message. Cluster 2 is the first cluster with the latest version of the target service's clusters. At this time, the robotics service sends a trigger message to Cluster 2, causing Cluster 2 to execute the task according to the trigger message.

[0078] Step 603: Execute the task in the first cluster according to the trigger message.

[0079] As an example, the first cluster includes at least one instance. When the robot service sends a task trigger message, it determines the instance with the specified address corresponding to the trigger message and sends the trigger message to the specified address. The instance at the specified address in the first cluster then executes the task according to the trigger message. Optionally, the same cluster uses the same consumer group to execute tasks to avoid duplicate tasks.

[0080] The explanation of the task processing method in the aforementioned embodiment is also applicable to this embodiment and will not be repeated here.

[0081] The task processing solution provided by the disclosed embodiment creates a first cluster under the target service, receives a trigger message, and executes the task in the first cluster according to the trigger message. By adopting the above technical solution, by creating a new first cluster when a task is upgraded, the upgrade does not terminate the tasks currently being executed in the existing cluster, thus resolving the problem of the upgrade causing the failure of the currently executing task, avoiding task execution failures caused by the upgrade, and achieving seamless switching when the task is executed by the first cluster according to the trigger message, thereby improving the reliability of task execution.

[0082] Based on the above embodiment, the execution scheme of the task is described below.

[0083] In one embodiment of the present disclosure, executing a task according to a trigger message includes: obtaining a task concurrency value, wherein the task concurrency value is determined based on the number of tasks currently being executed concurrently; if the task concurrency value is less than a preset threshold, controlling the task concurrency value to increase by one, and concurrently executing the task.

[0084] In this embodiment, based on the signal synchronization mechanism, multiple tasks can be executed concurrently. As an example, refer to Figure 7The first cluster obtains the current task concurrency value, which is equal to the number of tasks currently being executed concurrently. If the current task concurrency value is less than the preset threshold, it obtains a trigger message from the message queue and verifies whether the service identifier carried in the trigger message is consistent with the pre-stored identifier. If not, it sends an ACK (Acknowledgement) message indicating that the service identifier is inconsistent with the pre-stored identifier. If they are consistent, it determines whether there is a handler corresponding to the task name. If not, it generates a log and an alarm. If so, it controls the task concurrency value to increase by one, starts a coroutine to concurrently execute the task, and sends the corresponding ACK message.

[0085] In one embodiment of the present disclosure, referring to Figure 7 , executing a task may include: when the number of tenants corresponding to the task is multiple, converting the task into multiple subtasks according to the number of tenants; executing multiple subtasks concurrently, and when it is detected that multiple subtasks have been executed, controlling the task concurrency value to decrease by one.

[0086] In this embodiment, based on the signal synchronization mechanism, tasks are divided into multiple subtasks according to tenants, and multiple subtasks can be executed concurrently, wherein tenants can correspond to enterprises. As an example, refer to Figure 7 , determine the number of tenants corresponding to the task. If the number of tenants corresponding to the task is one, the task is executed by a single coroutine; if the number of tenants corresponding to the task is multiple, the task is converted into multiple subtasks, one subtask for each tenant, and multiple subtasks are executed concurrently. When the task single coroutine is executed or multiple subtasks are executed, the task concurrency value is controlled to decrease by one. Optionally, before determining the number of tenants corresponding to the task, it can be determined whether there is a task of the same type that has been executed. If so, the task is skipped and the task concurrency value is controlled to decrease by one.

[0087] The task processing solution provided by the disclosed embodiments enables the concurrent execution of multiple tasks within the same cluster, allowing all tasks to share a single service permission, eliminating the need to apply for permissions for each task separately, simplifying operations. Furthermore, all tasks share a single virtualized container, using the same binary package file as the online service, eliminating the need to maintain a separate virtualized container for each task, thus reducing maintenance costs. Furthermore, each task can be further divided into multiple subtasks, executed concurrently, based on tenants, further improving processing efficiency.

[0088] Figure 8 This is a structural diagram of a task processing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into electronic devices for task processing. Figure 8 As shown, the task processing device includes: a parsing module 81, an upgrading module 82, and a triggering module 83.

[0089] The parsing module 81 is configured to, in response to receiving the upgrade message, parse the upgrade message to obtain service parameter information.

[0090] The upgrading module 82 is configured to create a first cluster under the corresponding target service according to the service parameter information, wherein the first cluster is a cluster having the latest version among all clusters under the target service.

[0091] The triggering module 83 is configured to send a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message.

[0092] The task processing device provided by the embodiments of the present disclosure can execute the task processing method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0093] Figure 9 This is a structural diagram of another task processing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into electronic devices for task processing. Figure 9 As shown, the task processing device includes: a creation module 91, a receiving module 92, and an execution module 93.

[0094] The creation module 91 is configured to create a first cluster, wherein the first cluster is a cluster having the latest version among all clusters.

[0095] The receiving module 92 is used to receive a trigger message, wherein the trigger message is sent by the robot service according to the trigger time of the task.

[0096] The execution module 93 is configured to execute the task in the first cluster according to the trigger message.

[0097] The task processing device provided by the embodiments of the present disclosure can execute the task processing method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0098] In order to implement the above embodiments, the present disclosure further proposes a computer program product, including a computer program / instruction, which implements the task processing method in the above embodiments when executed by a processor.

[0099] Figure 10 A schematic structural diagram of an electronic device provided in an embodiment of the present disclosure.

[0100] The following specific reference Figure 10, which shows a schematic structural diagram of an electronic device 1000 suitable for implementing the embodiments of the present disclosure. The electronic device 1000 in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 10 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0101] like Figure 10 As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. Various programs and data required for the operation of the electronic device 1000 are also stored in the RAM 1003. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0102] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Figure 10 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.

[0103] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the task processing method of the embodiment of the present disclosure are performed.

[0104] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0105] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0106] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0107] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: in response to receiving an upgrade message, parses the upgrade message to obtain service parameter information; creates a first cluster under the corresponding target service according to the service parameter information, wherein the first cluster is the cluster with the latest version among all clusters under the target service; sends a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message.

[0108] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0109] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0110] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.

[0111] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0112] According to one or more embodiments of the present disclosure, the present disclosure provides a task processing method, including:

[0113] In response to receiving the upgrade message, parsing the upgrade message to obtain service parameter information;

[0114] Creating a first cluster under the corresponding target service according to the service parameter information, wherein the first cluster is a cluster having the latest version among all clusters under the target service;

[0115] A trigger message is sent to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message.

[0116] According to one or more embodiments of the present disclosure, in the task processing method provided by the present disclosure, creating a first cluster under the corresponding target service according to the service parameter information includes: calling the application programming interface of the code release management module, performing compilation and packaging operations according to the service parameter information to obtain the target file; calling the application programming interface of the cloud engine module, creating the first cluster under the target service based on the target file.

[0117] According to one or more embodiments of the present disclosure, in the task processing method provided by the present disclosure, the method further includes: obtaining the task processing status and version information of each cluster in all clusters under the target service; determining a second cluster from all the clusters, wherein the task processing status of the second cluster is an idle state and the version information of the second cluster is not the latest version; and performing a deletion operation on the second cluster.

[0118] According to one or more embodiments of the present disclosure, in the task processing method provided by the present disclosure, the method further includes: periodically sending a status acquisition request to the cluster in the target service, so that the cluster returns status information of the executing task according to the status acquisition request; and updating the status of the executing task according to the returned status information.

[0119] According to one or more embodiments of the present disclosure, in the task processing method provided by the present disclosure, sending a trigger message to the first cluster according to the trigger time of the task includes: obtaining parameter information of the task; locally creating a scheduler corresponding to the task according to the parameter information of the task; and based on the scheduler, sending a hypertext protocol request to the first cluster according to the trigger time of the task.

[0120] According to one or more embodiments of the present disclosure, in the task processing method provided by the present disclosure, sending a trigger message to the first cluster according to the trigger time of the task includes: using a clock or a hypertext protocol as the trigger source of the task to generate the trigger message; sending the trigger message to a message queue, so that the message queue sends the trigger message to the first cluster.

[0121] According to one or more embodiments of the present disclosure, the present disclosure provides a task processing method, including:

[0122] Create a first cluster, where the first cluster is the cluster with the latest version among all clusters;

[0123] Receiving a trigger message, wherein the trigger message is sent by the robot service according to the trigger time of the task;

[0124] The task is executed in the first cluster according to the trigger message.

[0125] According to one or more embodiments of the present disclosure, in the task processing method provided by the present disclosure, executing the task according to the trigger message includes: obtaining a task concurrency value, wherein the task concurrency value is determined based on the number of tasks currently executed concurrently; when the task concurrency value is less than a preset threshold, controlling the task concurrency value to increase by one, and executing the tasks concurrently.

[0126] According to one or more embodiments of the present disclosure, in the task processing method provided by the present disclosure, executing the task includes: when the number of tenants corresponding to the task is multiple, converting the task into multiple subtasks according to the number of tenants; executing the multiple subtasks concurrently; and when it is detected that the execution of the multiple subtasks is completed, controlling the task concurrency value to be reduced by one.

[0127] According to one or more embodiments of the present disclosure, the present disclosure provides a task processing device, including:

[0128] a parsing module, configured to, in response to receiving an upgrade message, parse the upgrade message to obtain service parameter information;

[0129] An upgrade module, configured to create a first cluster under the corresponding target service according to the service parameter information, wherein the first cluster is a cluster having the latest version among all clusters under the target service;

[0130] The triggering module is configured to send a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message.

[0131] According to one or more embodiments of the present disclosure, in the task processing device provided by the present disclosure, the upgrade module is specifically used to: call the application programming interface of the code release management module, perform compilation and packaging operations according to service parameter information to obtain the target file; call the application programming interface of the cloud engine module, and create a first cluster under the target service according to the target file.

[0132] According to one or more embodiments of the present disclosure, in the task processing device provided by the present disclosure, the task processing device also includes: a resource recovery module, used to obtain the task processing status and version information of each cluster in all clusters under the target service; determine a second cluster from all the clusters, wherein the task processing status of the second cluster is an idle state, and the version information of the second cluster is not the latest version; perform a deletion operation on the second cluster.

[0133] According to one or more embodiments of the present disclosure, in the task processing device provided by the present disclosure, the task processing device also includes: a status update module, which is used to periodically send a status acquisition request to the cluster in the target service, so that the cluster returns the status information of the executing task according to the status acquisition request; and updates the status of the executing task according to the returned status information.

[0134] According to one or more embodiments of the present disclosure, in the task processing device provided by the present disclosure, the trigger module is specifically used to: obtain parameter information of the task; create a scheduler corresponding to the task locally according to the parameter information of the task; and based on the scheduler, send a hypertext protocol request to the first cluster according to the trigger time of the task.

[0135] According to one or more embodiments of the present disclosure, in the task processing device provided by the present disclosure, the trigger module is specifically used to: use a clock or hypertext protocol as the trigger source of the task to generate the trigger message; send the trigger message to a message queue, so that the message queue sends the trigger message to the first cluster.

[0136] According to one or more embodiments of the present disclosure, the present disclosure provides a task processing device, including:

[0137] A creation module, configured to create a first cluster, wherein the first cluster is a cluster having the latest version among all clusters;

[0138] A receiving module, configured to receive a trigger message, wherein the trigger message is sent by the robot service according to the trigger time of the task;

[0139] An execution module is configured to execute the task in the first cluster according to the trigger message.

[0140] According to one or more embodiments of the present disclosure, in the task processing device provided by the present disclosure, the execution module is specifically used to: obtain a task concurrency value, wherein the task concurrency value is determined based on the number of tasks currently being executed concurrently; when the task concurrency value is less than a preset threshold, control the task concurrency value to be increased by one, and concurrently execute the tasks.

[0141] According to one or more embodiments of the present disclosure, in the task processing device provided by the present disclosure, the execution module is specifically used to: when the number of tenants corresponding to the task is multiple, convert the task into multiple subtasks according to the number of tenants; execute the multiple subtasks concurrently; and when it is detected that the execution of the multiple subtasks is completed, control the task concurrency value to be reduced by one.

[0142] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; the processor for reading the executable instructions from the memory and executing the instructions to implement any task processing method provided by the present disclosure.

[0143] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute any task processing method provided by the present disclosure.

[0144] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0145] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.

[0146] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules, or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules, or units. The modifications of "one" and "plurality" mentioned in this disclosure are illustrative and not restrictive. Those skilled in the art should understand that unless the context clearly indicates otherwise, they should be understood to mean "one or more."

[0147] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

Claims

1. A task processing method, characterized in that: The following steps are involved: In response to receiving an upgrade message for a task, parsing the upgrade message to obtain service parameter information; Creating a first cluster under the corresponding target service according to the service parameter information, wherein the first cluster is a cluster with the latest version among all clusters under the target service, and the version information of the cluster is determined according to the file running the cluster; Sending a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message; the task includes a scheduled task, and for a scheduled task being executed in any existing cluster among all the clusters, the scheduled task being executed is not terminated when the task is upgraded; Get the task processing status and version information of each cluster in all clusters under the target service; Determine a second cluster from all the clusters, wherein the task processing state of the second cluster is idle, and the version information of the second cluster is not the latest version; A deletion operation is performed on the second cluster.

2. The method according to claim 1, wherein The creating a first cluster under the corresponding target service according to the service parameter information includes: Calling the application programming interface of the code release management module, performing a compile and package operation according to the service parameter information, and obtaining a target file; An application programming interface of a cloud engine module is called to create a first cluster under the target service according to the target file.

3. The method according to claim 1, wherein Also includes: Periodically sending a status acquisition request to the cluster in the target service, so that the cluster returns status information of the executing task according to the status acquisition request; The status of the executing task is updated according to the returned status information.

4. The method according to claim 1, wherein The sending a trigger message to the first cluster according to the trigger time of the task includes: Obtaining parameter information of the task; Creating a scheduler corresponding to the task locally according to the parameter information of the task; Based on the scheduler, a hypertext protocol request is sent to the first cluster according to the triggering time of the task.

5. The method according to claim 1, wherein The sending a trigger message to the first cluster according to the trigger time of the task includes: Using a clock or a hypertext protocol as a trigger source for the task to generate the trigger message; The trigger message is sent to a message queue, so that the message queue sends the trigger message to the first cluster.

6. A task processing method, characterized in that: include: Creating a first cluster, wherein the first cluster is a cluster having the latest version among all clusters, and the version information of the cluster is determined according to the files running in the cluster; Receiving a trigger message, wherein the trigger message is sent by the robot service according to the trigger time of the task, and the task includes a scheduled task; executing the task in the first cluster according to the trigger message, and not terminating a scheduled task being executed in any existing cluster among all the clusters when the task is upgraded; Obtaining the task processing status and version information of each cluster in all the clusters; Determine a second cluster from all the clusters, wherein the task processing state of the second cluster is idle, and the version information of the second cluster is not the latest version; A deletion operation is performed on the second cluster.

7. The method according to claim 6, wherein Executing the task according to the trigger message includes: Obtaining a task concurrency value, wherein the task concurrency value is determined based on the number of tasks currently being executed concurrently; When the task concurrency value is less than a preset threshold, the task concurrency value is controlled to increase by one, and the tasks are executed concurrently.

8. The method according to claim 7, wherein The performing of the task comprises: In the case that the task corresponds to multiple tenants, converting the task into multiple subtasks according to the number of tenants; executing the multiple subtasks concurrently; When it is detected that the execution of the plurality of subtasks is completed, the task concurrency value is controlled to be reduced by one.

9. A task processing device, characterized in that: include: a parsing module, configured to, in response to receiving an upgrade message for a task, parse the upgrade message to obtain service parameter information; An upgrade module, configured to create a first cluster under the corresponding target service according to the service parameter information, wherein the first cluster is a cluster having the latest version among all clusters under the target service, and the version information of the cluster is determined according to a file running on the cluster; a trigger module, configured to send a trigger message to the first cluster according to the trigger time of the task, so that the first cluster executes the task according to the trigger message; the task includes a scheduled task, and for a scheduled task being executed in any existing cluster among all the clusters, the scheduled task being executed is not terminated when the task is upgraded; A resource recovery module is used to obtain the task processing status and version information of each cluster in all clusters under the target service; Determine a second cluster from all the clusters, wherein the task processing state of the second cluster is idle, and the version information of the second cluster is not the latest version; A deletion operation is performed on the second cluster.

10. A task processing device, characterized in that: include: A creation module, configured to create a first cluster, wherein the first cluster is a cluster having the latest version among all clusters, and the version information of the cluster is determined according to a file running on the cluster; A receiving module, configured to receive a trigger message, wherein the trigger message is sent by the robot service according to a trigger time of a task; the task includes a scheduled task; an execution module, configured to execute the task in the first cluster according to the trigger message, and not terminate the scheduled task being executed in any existing cluster among all the clusters when the task is upgraded; wherein, obtaining the task processing status and version information of each cluster in all the clusters; Determine a second cluster from all the clusters, wherein the task processing state of the second cluster is idle, and the version information of the second cluster is not the latest version; A deletion operation is performed on the second cluster.

11. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the task processing method described in any one of claims 1 to 5 or the task processing method described in any one of claims 6 to 8.

12. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and the computer program is used to execute the task processing method described in any one of claims 1 to 5 or realize the task processing method described in any one of claims 6 to 8.

13. A computer program product, characterized in that The computer program product includes a computer program / instruction, and when the computer program / instruction is executed by a processor, it implements the task processing method according to any one of claims 1 to 5 or the task processing method according to any one of claims 6 to 8.

Citation Information

Patent Citations

  • Task scheduling method and system

    CN108984290A

  • Application upgrading method and equipment

    CN111324361A