A task scheduling method, system and device
By configuring the identification information of the task execution unit for the task, the executor forwards the task to the task execution unit for execution, the problem of high cost of executor development in the prior art is solved, and low-cost and flexible task execution is achieved.
Patent Information
- Application Number
- CN202210307610.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-03-25
AI Technical Summary
In an architecture that includes a scheduling center and an executor, the prior art requires the execution of related programs based on the executor development task, resulting in high development costs.
By configuring the identification information of the task execution unit for the task, the executor forwards the task to the task execution unit for execution, rather than performing the task itself, the task execution unit does not need to be developed based on the executor.
It reduces the development cost of the task execution unit, simplifies the development logic of the executor, and improves the flexibility and resource utilization efficiency of the task execution unit.
Smart Images

Figure CN114579283B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer application technologies, and particularly to a task scheduling method, system, and device. Background Art
[0002] Currently, in an architecture including a scheduling center and an executor, the scheduling center is used to schedule tasks and send the tasks that need to be executed currently to the executor; the executor is used to execute the received tasks.
[0003] Among them, relevant programs for task execution need to be developed based on the executor, and the development cost is relatively high. Summary of the Invention
[0004] To solve the above problems, the embodiments of this specification provide a task scheduling method, system, and device. The technical solutions are as follows.
[0005] A task scheduling method includes:
[0006] The scheduling center determines the target task that needs to be executed currently, determines the target executor, and sends the target task to the target executor; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task;
[0007] The target executor sends the target task to the target task execution unit according to the identification information, determines the task execution result of the target task, and returns the task execution result to the scheduling center.
[0008] A task scheduling method applied to an executor, the method includes:
[0009] Receiving the target task sent by the scheduling center; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task;
[0010] Sending the target task to the target task execution unit according to the identification information, determining the task execution result of the target task, and returning the task execution result to the scheduling center.
[0011] A task scheduling method applied to a scheduling center, the method includes:
[0012] Determine the target task to be processed currently, and determine the target executor, and send the target task to the target executor; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task; the target executor is used to send the target task to the target task processing unit according to the identification information, and determine the task processing result of the target task;
[0013] Receive the task processing result sent by the target executor.
[0014] A task scheduling system, comprising:
[0015] A scheduling center, configured to determine the target task to be executed currently, and determine the target executor, and send the target task to the target executor; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task;
[0016] The target executor is configured to send the target task to the target task execution unit according to the identification information, determine the task execution result of the target task, and return the task execution result to the scheduling center.
[0017] A task scheduling device, applied to an executor, the device comprising:
[0018] A receiving module, configured to receive the target task sent by the scheduling center; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task;
[0019] A sending module, configured to send the target task to the target task execution unit according to the identification information;
[0020] A feedback module, configured to determine the task execution result of the target task, and return the task execution result to the scheduling center.
[0021] A task scheduling device, applied to the scheduling center, the device comprising:
[0022] A determination module, configured to determine the target task to be processed currently, and determine the target executor, and send the target task to the target executor; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task; the target executor is used to send the target task to the target task processing unit according to the identification information, and determine the task processing result of the target task;
[0023] A result module, configured to receive the task processing result sent by the target executor.
[0024] In the above technical solution, by decoupling the actuator from the task execution, the actuator itself does not need to execute the task, but forwards the task to the task execution unit for execution, so that the task execution unit does not need to be developed based on the actuator, reducing the development cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the embodiments of this specification. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0026] Figure 1 It is a schematic diagram of the principle of a task scheduling provided by an embodiment of this specification;
[0027] Figure 2 It is a schematic diagram of the principle of a task scheduling method provided by an embodiment of this specification;
[0028] Figure 3 It is a schematic flowchart of a task scheduling method provided by an embodiment of this specification;
[0029] Figure 4 It is a schematic diagram of the principle of another task scheduling method provided by an embodiment of this specification;
[0030] Figure 5 It is a schematic diagram of the structure of a task scheduling system provided by an embodiment of this specification;
[0031] Figure 6 It is a schematic diagram of the structure of a task scheduling device provided by an embodiment of this specification;
[0032] Figure 7 It is a schematic diagram of the structure of another task scheduling device provided by an embodiment of this specification;
[0033] Figure 8 It is a schematic diagram of the structure of a device for configuring the method of the embodiment of this specification. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0034] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of this specification, the following will describe the technical solutions in the embodiments of this specification in detail in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art should fall within the scope of the disclosure.
[0035] Currently, in an architecture including a scheduling center and executors, the scheduling center is used to schedule tasks and send the tasks that need to be executed currently to the executors; the executors are used to execute the received tasks.
[0036] Specifically, the executor usually needs to run relevant programs for task execution to execute the received tasks.
[0037] Among them, relevant programs for task execution need to be developed based on the executor, and the development cost is relatively high.
[0038] Specifically, it is usually necessary to develop based on the programming language used by the executor, and it is also necessary to learn relevant knowledge of the executor, such as executor functions, configuration items, etc., in order to develop programs based on the executor, and the development cost is relatively high.
[0039] For example, an executor written in the C language itself contains several configuration information and basic functions, including: the authentication token configured by the executor, the function of the executor actively registering to the scheduling center, etc.
[0040] In order for the executor to execute tasks, it is necessary to further develop the executor, deploy functional code and run it. Specifically, for the execution of accounting tasks, it is necessary to develop a program specifically for executing accounting tasks based on the executor. Therefore, it is necessary to use the C language for development and learn relevant knowledge of the executor, such as the meaning of the dependent packages and configuration items of the executor, and the development cost is relatively high.
[0041] For ease of understanding, as Figure 1 shown, it is a schematic diagram of the principle of a task scheduling provided by an embodiment of this specification.
[0042] It includes a scheduling center and three executors, namely Executor 1-3.
[0043] Executor 1 is used to execute accounting tasks, Executor 2 is used to execute sales tasks, and Executor 3 is used to execute ordering tasks.
[0044] The scheduling center can schedule all accounting tasks to Executor 1 for execution, schedule all sales tasks to Executor 2 for execution, and schedule all ordering tasks to Executor 3 for execution.
[0045] Among them, when specifically deploying Executor 1-3, it is necessary to develop corresponding functions based on the executor respectively, and the development cost is relatively high.
[0046] To solve the above problems, an embodiment of this specification provides a task scheduling method.
[0047] In this method, task execution unit identification information for executing the task can be configured for the task. Among them, the task execution unit is used to execute the task, rather than the executor executing the task.
[0048] When the scheduling center schedules tasks, it can send the tasks that need to be executed currently to the executor, and the executor can send the task to the task execution unit corresponding to the identification information configured for the task for subsequent task execution, and the executor can determine the task execution result. Among them, the identification information may include address information, for example, IP address, uniform resource locator, etc.
[0049] In this method, the executor itself may not execute the task, but forward the task. The relationship between the task execution unit and the executor is a data interaction relationship. Therefore, the task execution unit does not need to be developed based on the executor, as long as it can execute the received task.
[0050] Therefore, for the task execution unit used to execute tasks, it does not need to use the programming language of the executor, nor does it need to learn the relevant knowledge of the executor. For example, it does not need to call the dependency package of the executor, nor does it need to learn the meaning of the configuration items of the executor, reducing the development cost.
[0051] This method decouples the executor from task execution. The executor itself does not need to execute tasks, but forwards the tasks to the task execution unit for execution, so that the task execution unit does not need to be developed based on the executor, reducing the development cost.
[0052] It should be noted that since the executor is decoupled from task execution, the executor does not necessarily forward the same type of task fixedly, and the task does not need to be bound to the executor, as long as the executor can forward according to the identification information configured for the task.
[0053] As Figure 2 shown, it is a schematic diagram of the principle of a task scheduling method provided by an embodiment of this specification.
[0054] It includes a scheduling center, 3 executors, and 2 task execution units.
[0055] The 3 executors are respectively Executor 1-3. The 2 task execution units are respectively the accounting unit and the meal ordering unit. The accounting unit is used to execute accounting tasks, and the meal ordering unit is used to execute meal ordering tasks.
[0056] The scheduling center can schedule the accounting task to any executor for forwarding.
[0057] For example, the scheduling center can schedule Accounting Task 1 to Executor 1, and then schedule another Accounting Task 2 to Executor 2. Since Accounting Task 1 and 2 are both configured with the address information of the accounting unit, Executor 1 and Executor 2 can respectively send Accounting Task 1 and 2 to the accounting unit according to the address information configured for Accounting Task 1 and 2.
[0058] The scheduling center can also schedule the meal ordering task 1 to the executor 2 and another meal ordering task 2 to the executor 3. Since both the meal ordering tasks 1 and 2 are configured with the address information of the meal ordering unit, the executor 2 and the executor 3 can respectively send the meal ordering tasks 1 and 2 to the meal ordering unit according to the address information configured for the meal ordering tasks 1 and 2.
[0059] It can be seen that the executor 2 can forward the accounting task or the meal ordering task.
[0060] Among them, the task execution unit, such as the accounting unit and the meal ordering unit, can develop corresponding functions without relying on the executor, as long as it can execute the received tasks, which reduces the development cost.
[0061] Next, in combination with the accompanying drawings, a task scheduling method provided in the embodiments of this specification will be explained in detail.
[0062] As Figure 3 shown, it is a schematic flowchart of a task scheduling method provided in the embodiments of this specification. It should be noted that this method flow is explained for the scheduling of a single task. It can be understood that for the scheduling of multiple tasks, it can be simply inferred based on this method flow and will not be elaborated here. For the convenience of description, the task scheduled by this method flow is called the target task, and the target task can be any task.
[0063] This method flow may include the following steps.
[0064] S101: The scheduling center determines the target task that needs to be executed currently, determines the target executor, and sends the target task to the target executor.
[0065] The target task may be configured with the identification information of the target task execution unit; the target task execution unit can be used to execute the target task.
[0066] S102: The target executor sends the target task to the target task execution unit according to the identification information configured for the target task.
[0067] S103: The target executor determines the task execution result of the target task and returns the task execution result to the scheduling center.
[0068] By decoupling the executor from the task execution, the above method flow enables the executor itself not to execute the task, but to forward the task to the task execution unit for execution, so that the task execution unit does not need to be developed based on the executor, reducing the development cost.
[0069] It should be noted that in this method flow, since the executor does not execute the task but forwards the task, the implementation logic is relatively simple. Therefore, optionally, the scheduling center and the executor can be deployed on the same device.
[0070] Optionally, the scheduling center and the executor can also be deployed on different devices, which can reduce the possibility of resource competition between the scheduling center and the executor.
[0071] The following provides a detailed explanation for each step.
[0072] S101: The scheduling center determines the target task that needs to be executed currently, determines the target executor, and sends the target task to the target executor.
[0073] Among them, the target task can be configured with the identification information of the target task execution unit; the target task execution unit can be used to execute the target task.
[0074] 1) Regarding the scheduling center.
[0075] In an alternative embodiment, the scheduling center can store a number of pre-configured tasks and the scheduling conditions of the tasks. The scheduling center can determine whether a task needs to be executed currently according to the scheduling conditions of the task.
[0076] This embodiment does not limit the specific form and content of the scheduling conditions. Optionally, the scheduling conditions can include timing scheduling conditions, periodic scheduling conditions, manual scheduling conditions, event scheduling conditions, etc.
[0077] The timing scheduling condition can be to execute the corresponding task at a fixed time point; the periodic scheduling condition can be to execute the corresponding task again after a fixed duration after the last execution of the corresponding task, that is, to execute the corresponding task periodically; the manual scheduling condition can be to determine that the corresponding task needs to be executed according to the instruction issued by manual operation; the event scheduling condition can be to determine that the corresponding task needs to be executed when a specified event occurs.
[0078] Therefore, optionally, the scheduling center specifically determines the target task that needs to be executed currently, which can include: the scheduling center can monitor the scheduling conditions of the tasks, and when it determines that a certain scheduling condition is met, it can determine that the corresponding task needs to be executed currently, specifically, it can determine the task corresponding to the scheduling condition as the task that needs to be executed currently.
[0079] Optionally, the tasks and the scheduling conditions of the tasks can be configured by the user.
[0080] In another alternative embodiment, since the scheduling center needs to determine an executor for task forwarding, the scheduling center can store the registered executor information. This embodiment does not limit the executor registration method.
[0081] Optionally, the scheduling center can store the identification information of the registered executors, which facilitates sending tasks to the executors based on the identification information. The identification information may include address information. The scheduling center can also store the remote call information of the registered executors, which facilitates sending tasks to the executors through remote calls.
[0082] 2) Regarding tasks.
[0083] The process flow of this method does not limit the specific form of the tasks, as long as the task execution unit can execute the received tasks.
[0084] For example, for the task of regular accounting, the accounting unit can implement the accounting function. Therefore, the task of regular accounting can be sent to the accounting unit for execution.
[0085] In an optional embodiment, the task can be configured with the identification information of the task execution unit for executing the task. This embodiment does not limit the specific form of the identification information, as long as the executor can send the task to the corresponding task execution unit based on the identification information.
[0086] Optionally, the identification information may include address information. The address information can be, for example, an IP address, a uniform resource locator, etc.
[0087] It should be noted that in the related art, a task can be bound to a fixed executor. Specifically, executor information can be configured for the task, so that the scheduling center schedules the task to the executor according to the executor information configured for the task.
[0088] In the process flow of this method, optionally, the task may not be configured with executor information, but with the identification information of the task execution unit, which facilitates the executor to send the task to the task execution unit corresponding to the identification information.
[0089] In this embodiment, the executor can forward the received task statelessly according to the identification information configured for the task.
[0090] Therefore, for the same task or the same type of tasks, when configured with identification information, it is not necessary to be forwarded by a specific executor, and thus it is not necessary to configure specific executor information for the task.
[0091] Of course, in the process flow of this method, the task can also be configured with executor information.
[0092] This embodiment does not limit the specific form of the identification information, as long as it can send tasks. Optionally, the identification information can be the uniform resource locator of the task execution unit or the IP address of the task execution unit.
[0093] In an alternative embodiment, a task may be configured with a service identifier. The service identifier may characterize the service to which the task belongs. The service identifier may be used in subsequent steps to determine the target executor, and specific explanations can be found later.
[0094] 3) Regarding determining the target executor.
[0095] The process flow of this method does not limit the specific method for determining the target executor.
[0096] Optionally, the target task may be configured with executor information, and the executor corresponding to the executor information configured for the target task may be determined as the target executor.
[0097] Optionally, since the target task is configured with the identification information of the target task execution unit, as long as the determined target executor can send the received task to the task execution unit corresponding to the identification information configured for the task.
[0098] Therefore, optionally, determining the target executor may include: selecting an executor from the executor cluster and determining it as the target executor. Each executor in the executor cluster can be used to send the received task to the task execution unit corresponding to the identification information configured for the task.
[0099] In this embodiment, the target executor can be selected from the executor cluster, which improves the flexibility of the target executor.
[0100] It should be noted that since the executors in the executor cluster do not need to execute tasks but can forward tasks, and the logic for forwarding tasks is relatively simple, the development cost of the executors can be further reduced.
[0101] This embodiment does not limit the deployment method and location of the executor cluster, as long as the scheduling center can send tasks to the executors in the executor cluster. Optionally, one or more executors in the executor cluster can be deployed on the same device as the scheduling center. Optionally, some or all of the executors in the executor cluster can be deployed on the same device.
[0102] Optionally, each executor in the executor cluster has been registered with the scheduling center, and the target executor can be an executor registered with the scheduling center.
[0103] This embodiment does not limit the specific method for selecting the target executor from the executor cluster.
[0104] Optionally, it can be randomly selected, selected in a fixed order, selected based on a hash algorithm, select the currently idle executor, or select according to the number of selections.
[0105] It should be noted that, optionally, the scheduling center can select from the set of registered executor information of itself. The executor information can specifically include executor identification information, which is convenient for subsequent sending of target tasks. The set of executor information can correspond to an executor cluster.
[0106] For ease of understanding, several examples are given below.
[0107] Optionally, a preset fixed order can be set in the executor cluster. The preset fixed order can include all the executors in the executor cluster arranged in sequence. For example, for executors 1 - 3, the preset loop order can be from executor 1 to executor 2 and then to executor 3.
[0108] Specifically selecting the target executor can be to select the next executor after the last selected executor in the preset fixed order. Of course, in the case where the last selected executor is the last executor in the preset fixed order, the first executor in the preset fixed order can be selected.
[0109] Optionally, for each executor in the executor cluster, a hash value within a preset hash value range can be specified, and different executors can be specified with different hash values. When selecting the target executor, it can be to perform a hash operation on the specified information of the target task, such as the target task identifier, the target task name, the target task as a whole, etc., to obtain a task hash value, and then select the smallest hash value from the executor - corresponding hash values greater than the task hash value, and determine the executor corresponding to the selected hash value as the target executor.
[0110] Optionally, load balancing can be performed on the executor cluster, and the executor with the least load is selected and determined as the target executor.
[0111] In another alternative embodiment, the target task can also be configured with a target service identifier.
[0112] Correspondingly, selecting an executor in the executor cluster can include: determining the executors in the executor cluster that are configured with the target service identifier, and selecting one executor from the determined executors.
[0113] Among them, for specifically selecting one executor from the determined executors, reference can be made to the method explanation of selecting the target executor from the executor cluster above, which will not be elaborated here.
[0114] Optionally, the task can be configured with a service identifier, and the service identifier can represent the service to which the task belongs.
[0115] For example, for financial services, multiple tasks can be deployed, which can specifically include tasks for periodically obtaining price information, tasks for periodically reminding of financial information, and so on. For catering services, multiple tasks can also be deployed, which can specifically include tasks for periodic auditing, tasks for ordering meals, tasks for refunds, and so on.
[0116] Correspondingly, a service identifier can be configured for the executor. The service identifier can represent the service to which the executor belongs, thus facilitating matching with the service identifier configured for the task. Among them, by configuring the service identifier for the executor, it can be determined that the executor is a dedicated executor for this service, and is used to forward relevant tasks belonging to this service.
[0117] Therefore, for a target task, it is necessary to determine an executor with the same service identifier in the executor cluster in order to further select the target executor.
[0118] Different services can use different dedicated executors, so that tasks between different services are respectively forwarded by dedicated executors, which facilitates the implementation of data isolation between services and also facilitates the statistics of the task execution status of different services.
[0119] It should be noted that, optionally, the service identifier can include a service provider identifier.
[0120] Different service providers can configure tasks for the same scheduling center. In order to achieve data isolation between different service providers, improve data security, and protect the privacy of service providers, dedicated executors can be allocated to different service providers. Specifically, the service provider identifier can be configured into the executor, so that an executor configured with the target service provider identifier can be determined in the executor cluster, and an executor can be selected from the determined executors.
[0121] 4) Regarding sending the target task to the target executor.
[0122] The process flow of this method does not limit the specific sending method, as long as the target task can be sent to the target executor. Optionally, it can be sent by means of remote invocation, or it can be sent by means of a request message.
[0123] In an optional embodiment, since the identifier information configured for the target task can be used in subsequent steps, the identifier information can be configured inside the target task, or the corresponding identifier information can be configured outside the target task.
[0124] Therefore, optionally, when the corresponding identifier information is configured outside the target task, the scheduling center can send the target task and the identifier information configured for the target task to the target executor.
[0125] S102: The target executor sends the target task to the target task execution unit according to the identification information configured for the target task.
[0126] The process flow of this method does not limit the form of the identification information, nor does it limit the form of sending the target task. As long as the target task can be sent to the corresponding task execution unit according to the identification information. Specifically, it can be sent in the form of a request message.
[0127] In an alternative embodiment, the task execution unit can specifically be a process or program for executing tasks. One device can include one or more task execution units.
[0128] Optionally, the identification information can include the communication address information of the device where the target task execution unit is located, and the access address information of the target task execution unit. Among them, the communication address information, for example, IP address information, and the access address information can specifically be the storage address information of the target task execution unit in the device where it is located.
[0129] The target executor sending the target task to the target task execution unit according to the identification information can include:
[0130] The target executor uses the communication address information in the identification information as the destination address, and uses the access address information and the target task as the payload to construct a request message and send it to the network, so that when the device where the target task execution unit is located receives the request message, it sends the target task to the target task execution unit according to the access address information.
[0131] This embodiment does not limit the format of the request message. It can be an http request message or a udp request message.
[0132] Optionally, the identification information can be the uniform resource locator of the task execution unit, so that the corresponding task execution unit can be accessed according to the identification information and data interaction can be performed with the task execution unit.
[0133] It should be noted that since the executor does not need to execute tasks and can forward tasks, and the logic of forwarding tasks is relatively simple, the development cost of the executor can be further reduced.
[0134] In an alternative embodiment, there may be various situations when sending the target task to the target task execution unit. For example, sending the target task to the target task execution unit successfully, sending the target task to the target task execution unit fails, and the connection establishment with the target task execution unit fails, etc.
[0135] Optionally, when it is sent to the target task execution unit that the target task is successful, the target task execution unit may execute the target task. And the target executor may determine the task execution result according to the task execution situation of the target task execution unit. Optionally, the target executor may determine the task execution result according to the data interaction situation with the target task execution unit. Specific explanations can be found below.
[0136] S103: The target executor determines the task execution result of the target task and returns the task execution result to the scheduling center.
[0137] Regarding the task execution result, the method flow does not limit the form of the task execution result.
[0138] Optionally, the task execution result may indicate that the target task is successfully executed or failed. Specifically, it may be represented in numerical form. When the task execution result is 200, it may indicate that the target task is successfully executed; when the task execution result is other numbers, it may indicate that the target task is failed.
[0139] In an alternative embodiment, the task execution result may include a task execution result indicating successful task execution and a task execution result indicating failed task execution.
[0140] It should be noted that successful task execution may mean that the target task is normally completed, and other situations can be regarded as failed task execution. Specifically, it may include that the target task is not executed, the target task is aborted, the target task execution unit does not exist, etc.
[0141] Optionally, determining the task execution result of the target task may include: when it is determined that the target task is successfully executed, determining the task execution result indicating successful execution of the target task. Determining that the target task is successfully executed may be specifically determined according to the actual task execution situation of the target task.
[0142] The method flow does not limit the specific situation of determining that the target task is successfully executed. Optionally, determining that the target task is successfully executed may include: receiving the task execution result returned by the target task execution unit, indicating successful execution of the target task.
[0143] The method for determining the task execution result is not limited in this embodiment. Optionally, the executor may generate the task execution result by itself, or the executor may receive the task execution result from the outside.
[0144] Therefore, optionally, determining the task execution result of the target task may include: receiving the task execution result returned by the target task execution unit, indicating successful execution of the target task.
[0145] The determined task execution result can be the task execution result returned by the target task execution unit that has received the task.
[0146] For example, after the target task execution unit successfully executes the target task, it can return a specified identifier, specifically 200, to indicate the successful execution of the target task.
[0147] Optionally, determining the task execution result of the target task may include: in the case of determining that the execution of the target task fails, determining the task execution result indicating the failure of the execution of the target task.
[0148] Determining that the execution of the target task fails can be specifically determined according to the actual execution situation of the target task.
[0149] This method process does not limit the specific situation of determining the failure of the target task execution. It can be that the target task execution unit itself determines that the execution of the target task fails, or it can be that the executor determines that the execution of the target task fails.
[0150] Optionally, determining that the execution of the target task fails may include at least one of the following: receiving the task execution result returned by the target task execution unit indicating the failure of the execution of the target task; the connection establishment with the target task execution unit fails; no task execution result is received from the target task execution unit within a preset time period.
[0151] Among them, optionally, receiving the task execution result returned by the target task execution unit indicating the failure of the execution of the target task can be that problems occur during the execution of the target task by the target task execution unit. For example, the execution of the target task is interrupted, an error occurs in the task, an exception is thrown, a program bug appears, data is missing in the database, etc.
[0152] The target task execution unit can, based on these situations, correspondingly return a specified identifier, such as 500, to indicate the failure of the execution of the target task. Optionally, after receiving this task execution result indicating the failure of the execution of the target task, the target executor can directly return the task execution result to the scheduling center.
[0153] Optionally, the failure of the connection establishment between the target executor and the target task execution unit can be that before the target executor sends the target task, it needs to first establish a connection with the target task execution unit. For example, in the case of sending an HTTP request message, it needs to first establish a connection through three-way handshake before continuing to send the HTTP request message. And the connection establishment may fail for various reasons, such as poor network, the target task execution unit cannot respond, the device where the target task execution unit is located is down, etc.
[0154] Since the connection with the target task execution unit fails to be established and the target task execution unit cannot respond, the target executor itself can determine the task execution result indicating the failure of the target task execution.
[0155] Optionally, if the task execution result returned by the target task execution unit is not received within a preset duration, that is, the target task execution unit times out. There are various reasons for the timeout. For example, the target task execution unit fails, the udp request message fails to be sent due to poor network, or the target task execution unit makes an error and cannot respond during the execution of the target task, etc.
[0156] The method for determining the task execution result is not limited in this embodiment. Optionally, the executor can generate the task execution result by itself, or the executor can receive the task execution result from the outside.
[0157] Therefore, optionally, determining the task execution result of the target task may include at least one of the following.
[0158] 1) Receiving the task execution result returned by the target task execution unit, indicating the failure of the target task execution.
[0159] Specifically, when the target task execution unit determines that the target task execution fails, it returns the number 600 to indicate the failure of the target task execution.
[0160] 2) Generating the task execution result indicating the failure of the target task execution when it is determined that the connection with the target task execution unit fails to be established.
[0161] Specifically, the number 500 can be generated as the task execution result to indicate the failure of the target task execution.
[0162] 3) Generating the task execution result indicating the failure of the target task execution when the task execution result returned by the target task execution unit is not received within a preset duration.
[0163] Specifically, the number 400 can be generated as the task execution result to indicate the failure of the target task execution.
[0164] It should be noted that in an optional embodiment, for the task execution result indicating the failure of the target task execution, the target executor can also return the failure reason to the scheduling center.
[0165] Specifically, the situation of whether the target task execution unit can respond can be returned to the scheduling center to facilitate the scheduling center for analysis.
[0166] By decoupling the actuator from task execution, the actuator itself does not need to execute tasks, but forwards tasks to the task execution unit for execution. This enables the task execution unit to be developed without relying on the actuator, reducing development costs.
[0167] In addition, in related technologies, since the actuator itself needs to execute tasks, the number of actuators is limited by the number of related programs for task execution. For each related program for task execution, an actuator needs to be deployed for development.
[0168] In the above method flow, however, since the actuator is decoupled from task execution, the number of actuators is not limited by the number of task execution units. One actuator can forward tasks to multiple task execution units. The number of actuators can be less than the number of task execution units, thus saving computing resources and storage resources.
[0169] Moreover, in related technologies, since the actuator itself needs to execute tasks, with the addition or deletion of related programs for task execution, corresponding actuators need to be added or deleted accordingly.
[0170] For the addition of an actuator, it is necessary to register with the scheduling center additionally and authenticate and configure the newly added actuator. In some scenarios, the number of task execution programs to be deployed is large, resulting in an increase in the number of actuators, which will consume a large amount of computing resources and storage resources.
[0171] For example, in a microservices scenario, there are multiple applications for implementing functions. The number of applications is large and the functions implemented are relatively simple. Therefore, an actuator needs to be configured for each application, resulting in a large number of actuators and consuming a large amount of computing resources and storage resources.
[0172] For the deletion of an actuator, it is necessary to unregister with the scheduling center additionally and delete all tasks bound to the actuator. The specific operations are rather cumbersome. Moreover, when an actuator has problems and cannot execute tasks, it often causes exceptions in the scheduling center. For example, in the case of forced offline of an actuator, if the actuator has not completed the unregistration operation, many tasks bound to the actuator cannot be executed, causing the scheduling center to throw an exception and consuming resources waiting for the response of the offline actuator.
[0173] In the above method flow, however, since the actuator is decoupled from task execution, the actuator can be unbound from the task execution unit, and the actuator does not need to be added or deleted with the addition or deletion of the task execution unit.
[0174] In the above method process, if a new task execution unit is added, when configuring the task, it is only necessary to configure the identification information of the task execution unit, and there is no need to add an executor. The existing executor can be directly used for task forwarding.
[0175] Therefore, optionally, in the case of adding a task execution unit, the identification information of the new task execution unit can be configured to the scheduling center to facilitate task configuration.
[0176] If a task execution unit is deleted, there is also no need to delete the executor. For tasks that need to be executed by the deleted task execution unit, the executor can forward them, thereby determining that the task execution fails, obtaining a task execution result indicating task execution failure, and returning it to the scheduling center. The scheduling center can analyze the task execution result indicating task execution failure, without the need to cancel the executor, and there will be no exception or resource consumption waiting for a response due to the deletion of the task execution unit. Thus, the operation can be simplified and resources can be saved.
[0177] Therefore, optionally, in the case of deleting a task execution unit, no other operations need to be performed. Even if a certain task execution unit is forced offline, it will not affect the scheduling center.
[0178] Of course, when the scheduling center analyzes the task execution result indicating task execution failure, if it determines that the corresponding task execution unit is deleted, it can directly delete the task configured with the identification information of the task execution unit.
[0179] Optionally, when the scheduling center determines that the first task execution unit is deleted, it can delete the task locally configured with the identification information of the first task execution unit.
[0180] For the first task execution unit, this embodiment does not limit the determination method of being deleted. Optionally, it can be determined to be deleted when the first task execution unit fails to respond continuously for multiple times or fails to connect continuously for multiple times.
[0181] Optionally, determining that the first task execution unit is deleted may include: determining that the first task execution unit is deleted when it is determined that a continuous preset number of tasks cannot be sent to the first task execution unit.
[0182] Optionally, determining that the first task execution unit is deleted may include: determining that the first task execution unit is deleted when it is determined that a continuous preset number of preset tasks fail to execute; the preset tasks may be tasks configured with the identification information of the first task execution unit.
[0183] If a task execution unit is transferred, there is no need to update the executor. Since the identification information of the task execution unit has changed, tasks originally configured with the original identification information of the task execution unit can be reconfigured with the new identification information of the task execution unit.
[0184] Therefore, optionally, when the task execution unit migrates from the first address to the second address, for one or more tasks configured with the first address information in the scheduling center, the first address information can be updated to the second address information, so that after these tasks are sent to the executor, the executor can send tasks to the task execution unit according to the second address information.
[0185] In the above method flow, since the executor is decoupled from task execution, the executor can be unaffected by the addition, deletion, or migration of task execution units, and the steps for adding, deleting, or migrating related programs for task execution are also simplified, improving the flexibility of task execution units.
[0186] Therefore, in the above method flow, task execution units can be flexibly adjusted. Specifically, task execution units can be directly added, migrated, or deleted, with simple steps and no need to modify the executor or the scheduling center.
[0187] For ease of understanding, two specific examples are given below.
[0188] In a specific example, a single business party may deploy an architecture including a scheduling center and an executor for its own business implementation to execute the above method flow.
[0189] Among them, the single business party can deploy task execution units to execute tasks. Since there is no need to develop task execution units based on the executor, the development cost can be reduced.
[0190] The single business party can also configure the tasks and scheduling conditions of the scheduling center, specifically including: configuring the identification information of the task execution unit for executing the task.
[0191] Since the task execution units are deployed by the business party itself, the identification information of the task execution units can be obtained for task configuration.
[0192] Of course, the business party can also deploy an executor. Specifically, the executor can be deployed according to actual needs.
[0193] For example, the number of executors to be deployed can be determined according to the scheduling frequency of tasks. The executors can also be allocated according to the business of the business party.
[0194] In another specific example, it may be that a certain service provider deploys an architecture including a scheduling center and executors, and several business parties can use this architecture to execute the above method process.
[0195] Optionally, several business parties can act as tenants and lease the computing resources and scheduling methods in this architecture to facilitate the execution of tasks deployed by themselves.
[0196] Each business party can deploy the task execution units required by itself, and deploy tasks in the scheduling center, and configure the task execution unit identification information for executing the task for the task.
[0197] Of course, the business party can also directly use the local task execution unit, and specifically can directly configure the identification information of the local task execution unit for the task.
[0198] For the executor, optionally, different business parties can share the executor. Specifically, for different business parties, an executor can be randomly selected from several deployed executors to forward tasks.
[0199] Optionally, each business party can also apply for a dedicated executor to facilitate data isolation between business parties and improve privacy and security.
[0200] As Figure 4 shown, it is a schematic diagram of the principle of another task scheduling method provided by the embodiments of this specification.
[0201] It includes a scheduling center, an executor cluster, and task execution units.
[0202] The scheduling center can call an executor in the executor cluster through remote invocation, and send the currently required task to the executor. The executor packages the task into an http request message, and the destination address of the message can be the IP address of the task execution unit for executing the task.
[0203] The executor can obtain the http response message, thereby parse out the task execution result in the http response message, and return the task execution result to the scheduling center through remote invocation.
[0204] Two one-sided method embodiments are provided below.
[0205] Embodiment 1, the task scheduling method can be applied to an executor, and the method can include the following steps.
[0206] S201: Receive the target task sent by the scheduling center; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task.
[0207] S202: Send the target task to the target task execution unit according to the identification information.
[0208] S203: Determine the task execution result of the target task and return the task execution result to the scheduling center.
[0209] Embodiment 2. This task scheduling method can be applied to a scheduling center, and the method may include the following steps.
[0210] S301: Determine the target task that needs to be processed currently, and determine the target executor, and send the target task to the target executor; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task; the target executor is used to send the target task to the target task processing unit according to the identification information and determine the task processing result of the target task.
[0211] S302: Receive the task processing result sent by the target executor.
[0212] For the explanations of the above two method embodiments, reference can be made to the explanations of the method flows S101 - S103 above.
[0213] Corresponding to the above method embodiments, this specification embodiment also provides corresponding system embodiments and apparatus embodiments.
[0214] System embodiment.
[0215] As Figure 5 shown, it is a schematic structural diagram of a task scheduling system provided by this specification embodiment. It includes a scheduling center 501 and a target executor 502.
[0216] The scheduling center 501 is used to determine the target task that needs to be executed currently, and determine the target executor, and send the target task to the target executor; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task.
[0217] The target executor 502 is used to send the target task to the target task execution unit according to the identification information, determine the task execution result of the target task, and return the task execution result to the scheduling center 501.
[0218] Optionally, other executors may also be included in this system to facilitate the parallel forwarding of different tasks.
[0219] Optionally, the scheduling center 501 can be used to: select an executor from the executor cluster and determine it as the target executor 502; each executor in the executor cluster is used to send the received task to the task execution unit corresponding to the identification information configured for the task.
[0220] Optionally, the target task is further configured with a target service identifier. The scheduling center 501 can be used to: determine an executor in the executor cluster that is configured with the target service identifier, and select one executor from the determined executors.
[0221] Optionally, the identification information includes the communication address information of the device where the target task execution unit is located, and the access address information of the target task execution unit. The target executor 502 can be used to: construct a request message with the communication address information as the destination address, and the access address information and the target task as the payload, and send it to the network, so that the device where the target task execution unit is located, upon receiving the request message, sends the target task to the target task execution unit according to the access address information.
[0222] Optionally, the target executor 502 can be used to: receive a task execution result returned by the target task execution unit, which characterizes the successful execution of the target task.
[0223] Optionally, the target executor 502 can be used to determine the task execution result of the target task in at least one of the following ways: receive a task execution result returned by the target task execution unit, which characterizes the failure of the target task to execute; generate a task execution result characterizing the failure of the target task to execute when it is determined that the connection with the target task execution unit fails to be established; generate a task execution result characterizing the failure of the target task to execute when no task execution result is received from the target task execution unit within a preset duration.
[0224] For the explanation of the above system embodiment, reference can be made to the explanation of the above method flow.
[0225] Device embodiment.
[0226] As Figure 6 shown, it is a schematic structural diagram of a task scheduling device provided by an embodiment of this specification, and this device can be applied to an executor.
[0227] This device may include the following modules.
[0228] A receiving module 601, configured to receive a target task sent by the scheduling center; the target task is configured with identification information of a target task execution unit; the target task execution unit is used to execute the target task.
[0229] A sending module 602, configured to send the target task to the target task execution unit according to the identification information.
[0230] A feedback module 603, configured to determine the task execution result of the target task and return the task execution result to the scheduling center.
[0231] As Figure 7As shown in the figure, it is a schematic structural diagram of another task scheduling device provided by the embodiments of this specification, and this device can be applied to a scheduling center.
[0232] This device may include the following modules.
[0233] A determination module 701, configured to determine a target task that needs to be processed currently, and determine a target executor, and send the target task to the target executor; the target task is configured with identification information of a target task execution unit; the target task execution unit is used to execute the target task; the target executor is used to send the target task to the target task processing unit according to the identification information, and determine the task processing result of the target task.
[0234] A result module 702, configured to receive the task processing result sent by the target executor.
[0235] For the explanations of the above two device embodiments, reference can be made to the explanations of the above method flow.
[0236] The embodiments of this specification also provide a computer device, which at least includes a memory, a processor, and a computer program stored on the memory and executable on the processor. Wherein, when the processor executes the program, it implements the steps executed by the scheduling center or the executor in a task scheduling method.
[0237] Optionally, when a scheduling center and an executor are deployed on the computer device, the processor can implement a task scheduling method when executing the program.
[0238] Figure 8 Shows a more specific schematic hardware structure diagram of a computer device provided by the embodiments of this specification. This device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. Wherein, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other inside the device through the bus 1050.
[0239] The processor 1010 may be implemented in a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided by the embodiments of this specification.
[0240] The memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1020 and called and executed by the processor 1010.
[0241] The input / output interface 1030 is used to connect to an input / output module to implement information input and output. The input / output module may be configured as a component in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
[0242] The communication interface 1040 is used to connect to a communication module (not shown in the figure) to implement communication and interaction between this device and other devices. The communication module may implement communication in a wired manner (such as USB, network cable, etc.) or in a wireless manner (such as a mobile network, WIFI, Bluetooth, etc.).
[0243] The bus 1050 includes a path for transmitting information between various components of the device (such as the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0244] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device may also only include the components necessary for implementing the solutions of the embodiments of this specification, and do not necessarily include all the components shown in the figure.
[0245] The embodiments of this specification also provide a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the steps performed by a scheduling center or an executor in a task scheduling method.
[0246] Optionally, when the computer program includes a scheduling center and an executor, the program can implement a task scheduling method when executed by a processor.
[0247] A computer-readable medium includes permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, disk storage or other magnetic storage devices, or any other non-transitory media that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0248] An embodiment of this specification also provides an electronic device, including: a processor; a memory for storing instructions executable by the processor;
[0249] Wherein, the processor is configured to execute the instructions to implement a task scheduling method, or the steps executed by a scheduling center or an executor in a task scheduling method.
[0250] An embodiment of this specification also provides a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can implement a task scheduling method, or the steps executed by a scheduling center or an executor in a task scheduling method.
[0251] An embodiment of this specification also provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, they implement a task scheduling method, or the steps executed by a scheduling center or an executor in a task scheduling method.
[0252] From the description of the above embodiments, those skilled in the art can clearly understand that the embodiments of this specification can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solutions of the embodiments of this specification, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this specification.
[0253] The systems, devices, modules or units illustrated in the above embodiments may be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device, or a combination of any several of these devices.
[0254] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the relevant parts, reference can be made to the partial description of the method embodiments. The device embodiments described above are only illustrative. The modules described as separate components may or may not be physically separated. When implementing the solutions of the embodiments of this specification, the functions of the modules can be implemented in the same or multiple software and / or hardware. It is also possible to select some or all of the modules according to actual needs to achieve the purpose of the solutions of this embodiment. A person of ordinary skill in the art can understand and implement it without creative work.
[0255] The above is only the specific implementation manner of the embodiments of this specification. It should be noted that for those of ordinary skill in the art in the technical field of this application, without departing from the principle of the embodiments of this specification, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the embodiments of this specification.
Claims
1. A task scheduling method, characterized in that, Including: The scheduling center determines the target task to be currently executed, randomly selects an executor from the executor cluster as the target executor, and sends the target task to the target executor. The target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task. The target executor statelessly forwards the received target task to the target task execution unit according to the identification information without executing the target task, determines the task execution result of the target task, and returns the task execution result to the scheduling center. The identification information includes the communication address information of the device where the target task execution unit is located and the access address information of the target task execution unit. The target executor constructs a request message with the communication address information as the destination address and the access address information and the target task as the payload, and sends it to the network, so that the device where the target task execution unit is located sends the target task to the target task execution unit according to the access address information when receiving the request message. Among them, the scheduling center stores a number of pre-configured tasks. The executor is decoupled from the task and the task execution unit. The executor is not bound to the task and the task execution unit, so that the executor is not affected by the addition or deletion of the task execution unit. In the case of adding a task execution unit, the identification information of the newly added task execution unit is configured in the scheduling center for task configuration, so that the existing executor can be used for task forwarding without adding a new executor. In the case of deleting a task execution unit, if the scheduling center determines that the task execution unit corresponding to the task execution result of the failed task execution is deleted, the task configured with the identification information of the task execution unit is deleted.
2. The method according to claim 1, wherein Determining the target executor includes: Selecting an executor from the executor cluster and determining it as the target executor; each executor in the executor cluster is used to send the received task to the task execution unit corresponding to the identification information configured for the task.
3. The method according to claim 1, wherein Determining the task execution result of the target task includes: Receiving the task execution result returned by the target task execution unit, indicating that the target task is successfully executed.
4. The method according to claim 1, wherein Determining the task execution result of the target task includes at least one of the following: Receiving the task execution result returned by the target task execution unit, indicating that the target task execution fails; Generating a task execution result indicating that the target task execution fails when it is determined that the connection with the target task execution unit fails to be established; Generating a task execution result indicating that the target task execution fails when the task execution result returned by the target task execution unit is not received within the preset duration.
5. A task scheduling method, characterized in that, Applied to an executor, the executor is randomly selected by the scheduling center from the executor cluster. The method includes: Receiving the target task sent by the scheduling center; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task. For the received target task without state, do not execute the target task, forward the target task to the target task execution unit according to the identification information, determine the task execution result of the target task, and return the task execution result to the scheduling center; The identification information includes the communication address information of the device where the target task execution unit is located and the access address information of the target task execution unit; Taking the communication address information as the destination address and the access address information and the target task as the payload, construct a request message and send it to the network, so that when the device where the target task execution unit is located receives the request message, it sends the target task to the target task execution unit according to the access address information; Among them, the scheduling center stores a number of pre-configured tasks. The executor is decoupled from the task and the task execution unit. The executor is not bound to the task and the task execution unit, so that the executor is not affected by the addition or deletion of the task execution unit; In the case of adding a task execution unit, configure the identification information of the newly added task execution unit to the scheduling center for task configuration, so as to use the existing executor for task forwarding without adding a new executor; In the case of deleting a task execution unit, if the scheduling center determines that the task execution unit corresponding to the task execution result of task execution failure is deleted, delete the task configured with the identification information of this task execution unit.
6. A task scheduling method, characterized in that, Applied to the scheduling center, the method includes: Determine the target task that needs to be processed currently, randomly select an executor from the executor cluster as the target executor, and send the target task to the target executor; the target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task; the target executor is used to, for the received target task without state, not execute the target task, forward the target task to the target task processing unit according to the identification information, and determine the task processing result of the target task; Receive the task processing result sent by the target executor; The identification information includes the communication address information of the device where the target task execution unit is located and the access address information of the target task execution unit; The target executor is used to take the communication address information as the destination address and the access address information and the target task as the payload, construct a request message and send it to the network, so that when the device where the target task execution unit is located receives the request message, it sends the target task to the target task execution unit according to the access address information; Among them, the scheduling center stores a number of pre-configured tasks. The executor is decoupled from the task and the task execution unit. The executor is not bound to the task and the task execution unit, so that the executor is not affected by the addition or deletion of the task execution unit; In the case of adding a task execution unit, configure the identification information of the newly added task execution unit to the scheduling center for task configuration, so as to use the existing executor for task forwarding without adding a new executor; In the case of deleting a task execution unit, if the scheduling center determines that the task execution unit corresponding to the task execution result of a failed task execution has been deleted, it deletes the task configured with the identification information of this task execution unit.
7. A task scheduling system, characterized in that, Including: A scheduling center, which is used to determine the target task that needs to be executed currently, randomly select an executor from the executor cluster as the target executor, and send the target task to the target executor; The target task is configured with the identification information of the target task execution unit; the target task execution unit is used to execute the target task; The target executor is used to statelessly forward the target task to the target task execution unit according to the identification information without executing the target task for the received target task, determine the task execution result of the target task, and return the task execution result to the scheduling center; The identification information includes the communication address information of the device where the target task execution unit is located, and the access address information of the target task execution unit; The target executor is used to: construct a request message with the communication address information as the destination address, and the access address information and the target task as the payload, and send it to the network, so that when the device where the target task execution unit is located receives this request message, it sends the target task to the target task execution unit according to the access address information; Among them, the scheduling center stores a number of pre-configured tasks, the executor is decoupled from the task and the task execution unit, and the executor is not bound to the task and the task execution unit, so that the executor is not affected by the addition or deletion of the task execution unit; In the case of adding a task execution unit, configure the identification information of the newly added task execution unit to the scheduling center for task configuration, so as to use the existing executor for task forwarding without adding a new executor; In the case of deleting a task execution unit, if the scheduling center determines that the task execution unit corresponding to the task execution result of a failed task execution has been deleted, it deletes the task configured with the identification information of this task execution unit.
8. The system according to claim 7, wherein The scheduling center is used for: Select an executor in the executor cluster and determine it as the target executor; each executor in the executor cluster is used to send the received task to the task execution unit corresponding to the identification information configured for this task.
9. The system according to claim 7, wherein The target executor is used for: Receiving the task execution result returned by the target task execution unit, indicating that the target task has been successfully executed.
10. The system according to claim 7, characterized in that The target executor is used for: Determining the task execution result of the target task through at least one of the following methods: Receiving the task execution result returned by the target task execution unit, indicating that the target task execution has failed; Generating a task execution result indicating that the target task execution has failed in the case of determining that the connection with the target task execution unit fails to be established; Generating a task execution result indicating that the target task execution has failed in the case of not receiving the task execution result returned by the target task execution unit within a preset duration.
11. A task scheduling device, characterized in that, Applied to an executor, the executor is randomly selected by the scheduling center from the executor cluster, and the device includes: A receiving module, configured to receive a target task sent by a dispatching center; the target task is configured with identification information of a target task execution unit; the target task execution unit is configured to execute the target task; A sending module, which, for the received target task without state and without executing the target task, is configured to forward and send the target task to the target task execution unit according to the identification information; A feedback module, configured to determine a task execution result of the target task and return the task execution result to the dispatching center; The identification information includes communication address information of the device where the target task execution unit is located and access address information of the target task execution unit; The sending module constructs a request message with the communication address information as the destination address, and the access address information and the target task as the payloads and sends it to the network, so that when the device where the target task execution unit is located receives the request message, it sends the target task to the target task execution unit according to the access address information; Wherein, the dispatching center stores a number of pre-configured tasks, the executor is decoupled from the task and the task execution unit, and the executor is not bound to the task and the task execution unit, so that the executor is not affected by the addition or deletion of the task execution unit; In the case of adding a task execution unit, the identification information of the added task execution unit is configured in the dispatching center for task configuration, so as to use the existing executor for task forwarding without adding a new executor; In the case of deleting a task execution unit, if the dispatching center determines that the task execution unit corresponding to the task execution result of the failed task execution is deleted, the task configured with the identification information of the task execution unit is deleted.
12. A task scheduling device, characterized in that, Applied to a dispatching center, the device includes: A determining module, configured to determine a target task that needs to be processed currently, randomly select an executor from an executor cluster as a target executor, and send the target task to the target executor; the target task is configured with identification information of a target task execution unit; the target task execution unit is configured to execute the target task; the target executor, for the received target task without state and without executing the target task, is configured to send the target task to the target task processing unit according to the identification information and determine a task processing result of the target task; A result module, configured to receive the task processing result sent by the target executor; The identification information includes communication address information of the device where the target task execution unit is located and access address information of the target task execution unit; The target executor is configured to construct a request message with the communication address information as the destination address, and the access address information and the target task as the payloads and send it to the network, so that when the device where the target task execution unit is located receives the request message, it sends the target task to the target task execution unit according to the access address information; The dispatching center stores a number of pre-configured tasks, the executor is decoupled from the task and the task execution unit, and the executor is not bound to the task and the task execution unit, so that the executor is not affected by the addition or deletion of the task execution unit; In the case of adding a task execution unit, configure the identification information of the added task execution unit to the scheduling center for task configuration, so as to use the existing executor for task forwarding without adding a new executor; In the case of deleting a task execution unit, if the scheduling center determines that the task execution unit corresponding to the task execution result of a failed task execution is deleted, delete the task configured with the identification information of the task execution unit.
13. An electronic device, characterized in that, Comprising: A processor; A memory for storing executable instructions of the processor; Wherein, the processor is configured to execute the instructions to implement the method according to any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device can implement the method according to any one of claims 1 to 6.
15. A computer program product comprising a computer program / instructions, characterized in that, The computer program / instructions, when executed by the processor, implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Distributed task scheduling method, system and device and medium
CN109656706A
Task scheduling method and device and micro-service system
CN113867911A