Resource allocation method, device, equipment, system and computer readable storage medium

By obtaining the tasks to be executed, the tasks completed and the execution time of the historical execution time, determining the estimated execution time of the tasks to be executed, and allocating task processing resources based on the estimated execution time, the problem of unreasonable allocation of task processing resources is solved and the system execution rate and performance is improved.

CN120066754APending Publication Date: 2025-05-30HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311610002.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-28
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the prior art, the allocation of task processing resources is unreasonable, resulting in the task waiting timeout, which leads to the problem of task execution failure.

Method used

By obtaining the tasks to be executed, the historical completion tasks and the historical execution time, the estimated execution time of the tasks to be executed is determined, and the task to be executed and the estimated execution time is sent to the resource allocation device, and the task processing resources are allocated for the tasks to be executed based on the estimated execution time.

Benefits of technology

It effectively prevents long-term tasks from occupying task processing resources for a long time, and reduces the waiting time for short-term tasks, and improves the overall execution rate and performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066754A_ABST
    Figure CN120066754A_ABST
Patent Text Reader

Abstract

The invention provides a resource allocation method, device, equipment and system and a computer readable storage medium, and relates to the technical field of communication. The problem that in the process of executing the to-be-executed task, if the to-be-executed task with the long execution duration occupies task processing resources for a long time, waiting timeout of other to-be-executed tasks is easily caused, and then execution of the to-be-executed task fails is solved. According to the specific scheme, the electronic equipment obtains a to-be-executed task; obtaining a historical completion task and a historical execution time length; the historical execution duration is the task execution duration of the historical completion task; then, the electronic equipment determines the estimated execution duration of the to-be-executed task according to the to-be-executed task, the historical completion task and the historical execution duration; and finally, the electronic equipment sends the to-be-executed task and the estimated execution duration to the resource allocation equipment. The resource allocation device allocates task processing resources to the to-be-executed task according to the estimated execution duration; the resource quantity of the task processing resources is inversely proportional to the estimated execution duration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical fields of computers and cloud computing, and in particular, to a resource allocation method, apparatus, device, system, and computer-readable storage medium. Background Art

[0002] With the development of the Internet and cloud computing, more and more industries are continuously migrating their own systems and applications to the cloud, and the requirements for the stability of the cloud platform are getting higher and higher. As the basic service of the cloud platform, automated infrastructure services carry important services such as upper-layer automated operation and maintenance, inspection, dial testing, monitoring, log download, unified password modification, and unified certificate replacement. To ensure the stable operation of services on the cloud platform, it is crucial to allocate resources to the task execution engine (also known as Agent) in the automated infrastructure service.

[0003] Currently, existing resource allocation strategies only schedule different types of tasks based on the order of obtaining tasks or the priorities of tasks. Since different types of tasks have different execution durations, there may be a situation where tasks with longer execution durations occupy the task processing resources of the Agent for a long time, resulting in other tasks waiting for timeout and then experiencing execution failure problems. Summary of the Invention

[0004] Embodiments of this application provide a resource allocation method, apparatus, device, system, and computer-readable storage medium, which solve the problem that the unreasonable allocation of the resource amount of task processing resources leads to task waiting timeout and task execution failure.

[0005] To achieve the above object, the embodiments of this application provide the following technical solutions:

[0006] In a first aspect, a resource allocation method is provided. This method can be executed by an electronic device, and the method may include:

[0007] First, the electronic device can obtain a task to be executed; and obtain historical completed tasks and historical execution durations; where the historical execution duration is the task execution duration of the historical completed tasks. Next, the electronic device can determine the estimated execution duration of the task to be executed based on the task to be executed, the historical completed tasks, and the historical execution durations. Finally, the electronic device can send the task to be executed and the estimated execution duration to a resource allocation device for the resource allocation device to allocate task processing resources to the task to be executed according to the estimated execution duration; the resource amount of the task processing resources is inversely proportional to the estimated execution duration.

[0008] As can be seen from the above, the electronic device can determine the estimated execution duration of the to-be-executed task based on the to-be-processed task, the historical completed tasks, and the task execution durations of the historical completed tasks, and send the to-be-executed task and the estimated execution duration to the resource allocation device. In this way, the resource allocation device can allocate different amounts of resources for task processing of to-be-processed tasks with different durations according to the estimated execution duration of the to-be-executed task. In this way, by adjusting the amount of task processing resources, it effectively prevents tasks with long execution durations from occupying task processing resources for a long time, and at the same time reduces the waiting duration of tasks with short execution durations, effectively utilizes task processing resources, and greatly improves the overall execution rate and performance of the system.

[0009] Combined with the first aspect, in a possible implementation manner, when the number of historical completed tasks is multiple, the number of historical execution durations is multiple, and the multiple historical completed tasks and the multiple historical execution durations correspond one by one, the above-mentioned determination of the estimated execution duration of the to-be-executed task according to the to-be-executed task, the historical completed tasks, and the historical execution durations specifically includes: The electronic device can determine the similarity between the to-be-executed task and each historical completed task among the multiple historical completed tasks to obtain multiple similarities corresponding one by one to the multiple historical completed tasks; when the target similarity among the multiple similarities is greater than or equal to the preset threshold, determine the historical execution duration corresponding to the target similarity as the estimated execution duration; when each similarity among the multiple similarities is less than the preset threshold, determine the preset duration as the estimated execution duration. In this way, by comparing the similarity between the to-be-executed task and the historical completed tasks to determine the estimated execution duration of the to-be-executed task, the time required to complete the to-be-executed task can be estimated more accurately.

[0010] Combined with the first aspect, in a possible implementation manner, when the number of target similarities is multiple, the number of historical execution durations corresponding to the target similarities is multiple, and the multiple historical execution durations and the multiple target similarities correspond one by one, the determination of the historical execution duration corresponding to the target similarity as the estimated execution duration specifically includes: The electronic device can determine the historical execution duration corresponding to the maximum similarity among the multiple target similarities as the estimated execution duration, and / or determine the average value of the multiple historical execution durations corresponding to the multiple historical completed tasks with relatively high similarities among the multiple target similarities as the estimated execution duration. In this way, determining the historical execution duration corresponding to the maximum similarity among the multiple target similarities, and / or the average value of the multiple historical execution durations corresponding to the multiple historical completed tasks with relatively high similarities as the estimated execution duration can more accurately estimate the execution duration of the to-be-executed task.

[0011] In combination with the first aspect, in a possible implementation, the method for determining the similarity between the to-be-executed task and each of the multiple historically completed tasks specifically includes: The electronic device can obtain a first task feature and multiple second task features; the first task feature is used to characterize the task content of the to-be-executed task; the multiple second task features correspond one-to-one with the multiple historically completed tasks; the second task feature is used to characterize the task content of the historically completed task corresponding to the second task feature; the electronic device can also determine the similarity between the first task feature and each of the multiple second task features based on a similarity algorithm, so as to obtain the similarity between the to-be-executed task and each of the multiple historically completed tasks. In this way, calculating the similarity based on the relationship between the feature vectors of the to-be-executed task and the historically completed tasks can make the similarity calculation result more accurate.

[0012] In combination with the first aspect, in a possible implementation, the task content includes at least one of: task type, task execution parameters, task execution result, and task execution script.

[0013] In combination with the first aspect, in a possible implementation, the method for sending the to-be-executed task and the estimated execution duration to the resource allocation device specifically includes: The electronic device can add the estimated execution duration to the to-be-executed task and send the added to-be-executed task to the resource allocation device. In this way, after obtaining the estimated execution duration, the electronic device can add the estimated execution duration to the to-be-executed task, so that the resource allocation device can obtain both the to-be-executed task and its corresponding estimated execution duration by only sending the added to-be-executed task. A specific implementation of sending the estimated execution duration is given.

[0014] In a second aspect, a resource allocation method is provided. This method can be executed by a resource allocation device and can include:

[0015] First, the resource allocation device can obtain the to-be-executed task and the estimated execution duration of the to-be-executed task; the estimated execution duration is related to the task execution duration of the historically completed task similar to the to-be-executed task; the historical execution duration is the task execution duration of the historically completed task. Then, the resource allocation device can allocate task processing resources for the to-be-executed task according to the estimated execution duration; the amount of the task processing resources is inversely proportional to the estimated execution duration.

[0016] As can be seen from the above, the resource allocation device can allocate different amounts of task processing resources for the to-be-processed tasks with different durations according to the estimated execution duration of the to-be-executed task. In this way, while reducing the waiting duration of the tasks with short duration, it prevents the tasks with long duration from occupying the task processing resources for a long time, effectively improving the overall execution rate and performance of the system.

[0017] In combination with the second aspect, in one possible implementation, before allocating task processing resources to a to-be-executed task according to the estimated execution duration, the above method may further include: when there is a target task being executed, reducing the task processing resources of the target task to a preset resource amount; the target task is a task whose estimated execution duration is greater than or equal to a preset duration. In this way, by dynamically adjusting the resources of the tasks in execution, the task processing resources can be flexibly allocated, improving the overall execution rate and performance of the system.

[0018] In a third aspect, an apparatus is provided, and the apparatus has the function of implementing the behavior of the electronic device in the method described in the first aspect above. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, for example, a communication unit or module, a processing unit or module, and a storage unit or module.

[0019] In a fourth aspect, an electronic device is provided, and the electronic device includes: a processor; a memory; and a computer program, where the computer program is stored in the memory, and when the computer program is executed by the processor, the electronic device executes the method described in any one of the first aspect above.

[0020] In a fifth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium includes a computer program, and when the computer program runs on an electronic device, the electronic device can execute the method described in any one of the first aspect above.

[0021] In a sixth aspect, a computer program product containing instructions is provided, and when it runs on an electronic device, the electronic device can execute the method described in any one of the first aspect above.

[0022] In a seventh aspect, an embodiment of the present application provides a chip, and the chip includes a processor, and the processor is used to call a computer program in a memory to execute the method described in any one of the first aspect.

[0023] In an eighth aspect, a resource allocation system is provided, and when it runs on an electronic device, the electronic device can execute the method described in any one of the first aspect above.

[0024] It can be understood that the beneficial effects that can be achieved by the method described in the second aspect, the apparatus described in the third aspect, the electronic device described in the fourth aspect, the computer-readable storage medium described in the fifth aspect, the computer program product described in the sixth aspect, the chip described in the seventh aspect, and the resource allocation system described in the eighth aspect can refer to the beneficial effects in the first aspect and any of its possible implementation manners, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 A schematic diagram of resource allocation provided for the related art;

[0026] Figure 2 Another schematic diagram of resource allocation provided for the related art;

[0027] Figure 3 A schematic diagram of a resource allocation system provided for an embodiment of the present application;

[0028] Figure 4 A structural schematic diagram of a resource allocation system provided for an embodiment of the present application;

[0029] Figure 5 A schematic flow diagram of a resource allocation method provided for an embodiment of the present application;

[0030] Figure 6 A schematic diagram of the content of a task to be executed provided for an embodiment of the present application;

[0031] Figure 7 Another schematic flow diagram of a resource allocation method provided for an embodiment of the present application;

[0032] Figure 8 Another schematic flow diagram of a resource allocation method provided for an embodiment of the present application;

[0033] Figure 9 A schematic diagram of the composition of a resource allocation device provided for an embodiment of the present application;

[0034] Figure 10 Another schematic diagram of the composition of a resource allocation device provided for an embodiment of the present application;

[0035] Figure 11 A schematic hardware structure diagram of a resource allocation device provided for an embodiment of the present application. Detailed implementation manners

[0036] In order to make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.

[0037] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments and can be combined with each other without conflict.

[0038] In the following description, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality" is two or more.

[0039] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0040] Before further elaborating on the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are described, and the nouns and terms involved in the embodiments of the present application are applicable to the following explanations.

[0041] 1) Feature vector: Machine learning is a field that studies how computers learn from experience and improve their behavior. It relies on a large amount of data, which contains many instances or objects with certain common characteristics. In machine learning, different aspects or attributes of data are usually referred to as features. And each specific observation or instance is called a sample. To facilitate computer processing of these complex and unstructured features, features are usually represented in the form of vectors, such as feature vectors. As an example, a sample can be represented by a feature vector, and calculating the similarity of feature vectors can measure the differences between samples. There are mainly various methods for calculating the similarity of vectors (such as feature vectors), such as Euclidean distance, Manhattan distance, cosine similarity, etc.

[0042] 2) Cosine similarity: Generally, the cosine value of the angle between two vectors can indicate whether the two vectors generally point in the same direction. Therefore, the similarity between two vectors (such as the above-mentioned feature vectors) can be measured by measuring the cosine value of the angle between them. This method of calculating vector similarity can be called cosine similarity. The value of cosine similarity is independent of the length of the vector and is only related to the direction of the vector.

[0043] 3) Task scheduling: Task scheduling refers to allocating tasks in a computer system to different processors or groups of processors in order to efficiently complete (or process) these tasks in the computer system. Task scheduling can be static or dynamic. Dynamic task scheduling means dynamically allocating processors or groups of processors to tasks according to the load conditions of the processors during system operation. Static task scheduling means allocating processors or groups of processors to tasks according to a pre-set task allocation strategy during system operation. Task scheduling can improve the efficiency and performance of the system, and at the same time can also avoid conflicts and resource competition between tasks.

[0044] 4) Resource Limitation of Control Groups (CGroup): Resource limitation of CGroup is a mechanism provided by the Linux kernel to limit the resource usage of a process group. The resource limitation of CGroup can limit the usage of resources such as CPU, memory, disk, and network by the process group, thereby ensuring the stability and security of the system. Through the resource limitation of CGroup, system administrators can assign different resource limitation policies to different process groups. For example, the CPU usage rate of a certain process group can be limited to no more than 50%, or the memory usage of a certain process group can be limited to no more than 1GB. This can prevent a certain process group from occupying too many system resources and causing other process groups to malfunction.

[0045] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by those skilled in the art to which this application belongs. The terms used in the embodiments of this application are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0046] With the cloud transformation of more and more industries, the requirement for the stability of the cloud platform is also getting higher and higher. Among them, the reasonable allocation of resources for the task execution engine (which can also be called Agent) in the automated infrastructure service is an important link to maintain the stability of the cloud platform. Resource allocation is usually implemented by the task execution engine.

[0047] Two resource allocation solutions are provided in the related art.

[0048] Solution 1 provides a technical solution for resource allocation. As Figure 1As shown, in this solution, the task scheduling engine can pull a batch of tasks to be executed from the task queue, such as: Task 1, Task 2, Task 3, etc. Then, the task scheduling engine analyzes these tasks to be executed to obtain the parameters required for the execution of these tasks to be executed (for example: running programs, running scripts, etc.), materials (for example: computing resources, network resources, etc.), and after analyzing the tasks, the task scheduling engine will add a completion mark to the tasks to be executed. After reading the completion mark, the task execution engine pulls the corresponding tasks to be executed and the parameters and / or materials required for the execution of the tasks to be executed from the task scheduling engine. Since there are many processes for executing tasks in the task execution engine, such as: processes waiting to execute tasks: new task process 1 (process of new task1), new task process 2 (process of new task2), new task process 3 (process of new task3), and processes that are executing tasks: old task process (process of old tasks), etc., and each process can only execute one task at a time. Therefore, the task execution engine can add these tasks to be executed into the processes waiting to execute tasks in the order of the time when the tasks to be executed are pulled, and execute these tasks to be executed based on the parameters and / or materials required for these tasks to be executed. For example: the task execution engine can call new task process 1 to execute Task 1, call new task process 2 to execute Task 2, and call new task process 3 to execute Task 3 in the order of the time when they are pulled. Among them, the processes waiting to execute tasks can be understood as the task processing resources available to the task execution engine. All tasks to be executed share this part of the available task processing resources of the task execution engine. In this way, when the execution time of a certain task to be processed is relatively long, it will occupy the task processing resources for a long time, which is likely to cause other tasks to wait for timeout and then result in an execution failure problem.

[0049] Solution 2 provides another technical solution for resource allocation. As Figure 2As shown, in this solution, the task scheduling engine can pull a batch of tasks to be executed from the task queue and obtain the priorities of these tasks. Among them, the priorities of the tasks can be preset by developers, such as: Task 1 (Priority 1), Task 2 (Priority 1), Task 3 (Priority 2), Task 4 (Priority 2), Task 5 (Priority 3), etc. Then, the task scheduling engine can analyze these tasks to be executed to obtain the parameters and materials required for the execution of these tasks. After analyzing the tasks, the task execution engine will add a completion mark to the tasks to be executed. Since there are many process pools with different priorities in the task execution engine, different process pools can provide corresponding resources for different tasks to be executed. Therefore, after reading the completion mark, the task execution engine will pull the tasks to be executed and the parameters and / or materials required for the execution of the tasks to be executed into the process pools corresponding to their priorities, so as to isolate these tasks to be executed. For example: The task execution engine can place Task 1 and Task 2 with Priority 1 and their corresponding parameters and / or materials into the process pool with Priority 1, place Task 3 and Task 4 with Priority 2 and their corresponding parameters and / or materials into the process pool with Priority 2, place Task 5 with Priority 3 and its corresponding parameters and / or materials into the process pool with Priority 3, etc. Then, the task execution engine can execute these tasks to be executed in the order of priorities based on the parameters and / or materials required for these tasks to be executed. For example: The task execution engine can first execute the tasks to be executed in the process pool with Priority 1, then execute the tasks to be executed in the process pool with Priority 2, and finally execute the tasks to be executed in the process pool with Priority 3. Further, since each process pool contains multiple processes, the tasks to be executed with the corresponding priority share these multiple processes, that is, the tasks to be processed with the same priority share the task processing resources available for the corresponding priority. Therefore, when the execution time of a certain task to be processed is relatively long, it will occupy the task processing resources for a long time, easily causing other tasks to wait for timeout and then resulting in the problem of execution failure.

[0050] In the above two solutions, the task execution engine only schedules the tasks to be executed based on the order of obtaining the tasks to be executed or the priorities of the tasks to be executed, and does not involve the allocation and adjustment of task processing resources. That is to say, regardless of whether the task processing resources are isolated according to priorities, there will be a scenario where different tasks to be executed share the task processing resources. Thus, if there is a task to be executed with a relatively long execution duration that occupies the task processing resources for a long time, it is easy to cause other tasks to be executed to wait for timeout, and then result in the problem of the task to be executed failing to execute.

[0051] To solve the above technical problems, an embodiment of the present application provides a resource allocation method. The electronic device can estimate the task execution duration of the to-be-executed task based on the historical completed tasks and the task execution durations of the historical completed tasks, that is, the historical execution durations, so as to obtain the estimated execution duration of the to-be-executed task, and send the to-be-executed task and the estimated execution duration to the resource allocation device. In this way, the resource allocation device can allocate task processing resources with different resource amounts to the to-be-processed tasks with different durations according to the estimated execution duration of the to-be-executed task. For example, for those to-be-executed tasks with shorter durations, more task processing resources can be allocated to ensure that they can be fully processed; while for those to-be-executed tasks that take more time to complete, the task processing resources allocated to them will be appropriately reduced to avoid excessive consumption of task processing resources. In this way, the embodiment of the present application can reasonably utilize the task processing resources, effectively prevent the tasks with long durations from occupying the task processing resources for a long time, reduce the waiting duration of the tasks with short durations, and greatly improve the overall execution rate of the system.

[0052] Figure 3 FIG. 4 is a schematic diagram of a resource allocation system 30 provided by an embodiment of the present application. The resource allocation system 30 may include an electronic device 300 and one or more resource allocation devices 301 communicatively connected to the electronic device 300. The electronic device 300 may include a processor for executing instruction operations. Figure 3 The shown resource allocation system 30 is only a feasible example. In other feasible embodiments, the resource allocation system 30 may also only include Figure 3 a part of the shown components or may further include other components.

[0053] In some embodiments, the electronic device 300 may be a single electronic device or a group of electronic devices. The group of electronic devices may be centralized or distributed (for example, the electronic device 300 may be a distributed system). In some embodiments, the electronic device 300 may be local or remote relative to the resource allocation device 301.

[0054] In some embodiments, the physical devices of the electronic device 300 and the resource allocation device 301 may be servers, terminals, or other types of network operation and maintenance devices, and the embodiments of the present application do not limit this.

[0055] Optionally, the above terminal may be a device that provides voice and / or data connectivity to the user, a handheld device with wireless connection capabilities, or other processing devices connected to a wireless modem. The terminal may communicate with one or more core networks via a radio access network (RAN). The terminal may be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, or may also be a portable, pocket-sized, handheld, computer-integrated, or vehicle-mounted mobile device that exchanges voice and / or data with the wireless access network. For example, a mobile phone, a tablet computer, a laptop computer, a netbook, a personal digital assistant (PDA).

[0056] Optionally, the above server may be one server in a server cluster (composed of multiple servers that communicate with each other), or a chip in the server, or a system-on-chip in the server, and may also be implemented through a virtual machine (VM) deployed on a physical machine. The embodiments of the present application do not limit this.

[0057] In the embodiments of the present application, the electronic device 300 may estimate the task execution duration of the to-be-executed task based on the historical completed tasks and the task execution duration of the historical completed tasks, that is, the historical execution duration, so as to obtain the estimated execution duration of the to-be-executed task, and send the to-be-executed task and the estimated execution duration to the resource allocation device. The resource allocation device 301 may allocate task processing resources with different resource amounts to the to-be-processed tasks with different durations according to the estimated execution duration of the to-be-executed task, so as to achieve a reasonable allocation of task processing resources.

[0058] In a possible implementation manner, the electronic device 300 and the resource allocation device 301 may be independent and different physical devices, or the functions of the electronic device 300 and the resource allocation device 301 may be integrated on the same physical device, or the functions of a part of the electronic device 300 and the resource allocation device 301 may be integrated on a physical device. The embodiments of the present application do not limit this.

[0059] For ease of description, the embodiments of the present application are described by taking the electronic device 300 and the resource allocation device 301 as two independent physical devices as an example.

[0060] In some embodiments, as Figure 4 shown, the electronic device 300 may include: a task queue 401, a task scheduling engine 402, and an artificial intelligence engine (AI) 403. The resource allocation device 301 may include: at least one task execution engine 404.

[0061] Among them, in the electronic device 300, both the task queue 401 and the artificial intelligence engine 403 have established communication connections with the task scheduling engine 402 respectively, that is, they can communicate through a predefined protocol. In addition to establishing communication connections with the task queue 401 and the artificial intelligence engine 403, the task scheduling engine 402 in the electronic device has also established a communication connection with the task execution engine 404 in the resource allocation device 301.

[0062] Optionally, the task queue 401 can store different types of tasks to be executed issued by the upstream device.

[0063] Optionally, the task scheduling engine 402 can be used to obtain the tasks to be executed from the task queue 401 and forward the tasks to be executed to the artificial intelligence engine 403. The task scheduling engine 402 can also be used to obtain the estimated execution duration of the tasks to be executed from the artificial intelligence engine 403, add the estimated execution duration to the tasks to be executed, and send the tasks to be executed with the added estimated execution duration to the task execution engine 404. That is, the task scheduling engine 402 is mainly used to achieve unified management and scheduling of tasks among different processing engines.

[0064] Optionally, the artificial intelligence engine 403 can determine the estimated execution duration of the tasks to be executed according to the task information (tasks to be executed, historical completed tasks, and historical execution duration) obtained by the task scheduling engine 402.

[0065] Optionally, the task execution engine 404 can allocate task processing resources for the tasks to be executed according to the estimated execution duration.

[0066] In some embodiments, when the resource allocation device 301 includes multiple task execution engines 404, the multiple task execution engines 404 can be different types of task execution engines. Different types of task execution engines are used to execute different types of tasks to be executed. Optionally, different types of task execution engines can be deployed in different virtual machines respectively.

[0067] In a possible implementation, each module (such as the task queue 401, the task scheduling engine 402, and the artificial intelligence engine 403) in the above-mentioned electronic device 300 can be deployed in different devices respectively. In this case, the electronic device 300 can be a group of electronic devices, and the group of electronic devices includes the devices to which each module belongs.

[0068] For ease of description, the embodiments of the present application are described by taking the task queue 401, the task scheduling engine 402, and the artificial intelligence engine 403 integrated in one electronic device as an example.

[0069] In addition, the network architecture and service scenarios described in the embodiments of this application are for more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those of ordinary skill in the art can know that with the evolution of the network architecture and the emergence of new service scenarios, the technical solutions provided by the embodiments of this application are equally applicable to similar technical problems.

[0070] Next, with reference to the accompanying drawings, the data processing method provided by the embodiments of this application will be described.

[0071] Figure 5 It is a schematic flowchart of a resource allocation method provided by an embodiment of this application. As Figure 5 shown, the method may include:

[0072] S501. The electronic device obtains a task to be executed.

[0073] It can be understood that after obtaining the task to be executed, the electronic device can obtain the task name and task content of the task to be executed.

[0074] In the embodiments of this application, the task content of the task to be executed may include at least one of: task type, task execution parameters (which may also be referred to as task input parameters), task execution results (which may also be referred to as task output parameters), and task execution scripts.

[0075] Among them, the task type is used to represent the specific type of the task to be executed. For example: when the task to be executed is a task of monitoring the CPU running status, the task type of the task to be executed may be an inspection type; when the task to be executed is to view the CPU memory, the task type may be a monitoring type, etc.

[0076] The task execution parameters are used to represent the specific execution parameters of the task to be executed. For example: the task execution parameters may be text parameters, file parameters, date parameters, node names, etc.

[0077] The task execution result is used to represent the result after completing the task to be executed. For example: when the task to be executed is to modify the password, the task execution result may be that the password modification is successful or the password modification fails, etc.

[0078] The task execution script is used to represent the specific process of executing the task to be executed. For example: when the task to be executed is to modify the password, the task execution script may be the specific process of executing the password modification process; when the task to be executed is to view the CPU memory, the task execution script may be the specific process of collecting the CPU usage rate process, etc.

[0079] Exemplarily, as Figure 6 shown, the task to be executed may include Figure 6 the automatic operation (AUTOOPS) task shown in (a) inFigure 6 the patrol task shown in (b) in Figure 6 the monitoring task shown in (c) in

[0080] Among them, as Figure 6 shown in (a) in, the task execution parameters of the automatic operation task may include: "parameter name (paramName)": "input 1"; "type": "text"; "value": "xxxxx"; "parameter name": "file input 1"; "type": "file"; "value": " / xxx / xxx / input.zip". The task execution results may include: "parameter name": "output 1"; "type": "text"; "value": "xxxxx"; "parameter name": "file output 1"; "type": "file"; "value": " / xxx / xxx / output.zip". The task execution script may include: #! / bin / bash; export output1 = input1; cp / xxx / xxx / input.zip / xxx / xxx / output.zip.

[0081] Such as Figure 6As shown in (b) of , the task execution parameters of the patrol inspection task may include: "Parameter Name": "Date 1"; "Type": "Text"; "Value": "xxxxx". The task execution result may include: "Parameter Name": "Result"; "Type": "Text", "Value": "xxxxx". The task execution script may include: #! / usr / bin / env python; # -*- coding: utf-8 -*-; import json; import the Huawei FusionCare SSH connection management class, ras SSH connection management class (com.huawei.fusioncare.sshclient.SshConnectionManager as SshConnectionManager); define a function named execute that accepts a parameter list named params (def execute(params)); try; call the createSshConnection method of the SshConnectionManager class and assign the returned result to the variable cli (cli = SshConnectionManager.createSshConnection); a parameter list consisting of the IP address, login username, login password, and port number 22 (ip, login_user, login_pwd, 22); use the json.loads function to parse the split_json string into a JSON object and save the parsed object to the res_json variable (res_json = json.loads(split_json)); obtain the value corresponding to the key named'menUsage' from the res_json object and assign it to the variable mem_list (mem_list = res_json.get("menUsage")); initialize a floating-point variable named mem_all to 0.0 (mem_all = 0.0).

[0082] As Figure 6As shown in (c) of , the task execution parameters of the monitoring task may include: "parameter name": "node 1"; "type": "text"; "value": "xxxxx". The task execution result may include: "parameter name": "Central Processing Unit (CPU)"; "type": "text"; "value": "xxxxx". The task execution script may include: # Collect the CPU, memory usage, etc. of the node; create a new instance named InspectionCollect and store the instance in a variable named inspection_thread (inspection_thread = inspectioncollect.InspectionCollect()); start a new process named inspection_thread (inspection_thread.start()); # Start the cdk information collection and reporting process, which is only started for non-mo nodes; if both is_manageone and is_manageone_occ are false, then execute the following statement block (if not is_manageone and not is_manageone_occ): create a new CloudCDKResourceCollectPlugin instance and save it in the cdk_thread variable (cdk_thread = Cdkresourcecollect.CloudCDKResourceCollectPlugin()); start the process named cdk_thread (cdk_thread.start()).

[0083] Optionally, in combination with Figure 4 , after receiving the to-be-executed task sent by the upstream device, the electronic device 300 may first store all the to-be-executed tasks in the task queue 401 of the electronic device.

[0084] Optionally, based on the diversity of the to-be-executed tasks, different types of to-be-executed tasks are stored in the task queue 401.

[0085] Next, the electronic device 300 may, based on the task execution instruction received at the current moment, or a periodically preset task execution instruction, call the task scheduling engine 402 to obtain the to-be-executed task corresponding to the task execution instruction from the task queue 401.

[0086] Optionally, the task execution instruction may be triggered by a user's task execution operation on the electronic device 300, or triggered according to a preset task execution program, or triggered by other means, which is not limited in the embodiments of the present application.

[0087] Optionally, the to-be-executed task corresponding to the task execution instruction may be an instruction indicating the to-be-executed task that needs to be executed. Exemplarily, the task queue 401 includes to-be-executed task 1, to-be-executed task 2, to-be-executed task 3, etc. waiting for execution tasks. The task execution instruction may be an instruction to execute to-be-executed task 1. After receiving the instruction to execute to-be-executed task 1, the electronic device 300 may call the task scheduling engine 402 to obtain to-be-executed task 1 from the task queue 401.

[0088] Optionally, the manner of obtaining the to-be-executed task in the embodiments of the present application may be in any form. For example, in combination with Figure 4 , the electronic device 300 may call the task scheduling engine 402 to sequentially obtain the to-be-executed tasks according to the arrangement order of the to-be-executed tasks in the task queue. For another example, in combination with Figure 4 , the electronic device 300 may call the task scheduling engine 402 to randomly obtain the to-be-executed tasks from the task queue. For another example, in combination with Figure 4 , the electronic device 300 may call the task scheduling engine 402 to obtain the to-be-executed tasks from the task queue according to the task priorities of the to-be-executed tasks.

[0089] Optionally, the number of to-be-executed tasks obtained by the electronic device from the task queue each time may be arbitrary. For example, in combination with Figure 4 , the electronic device 300 may call the task scheduling engine 402 to obtain only one to-be-executed task from the task queue each time. For another example, in combination with Figure 4 , the electronic device 300 may call the task scheduling engine 402 to obtain multiple to-be-executed tasks from the task queue each time.

[0090] Optionally, the type of to-be-executed tasks obtained by the electronic device from the task queue each time may also be arbitrary. For example, in combination with Figure 4 , the electronic device 300 may call the task scheduling engine 402 to obtain to-be-executed tasks of the same type from the task queue each time. For another example, in combination with Figure 4 , the electronic device 300 may call the task scheduling engine 402 to obtain to-be-executed tasks of different types from the task queue each time.

[0091] S502. The electronic device obtains historical completed tasks and historical execution durations.

[0092] Wherein, the historical execution duration is the task execution duration of the historical completed task.

[0093] Exemplarily, the historical completed tasks and historical execution durations may include: historical completed task 1 and the task execution duration of historical completed task 1, which is 30S; historical completed task 2 and the task execution duration of historical completed task 2, which is 60S; historical completed task 3 and the task execution duration of historical completed task 3, which is 120S; historical completed task 4 and the task execution duration of historical completed task 4, which is 150S, etc.

[0094] It can be understood that after obtaining the historical completed tasks, the electronic device can obtain the task names and task contents of the historical completed tasks. Among them, the task names and task contents of the historical completed tasks can refer to the descriptions of the task names and task contents of the to-be-executed tasks in S501, and will not be elaborated here.

[0095] Optionally, in combination with Figure 4 , after each task is executed, the task execution engine 404 will send the task name, task content, and task execution duration of the completed task to the task scheduling engine 402. The task scheduling engine 402 can store the task name, task content, and task execution duration of the completed task as historical completed tasks and historical execution durations. In this way, the electronic device 300 can obtain the historical completed tasks and historical execution durations through the task scheduling engine 402.

[0096] Another option is that the electronic device can also obtain the historical completed tasks and historical execution durations from other storage devices that store the historical completed tasks and historical execution durations.

[0097] It should be noted that the embodiments of the present application do not limit the execution sequence of S501 and S502. The electronic device can execute S501 first and then S502; it can also execute S502 first and then S501; it can also execute S501 and S502 simultaneously.

[0098] In practical applications, in order to prevent the obtained historical completed tasks and historical execution durations from being redundant data, the electronic device usually executes S501 first and then S502.

[0099] S503. The electronic device determines the estimated execution duration of the to-be-executed task according to the to-be-executed task, historical completed tasks, and historical execution durations.

[0100] In some embodiments, after the electronic device obtains the task to be executed and the historical completed tasks, it can determine the similarity between the task to be executed and the historical completed tasks. When the similarity between the task to be executed and the historical completed tasks is relatively high (for example, the similarity is greater than a preset threshold), it indicates that the task to be executed is relatively similar to the historical completed tasks. In this case, the electronic device can use the historical execution duration corresponding to the historical completed tasks as the estimated execution duration of the task to be executed. The specific implementation will be described in detail later and will not be elaborated here. When the similarity between the task to be executed and the historical completed tasks is relatively low (for example, the similarity is less than the preset threshold), the electronic device can determine the preset duration as the estimated execution duration. The specific implementation will be described in detail later and will not be elaborated here.

[0101] In still other embodiments, after the electronic device obtains the task to be executed, the historical completed tasks, and the historical execution duration, it can train a prediction model based on the historical completed tasks and the historical execution duration. This prediction model can predict the estimated execution duration of the task to be executed. That is to say, after training this prediction model, the task to be executed can be input into this prediction model to obtain the estimated execution duration of the task to be executed.

[0102] Optionally, in combination with Figure 4 , the electronic device 300 can call the artificial intelligence engine 403 to determine the estimated execution duration of the task to be executed according to the task to be executed, the historical completed tasks, and the historical execution duration.

[0103] S504. The electronic device sends the task to be executed and the estimated execution duration to the resource allocation device.

[0104] In a feasible implementation manner, when the electronic device sends the task to be executed and the estimated execution duration to the resource allocation device, it can add the estimated execution duration to the task to be executed and send the added task to be executed to the resource allocation device. Correspondingly, the resource allocation device can obtain the task to be executed from the electronic device and the estimated execution duration of the task to be executed.

[0105] Optionally, in combination with Figure 4 , the electronic device 300 can call the task scheduling engine 402 to obtain the estimated execution duration of the task to be executed from the artificial intelligence engine 403 and send it to the resource allocation device 301, such as sending the estimated execution duration and the task to be executed to the resource allocation device 301 together.

[0106] In some embodiments, when the number of resource allocation devices is multiple, the electronic device can also send different types of tasks to be executed to different resource allocation devices according to the type of the task to be executed.

[0107] S505. The resource allocation device allocates task processing resources for the to-be-executed task according to the estimated execution duration.

[0108] In some embodiments of the present application, the resource allocation device may obtain the estimated execution duration of the to-be-executed task from the electronic device, and allocate task processing resources for the to-be-executed task according to the obtained estimated execution duration. In other embodiments, when the functions of some electronic devices are integrated on the resource allocation device, the resource allocation device may determine the estimated execution duration of the to-be-executed task based on the to-be-executed task, the historical completed tasks, and the historical execution duration, and allocate task processing resources for the to-be-executed task according to the obtained estimated execution duration. In some embodiments of the present application, there is no limitation on the manner in which the resource allocation device obtains the estimated execution duration of the to-be-executed task.

[0109] In the embodiments of the present application, when the resource allocation device performs task processing resource allocation, the amount of the task processing resource is inversely proportional to the estimated execution duration, that is, the longer the estimated execution duration of the to-be-executed task, the less the amount of the task processing resource allocated by the resource allocation device for the to-be-executed task. Correspondingly, the shorter the estimated execution duration of the to-be-executed task, the more the amount of the task processing resource allocated by the resource allocation device for the to-be-executed task. In this way, the waiting time of the to-be-executed task with an estimated execution duration less than the preset duration can be reduced. In practical applications, the resource allocation device allocating task processing resources with different amounts can also be referred to as resource limiting of the task processing resources. Among them, the resource allocation device can adopt the CGroup resource limiting method for resource limiting, and the resource allocation device can also adopt other methods for resource limiting, which are not limited in the present application.

[0110] Exemplarily, when the resource allocation device performs resource allocation, if the estimated execution duration of a task is less than the preset duration (or referred to as the preset execution duration threshold), then this task can be allocated more task processing resources, that is, the occupation ratio of the total task processing resources is higher. On the contrary, if the estimated execution duration of a task is greater than or equal to the preset duration, then this task can be allocated fewer task processing resources, that is, the occupation ratio of the total task processing resources is lower. That is to say, in order to use the task processing resources more efficiently, the total task processing resources should be more inclined to those tasks that can be completed faster. There is no specific limitation on the specific allocation ratio in the present application. For example: the ratio of the amount of the task processing resource with an estimated execution duration less than the preset duration in the amount of the total task processing resources and the ratio of the amount of the task processing resource with an estimated execution duration greater than or equal to the preset duration in the amount of the total task processing resources can allocate the amount of the total task processing resources according to ratios such as 90% and 10%, 80% and 20%, 70% and 30%, or 60% and 40%.

[0111] In the embodiments of the present application, the resource allocation device performs resource limitation according to the estimated execution duration of the task to be executed. For tasks with a short execution duration (less than or equal to the preset duration), sufficient task processing resources (e.g., CUP resources, memory resources) are provided to reduce the waiting time of the task to be executed and ensure the quick completion of the task to be executed. For tasks with a long execution duration (greater than the preset duration), the use of task processing resources is limited to prevent the long-term occupation of task processing resources. For example, 80% of the task processing resources are provided to a task with an estimated execution duration of 30S, and 20% of the task processing resources are provided to a task with an estimated execution duration of 150S, etc.

[0112] Optionally, the resource allocation device may adopt the CGroup resource limitation method to perform different resource limitations on different tasks to be processed. For example, limit the CPU usage rate of a certain task to be executed to no more than 60%, etc.

[0113] In an implementation manner of the embodiments of the present application, before the above resource allocation device allocates task processing resources to the task to be executed according to the estimated execution duration, it further includes:

[0114] In the case where there is a target task being executed, the task processing resources of the target task are adjusted down to the preset resource amount.

[0115] Wherein, the target task is a task with an estimated execution duration greater than or equal to the preset duration.

[0116] That is to say, before allocating task processing resources to the task to be executed according to the estimated execution duration, the resource allocation device can also perform dynamic resource adjustment on the tasks in execution according to the remaining situation of the current task processing resources. That is, it can be understood that the resource allocation device can adjust the remaining task processing resources before allocating task processing resources to the task to be executed according to the estimated execution duration.

[0117] In the embodiments of the present application, dynamic resource adjustment refers to that during the process of resource allocation, there are tasks being executed, and the resource allocation device adjusts the resource amount of the tasks in execution and allocates the remaining task processing resources to the newly acquired tasks to be processed.

[0118] Exemplarily, there are currently 3 tasks to be executed simultaneously, namely Task A, Task B, and Task C. Based on the matching results, the task execution engine allocates 35% of the task processing resources to Task A, 35% of the task processing resources to Task B, and 30% of the task processing resources to Task C. When Task A and Task B are completed and Task C is in progress, Tasks D and E to be processed are obtained. Through matching, Task D is a task with a shorter execution duration, and Task E is a task with a longer execution duration. The resource allocation device adjusts the task processing resources of the executing Task C to occupy 20% of the overall task processing resources, leaving 80% of the task processing resources for the new tasks (Tasks D and E). The resource allocation device allocates 80% of the remaining task processing resources to Task D and 20% to Task E.

[0119] In the resource allocation method of the embodiments of the present application, first, the electronic device can first obtain the tasks to be executed, the historical completed tasks, and the historical execution durations, and determine the estimated execution duration of the tasks to be executed based on the tasks to be executed, the historical completed tasks, and the historical execution durations. Then, the electronic device can send the estimated execution duration of the tasks to be executed to the resource allocation device. Subsequently, the resource allocation device can allocate task processing resources to the tasks to be executed according to the estimated execution duration of the tasks to be executed sent by the electronic device. Compared with the resource allocation device only scheduling different types of tasks in parallel based on the order in which the electronic device obtains tasks or the priorities of the tasks, the embodiments of the present application can perform different resource restrictions through the resource allocation device, that is, allocate task processing resources with different resource amounts to the tasks to be executed with different estimated execution durations, effectively preventing the tasks to be executed with long durations from occupying the task processing resources for a long time, and at the same time reducing the waiting duration of the tasks to be executed with short durations, and to a certain extent, the overall running duration of the tasks to be processed can be shortened. In this way, the task processing resources are effectively utilized, and the execution rate of the tasks to be executed and the performance of task processing are greatly improved.

[0120] In an alternative implementation manner of the embodiments of the present application, when the number of historical completed tasks is multiple, the number of historical execution durations is also multiple, and the multiple historical completed tasks and the multiple historical execution durations correspond one by one. That is to say, each historical completed task corresponds to a historical execution duration. In this case, in the above S503, the manner in which the electronic device determines the estimated execution duration of the task to be executed based on the task to be executed, the historical completed tasks, and the historical execution durations can be implemented through the following steps:

[0121] S11. The electronic device determines the similarity between the task to be executed and each of the multiple historical completed tasks to obtain multiple similarities corresponding one by one to the multiple historical completed tasks.

[0122] Specifically, when the number of historical completed tasks is multiple, the electronic device can determine the similarity between the to-be-executed task and each historical completed task among the multiple historical completed tasks, so as to screen out the historical completed tasks whose similarity is greater than or equal to a preset threshold from the multiple historical completed tasks.

[0123] In the embodiments of the present application, in S11 above, the method for the electronic device to determine the similarity between the to-be-executed task and each historical completed task among the multiple historical completed tasks specifically includes:

[0124] a. The electronic device obtains a first task feature and multiple second task features.

[0125] Among them, the first task feature is used to characterize the task content of the to-be-executed task; the multiple second task features correspond one-to-one with the multiple historical completed tasks; the second task feature is used to characterize the task content of the historical completed task corresponding to the second task feature.

[0126] Regarding the description of the task content, reference can be made to the description of the task content of the to-be-executed task in S501, which will not be elaborated here.

[0127] In a realizable manner, the electronic device can extract the task feature of the to-be-executed task from the task content of the to-be-executed task based on the feature extraction technology to obtain the first task feature. Correspondingly, the electronic device can also extract the task feature of the historical completed task from the task content of the historical completed task based on the feature extraction technology to obtain the second task feature.

[0128] Optionally, the first task feature and the multiple second task features can be vector features, matrix features, or other types of features, and the embodiments of the present application do not limit this.

[0129] Optionally, when multiple task features are extracted from the task content of the to-be-executed task, a feature vector set regarding the to-be-executed task can be constructed based on the extracted multiple task features. Similarly, when multiple task features are extracted from the task content of the historical completed task, a historical feature vector set regarding the historical completed task can also be constructed. In this way, subsequent similarity analysis can be facilitated.

[0130] b. The electronic device determines the similarity between the first task feature and each second task feature among the multiple second task features based on a similarity algorithm, so as to obtain the similarity between the to-be-executed task and each historical completed task among the multiple historical completed tasks.

[0131] In some embodiments, the electronic device can determine the similarity between the first task feature and each second task feature among the multiple second task features based on similarity algorithms such as the cosine similarity algorithm and the Euclidean distance algorithm.

[0132] It should be noted that among the multiple similarities calculated above, the specific value of the similarity is between 0 and 1.

[0133] Optionally, when the electronic device constructs a feature vector set of the task to be executed and a historical feature vector set of the historical completed tasks, when determining the similarity between the feature vector set and the historical feature vector set, for each feature vector in the feature vector set, the historical feature vector set can be traversed to obtain the similarity between each feature vector in the feature vector set and each feature vector in the historical feature vector set. Then, by calculating the average value or the maximum value of the similarities between each feature vector in the feature vector set and each feature vector in the historical feature vector set, the similarity between the feature vector set and the historical feature vector set is determined. It can be understood that the similarity between the feature vector set and the historical feature vector set can be regarded as the similarity between the task to be executed and the historical completed tasks.

[0134] S12. When the target similarity among the multiple similarities is greater than or equal to the preset threshold, the electronic device determines the historical execution duration corresponding to the target similarity as the estimated execution duration.

[0135] Specifically, after obtaining the similarities between the task to be executed and each of the multiple historical completed tasks, the electronic device can judge the magnitude relationship between each similarity among the multiple similarities and the preset threshold.

[0136] Among them, the preset threshold is a proximity value used to indicate whether the task to be executed is similar to the historical completed task. That is to say, according to the magnitude relationship between the similarity and the preset threshold, it can be judged whether the task to be executed is similar to the historical completed task.

[0137] In the embodiments of the present application, a task to be executed with the same task type, task input parameter name, and task script but different input parameter values can be regarded as a periodically executed task. For a periodically executed task, by judging the similarity between the task to be executed and the historical completed tasks, a historical task with a relatively high similarity can be obtained (or matched), and thus a relatively accurate estimated execution duration can be obtained. For example, the execution duration of a historical task in a periodically executed task is 60s. When estimating the estimated execution duration of a certain task to be executed in this periodically executed task, the corresponding historical task can be matched through similarity judgment, so that the estimated execution duration of this task to be executed can be determined to be 60 seconds.

[0138] In the embodiments of the present application, when the magnitude relationship between the similarity and the preset threshold is different, the method for determining the estimated execution duration of the task to be executed is also different. When the target similarity among the multiple similarities is greater than or equal to the preset threshold, the electronic device can determine the historical execution duration corresponding to the target similarity as the estimated execution duration.

[0139] Among them, the target similarity is the similarity among multiple similarities that is greater than or equal to a preset threshold. That the target similarity among multiple similarities is greater than or equal to the preset threshold can be understood as that there is a historical task with a relatively high similarity to the to-be-executed task among multiple historical completed tasks.

[0140] In this embodiment, when there is a target similarity greater than or equal to the preset threshold among the similarities between the to-be-executed task and the historical completed tasks (that is, there is a historical completed task with a relatively high similarity to the to-be-executed task), it indicates that the historical execution duration of the historical completed task corresponding to the target similarity can be used as a reference for the task execution duration of the to-be-executed task. That is, the electronic device can use the historical execution duration of the historical completed task corresponding to the target similarity as the estimated execution duration of the to-be-executed task.

[0141] Exemplarily, the number of target similarities in the embodiments of the present application can be arbitrary. For example: The number of historical completed tasks similar to the to-be-executed task may be 1, that is, the number of target similarities may be 1. In this case, the historical execution duration of the historical completed task corresponding to the target similarity can be determined as the estimated execution duration of the to-be-executed task. For example: Taking the preset threshold as 0.6 as an example, when the similarities between the to-be-executed task A and the historical completed tasks a, b, and c are 0.5, 0.8, and 0 respectively, only 1 target similarity 0.8 is greater than the preset threshold 0.6. That is, the historical execution duration of the historical completed task b corresponding to the target similarity 0.8 can be determined as the estimated execution duration of the to-be-executed task A. In some embodiments, the number of historical completed tasks similar to the to-be-executed task may be multiple, that is, the number of target similarities may be multiple. Correspondingly, the number of historical execution durations corresponding to the target similarities is multiple, and the multiple historical execution durations correspond to the multiple target similarities one by one. In this case, the electronic device can determine the historical execution duration corresponding to the maximum similarity among the multiple target similarities as the estimated execution duration of the to-be-executed task.

[0142] Exemplarily, continuing to take the preset threshold as 0.6 as an example, when the similarities between the to-be-executed task A and the historical completed tasks a, b, and c are 0.5, 0.8, and 0.9 respectively, there are 2 target similarities 0.8 and 0.9 greater than the preset threshold 0.6, and the target similarity 0.9 is the maximum similarity among the multiple target similarities. That is, the historical execution duration of the historical completed task c corresponding to the target similarity 0.9 can be determined as the estimated execution duration of the to-be-executed task A.

[0143] In some embodiments, when the number of target similarities is multiple, the electronic device can also determine the average value of the historical execution durations corresponding to the multiple target similarities as the estimated execution duration of the to-be-executed task.

[0144] Exemplarily, continuing with the preset threshold being 0.6 as an example, taking the historical execution duration of historical task a being 10S, the historical execution duration of historical task b being 16S, and the historical execution duration of historical task c being 19S as examples, when the similarities between the to-be-executed task A and historical task a, historical task b, and historical task c are 0.6, 0.8, and 0.9 respectively, there are 3 target similarities 0.6, 0.8, and 0.9 that are equal to or greater than the preset threshold 0.6. Calculate the average value of the historical execution durations corresponding to these 3 target similarities as 15S, that is, determine the average historical execution duration of 15S as the estimated execution duration of the to-be-executed task A.

[0145] In some other embodiments, when the similarities between the to-be-executed task and multiple historical completed tasks are all relatively high, the electronic device can also determine the trend of the task execution duration according to the multiple historical execution durations corresponding to the multiple historical completed tasks with relatively high similarities. Then, the electronic device can determine the estimated execution duration of the to-be-executed task according to the trend of the task execution duration. Among them, in the embodiments of the present application, the method for determining the estimated execution duration of the to-be-executed task is not specifically limited. Further, in this embodiment, the electronic device can select a suitable method for determining the estimated execution duration of the to-be-executed task according to the specific number of target similarities obtained, which is not specifically limited here.

[0146] S13. When each of the multiple similarities is less than the preset threshold, the electronic device determines the preset duration as the estimated execution duration.

[0147] Here, the similarities between the to-be-executed task and the historical completed tasks are all less than the preset threshold, which can be understood as that the to-be-executed task has a relatively low similarity with the historical completed tasks or they are not similar, that is, the historical completed tasks are not relevant to the to-be-executed task. In this way, the historical execution duration cannot be used as a reference for the estimated execution duration of the to-be-executed task. In this case, the electronic device can determine the preset duration as the estimated execution duration.

[0148] In the embodiments of the present application, the preset duration is the execution duration preset by relevant technical personnel for the to-be-executed task whose execution duration cannot be estimated, such as: 0 seconds, 0.1 seconds, 0.2 seconds, etc. That is to say, the to-be-executed task whose execution duration cannot be estimated can be regarded as a new task initially executed by the resource allocation device. In this way, after the new task is completed, the electronic device can obtain the task name, task content, and execution duration of the new task as the historical completed task and the historical execution duration.

[0149] Of course, the preset duration can also be other specific durations, which are not limited in the embodiments of the present application.

[0150] The above mainly introduced the solutions of the embodiments of the present application from the perspectives of various specific embodiments. Next, taking the different modules adopted to implement the different functions of the above specific embodiments as an example, the overall process of the resource allocation method provided by the embodiments of the present application will be described in detail. Combining Figure 4 , as Figure 7 shown, when the electronic device 300 includes a task queue 401, a task scheduling engine 402, and an artificial intelligence engine 403, and the resource allocation device 301 includes a task execution engine 404, the resource allocation method provided by the embodiments of the present application specifically includes:

[0151] The electronic device can call the task scheduling engine 401 to push the task content and historical execution duration of the historical completed tasks to the artificial intelligence engine 403. The electronic device can also call the task scheduling engine 401 to push the historical completed tasks and historical execution duration to the artificial intelligence engine 403. Among them, since the historical completed tasks include the task names and task contents of the historical completed tasks, the electronic device can send only the task contents of the historical completed tasks, or send all the historical completed tasks (the task names and task contents of the historical completed tasks). The present application does not make any limitations here.

[0152] After receiving the task content of the historical completed tasks, the artificial intelligence engine 403 can extract the task features of the historical completed tasks to obtain the second task features.

[0153] Optionally, the artificial intelligence engine 403 can also establish a historical feature vector set of the historical completed tasks based on the second task features.

[0154] The task scheduling engine 402 can also pull the tasks to be executed from the task queue 401.

[0155] In the embodiments of the present application, there is no specific limitation on the number of tasks to be executed pulled.

[0156] The task scheduling engine 402 analyzes the task content of the tasks to be executed and sends the task content of the tasks to be executed to the artificial intelligence engine 403 as well.

[0157] After receiving the task content of the tasks to be executed, the artificial intelligence engine 403 can extract the task features of the tasks to be executed to obtain the first task features.

[0158] Optionally, the artificial intelligence engine 403 can also construct a feature vector set of the tasks to be executed according to the first task features.

[0159] In the embodiments of the present application, historical completed tasks can be obtained first, and a historical feature vector set related to the historical completed tasks can be constructed. Alternatively, the to-be-executed task can be obtained first, and a feature vector set related to the to-be-executed task can be constructed. It is also possible to construct the historical feature vector set and the feature vector set simultaneously. The present application does not impose specific restrictions on the order of constructing the historical feature vector set and the feature vector set.

[0160] The artificial intelligence engine 403 can perform a similarity analysis on the first task feature and the second task feature based on a similarity algorithm to obtain the similarity between the to-be-executed task and the historical completed task.

[0161] When the similarity between the to-be-executed task and the historical completed task is relatively high, the artificial intelligence engine 403 can also determine the historical execution duration corresponding to the historical completed task as the estimated execution duration of the to-be-executed task.

[0162] When the similarity between the to-be-executed task and the historical completed task is relatively low, the artificial intelligence engine 403 can also determine a preset duration as the estimated execution duration.

[0163] The task scheduling engine 402 can receive the estimated execution duration of the to-be-executed task sent by the artificial intelligence engine 403 and send the estimated execution duration to the task execution engine 404 in the resource allocation device 301.

[0164] Optionally, the task scheduling engine 402 can add the estimated execution duration to the to-be-executed task and send the added to-be-executed task to the task execution engine 404.

[0165] The task execution engine 404 can allocate task processing resources for the to-be-executed task based on the estimated execution duration of the to-be-executed task described above.

[0166] In the embodiments of the present application, when the task execution engine 404 allocates task processing resources, the amount of the task processing resources is inversely proportional to the estimated execution duration.

[0167] The task execution engine 404 can also execute the to-be-executed task based on the allocated task processing resources.

[0168] After the task execution engine 404 completes the to-be-executed task, the task scheduling engine 402 can also save the task content and the execution duration of the task as the historical completed task and the historical execution duration.

[0169] Furthermore, the network architecture and business scenarios described in the embodiments of the present application are for more clearly explaining the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those of ordinary skill in the art know that with the evolution of the network architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0170] To more clearly describe the resource allocation method provided by the embodiments of the present application, the following takes Figure 8 as an example to make a detailed example of the resource allocation method provided by the embodiments of the present application. As Figure 8 shown, the resource allocation method specifically includes:

[0171] Taking the task scheduling engine randomly obtaining multiple different types of tasks to be executed from the task queue as an example. The task scheduling engine obtains three tasks to be executed from the task queue in response to the execution task instruction: new task 1, new task 2, and new task 3, and pushes the task content of these three tasks to the artificial intelligence engine. Then, the artificial intelligence engine can receive the task content of these three tasks, and perform feature extraction on the task content of these three tasks to be executed, obtaining the first task features of new task 1: vector 1, vector 2, vector 3, and vector 4, and the first task features of new task 2: vector 5, vector 6, vector 7, and vector 8, and the first task features of new task 3: vector 9, vector 10, vector 11, and vector 12.

[0172] At the same time, the task scheduling engine pushes the historical completed tasks to the artificial intelligence engine, and the artificial intelligence engine receives the historical completed tasks and creates a relevant historical feature vector set (i.e., the second task feature in the present application). It should be understood that the task scheduling engine can also push the execution duration of the historical completed tasks (i.e., the historical execution duration in the present application) to the artificial intelligence engine.

[0173] Among them, the historical completed tasks include: historical task 1, historical task 2, historical task 3, and historical task 4. The historical feature vector set of historical task 1 includes: vector 9, vector 10, vector 11, and vector 12. The execution duration of historical task 1 is 30 seconds. The historical feature vector set of historical task 2 includes: vector 1, vector 2, vector 3, and vector 4. The execution duration of historical task 2 is 60 seconds. The historical feature vector set of historical task 3 includes: vector 5, vector 6, vector 7, and vector 8. The execution duration of historical task 3 is 120 seconds. The historical feature vector set of historical task 4 includes: vector 13, vector 14, vector 15, and vector 16. The execution duration of historical task 4 is 150 seconds.

[0174] Then, the artificial intelligence engine 403 can calculate the similarity between the first task features of new task 1 and the second task features of each historical task among historical task 1, historical task 2, historical task 3, and historical task 4.

[0175] When the similarity between the new task 1 and the historical task 2 is greater than the preset threshold, the artificial intelligence engine can determine that the estimated execution duration of the new task 1 is the execution duration of the historical task 2: 60 seconds, and send the estimated execution duration of the new task 1: 60 seconds to the task scheduling engine.

[0176] Correspondingly, when the similarity between the new task 2 and the historical task 3 is greater than the preset threshold, the artificial intelligence engine can determine that the estimated execution duration of the new task 2 is the execution duration of the historical task 3: 120 seconds, and send the estimated execution duration of the new task 2: 120 seconds to the task scheduling engine.

[0177] Correspondingly, when the similarity between the new task 3 and the historical task 1 is greater than the preset threshold, the artificial intelligence engine can determine that the estimated execution duration of the new task 3 is the execution duration of the historical task 1: 30 seconds, and send the estimated execution duration of the new task 3: 30 seconds to the task scheduling engine.

[0178] After receiving the estimated execution durations of the new task 1, the new task 2, and the new task 3 from the artificial intelligence engine, the task scheduling engine can add the estimated execution duration of the new task 1 to the new task 1, add the estimated execution duration of the new task 2 to the new task 2, and add the estimated execution duration of the new task 3 to the new task 3.

[0179] Next, the task scheduling engine can send the task to be executed to the corresponding type of task execution engine according to the task type of the task to be executed. Optionally, the task execution engine can include task execution engine 1 and task execution engine 2. The task scheduling engine can send the new task 1 with the added estimated execution duration and the new task 2 with the added estimated execution duration to task execution engine 1, and send the new task 3 with the added estimated execution duration to task execution engine 2. Then, the self-control group in the task execution engine can allocate task execution resources with different resource amounts for the new task according to the estimated execution duration of the new task. Optionally, the self-control group in task execution engine 1 can include: new task process 1, new task process 2, new task process 3, and old task process 1. The self-control group in task execution engine 2 can include: new task process 4, new task process 5, new task process 6, and old task process 2. The self-control group in task execution engine 1 can allocate new task 1 to new task process 1 and new task 2 to new task process 2. The self-control group in task execution engine 2 can allocate new task 3 to new task process 4. In this way, while reducing the waiting duration of tasks with short time consumption, it prevents tasks with long time consumption from occupying task processing resources for a long time, and improves the overall execution rate and performance of the system.

[0180] The technical solution provided by the embodiments of the present application determines the estimated execution duration of a to-be-executed task based on the to-be-executed task, the historically completed tasks, and the historical execution durations, and allocates the amount of task processing resources in sequence according to the estimated execution durations of the respective to-be-executed tasks. In this way, by adjusting the amount of task processing resources, it effectively prevents tasks with long execution durations from occupying task processing resources for a long time, and at the same time reduces the waiting duration of tasks with short execution durations, and to a certain extent, can shorten the overall running duration of the to-be-processed tasks. In this way, the effective utilization of task processing resources is achieved, and the overall execution rate and performance of the system are greatly improved.

[0181] The above mainly introduces the solution of the embodiments of the present application from the method perspective. It can be understood that in order to implement the above functions, the resource allocation device includes the corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.

[0182] The embodiments of the present application can divide the resource allocation device into functional units according to the above method examples. For example, each functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, only a logical function division, and there may be other division methods in actual implementation.

[0183] The embodiments of the present application provide a resource allocation device (denoted as resource allocation device 90), which can be applied to the above-mentioned electronic device. As Figure 9 shown, it includes: a communication unit 901 and a processing unit 902. Optionally, it further includes a storage unit 903. The storage unit 903 is used to store the data of the resource allocation device 90.

[0184] The communication unit 901 is used to obtain the to-be-executed tasks.

[0185] The communication unit 901 is further used to obtain the historically completed tasks and the historical execution durations; the historical execution duration is the task execution duration of the historically completed tasks.

[0186] A processing unit 902, configured to determine an estimated execution duration of a to-be-executed task according to the to-be-executed task, historical completed tasks, and historical execution durations.

[0187] The communication unit 901 is further configured to send the to-be-executed task and the estimated execution duration to a resource allocation device, so that the resource allocation device allocates task processing resources for the to-be-executed task according to the estimated execution duration; the resource amount of the task processing resources is inversely proportional to the estimated execution duration.

[0188] In a realizable manner, when the number of historical completed tasks is multiple, the number of historical execution durations is multiple, and the multiple historical completed tasks and the multiple historical execution durations correspond one by one, the processing unit 902 is specifically configured to determine the similarity between the to-be-executed task and each historical completed task among the multiple historical completed tasks, so as to obtain multiple similarities corresponding one by one to the multiple historical completed tasks.

[0189] The processing unit 902 is further configured to, when a target similarity among the multiple similarities is greater than or equal to a preset threshold, determine the historical execution duration corresponding to the target similarity as the estimated execution duration.

[0190] The processing unit 902 is further configured to, when each similarity among the multiple similarities is less than the preset threshold, determine the preset duration as the estimated execution duration.

[0191] In a realizable manner, when the number of target similarities is multiple, the number of historical execution durations corresponding to the target similarities is multiple, and the multiple historical execution durations and the multiple target similarities correspond one by one, the processing unit 902 is specifically configured to determine the historical execution duration corresponding to the maximum similarity among the multiple target similarities as the estimated execution duration.

[0192] In a realizable manner, the communication unit 901 is specifically configured to obtain a first task feature and multiple second task features; the first task feature is used to characterize the task content of the to-be-executed task; the multiple second task features correspond one by one to the multiple historical completed tasks; the second task feature is used to characterize the task content of the historical completed task corresponding to the second task feature.

[0193] The processing unit 902 is specifically configured to determine the similarity between the first task feature and each second task feature among the multiple second task features based on a similarity algorithm, so as to obtain the similarity between the to-be-executed task and each historical completed task among the multiple historical completed tasks.

[0194] In a realizable manner, the task content includes at least one of: task type, task execution parameters (input parameters), task execution results (output parameters), and task execution scripts.

[0195] In one possible implementation, the communication unit 901 is specifically configured to add the estimated execution duration to the task to be executed and send the task to be executed after the addition to the resource allocation device.

[0196] An embodiment of the present application further provides a resource allocation device (denoted as resource allocation device 100), which can be applied to the above-mentioned resource allocation device. As Figure 10 shown, it includes: a communication unit 1001 and a processing unit 1002. Optionally, it further includes a storage unit 1003. The storage unit 1003 is used to store the program code and data of the resource allocation device 100.

[0197] The communication unit 1001 is configured to obtain the task to be executed from the electronic device and the estimated execution duration of the task to be executed; the estimated execution duration is related to the task execution duration of the historical completed task similar to the task to be executed; the historical execution duration is the task execution duration of the historical completed task.

[0198] The processing unit 1002 is configured to allocate task processing resources for the task to be executed according to the estimated execution duration; the amount of the task processing resources is inversely proportional to the estimated execution duration.

[0199] In one possible implementation, when the number of tasks to be executed is multiple, the first task is executed, and the second task is not executed, the communication unit 1001 is further configured to obtain other tasks except the tasks to be executed. Among them, the first task is a task with an estimated execution duration less than the preset duration among the multiple tasks to be executed; the second task is a task with an estimated execution duration greater than or equal to the preset duration among the multiple tasks to be executed.

[0200] The processing unit 1002 is further configured to lower the task processing resources of the second task to the preset resource amount.

[0201] Figure 9 and Figure 10 The units in Figure 9 and Figure 10 can also be referred to as modules. For example, the communication unit can be referred to as a communication module, and the processing unit can be referred to as a processing module. Additionally, in Figure 9 and Figure 10 In the shown embodiments, the names of the respective units may not be the names shown in the figure. For example, the communication unit may also be referred to as a transceiver unit.

[0202] Figure 9 and Figure 10When each unit in [the relevant context] is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present application. The storage media for storing the computer software product include: USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs, etc., all kinds of media that can store program codes.

[0203] The embodiments of the present application also provide a schematic diagram of the hardware structure of a resource allocation device. Refer to Figure 11 , the resource allocation device includes a processor 1101 and a transceiver 1102. Optionally, it further includes a memory 1103 connected to the processor 1101.

[0204] The processor 1101 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the programs of the solutions of the present application. The processor 1101 can also include multiple CPUs, and the processor 1101 can be a single-CPU processor or a multi-CPU processor. Here, the processor can refer to one or more devices, circuits, or processing cores for processing data (such as computer program instructions).

[0205] The processor 1101, the memory 1103, and the transceiver 1102 are connected through a bus. The transceiver 1102 is used to communicate with other resource allocation devices. Optionally, the transceiver 1102 can include a transmitter and a receiver. The device in the transceiver 1102 for implementing the receiving function can be regarded as a receiver, and the receiver is used to execute the receiving steps in the embodiments of the present application. The device in the transceiver 1102 for implementing the sending function can be regarded as a transmitter, and the transmitter is used to execute the sending steps in the embodiments of the present application.

[0206] In the first possible implementation manner, refer to Figure 11, the resource allocation device further includes a transceiver 1102. The memory 1103 can be a ROM or other type of static storage device that can store static information and instructions, a RAM, or other type of dynamic storage device that can store information and instructions. It can also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer. The embodiments of the present application do not impose any restrictions on this. The memory 1103 can exist independently or be integrated with the processor 1101. Among them, the memory 1103 may contain computer program code. The processor 1101 is configured to execute the computer program code stored in the memory 1103, thereby implementing the method provided by the embodiments of the present application.

[0207] The embodiments of the present application further provide a computer-readable storage medium, including instructions, which when running on a computer, cause the computer to execute any of the above methods.

[0208] The embodiments of the present application further provide a computer program product containing instructions, which when running on a computer, cause the computer to execute any of the above methods.

[0209] The embodiments of the present application further provide a chip, including: a processor and an interface, the processor is coupled to the memory through the interface, and when the processor executes the computer program or instructions in the memory, any of the methods provided by the above embodiments is executed.

[0210] The embodiments of the present application further provide a resource allocation system, including: the terminal device and the access network device in the above embodiments.

[0211] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, a computer, a server, or a data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, etc. that contains one or more integrated media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0212] Although the present application has been described in conjunction with various embodiments, however, in the process of implementing the claimed present application, those skilled in the art can understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality. A single processor or other unit can implement several functions recited in the claims. Certain measures are recited in mutually different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0213] Although the present application has been described in conjunction with the features and their embodiments, it is obvious that various modifications and combinations can be made without departing from the spirit and scope of the present application. Accordingly, the present specification and the drawings are merely exemplary descriptions of the present application defined by the appended claims, and are considered to have covered any and all modifications, variations, combinations, or equivalents within the scope of the present application. Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these changes and modifications.

[0214] As described above, it is only the implementation mode of this application, but the protection scope of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims described above.

Claims

1. A resource allocation method, characterized in that, applied to an electronic device, the method includes: Obtain the task to be executed; Obtain the historical completed tasks and the historical execution durations; the historical execution durations are the task execution durations of the historical completed tasks; Determine the estimated execution duration of the task to be executed according to the task to be executed, the historical completed tasks and the historical execution durations; Send the task to be executed and the estimated execution duration to a resource allocation device for the resource allocation device to allocate task processing resources for the task to be executed according to the estimated execution duration; the amount of the task processing resources is inversely proportional to the estimated execution duration.

2. The method according to claim 1, characterized in that, when the number of the historical completed tasks is multiple, the number of the historical execution durations is multiple, and the multiple historical completed tasks and the multiple historical execution durations correspond one by one; The determining the estimated execution duration of the task to be executed according to the task to be executed, the historical completed tasks and the historical execution durations includes: Determine the similarity between the task to be executed and each of the multiple historical completed tasks to obtain multiple similarities corresponding one by one to the multiple historical completed tasks; When the target similarity among the multiple similarities is greater than or equal to a preset threshold, determine the historical execution duration corresponding to the target similarity as the estimated execution duration; When each of the multiple similarities is less than the preset threshold, determine a preset duration as the estimated execution duration.

3. The method according to claim 2, characterized in that, when the number of the target similarities is multiple, the number of the historical execution durations corresponding to the target similarities is multiple, and the multiple historical execution durations and the multiple target similarities correspond one by one; The determining the historical execution duration corresponding to the target similarity as the estimated execution duration includes: Determine the historical execution duration corresponding to the maximum similarity among the multiple target similarities as the estimated execution duration, and / or determine the average value of the multiple historical execution durations corresponding to the multiple historical completed tasks with relatively high similarities among the multiple target similarities as the estimated execution duration.

4. The method according to claim 2 or 3, characterized in that, The determining the similarity between the task to be executed and each of the multiple historical completed tasks includes: Obtain a first task feature and multiple second task features; the first task feature is used to characterize the task content of the task to be executed; the multiple second task features correspond one by one to the multiple historical completed tasks; the second task feature is used to characterize the task content of the historical completed task corresponding to the second task feature; Based on a similarity algorithm, determine the similarity between the first task feature and each of the multiple second task features to obtain the similarity between the task to be executed and each of the multiple historical completed tasks.

5. The method according to any one of claims 1-4, characterized in that, Sending the to-be-executed task and the estimated execution duration to the resource allocation device includes: Adding the estimated execution duration to the to-be-executed task and sending the added to-be-executed task to the resource allocation device.

6. A resource allocation method characterized in that it is applied to a resource allocation device, and the method includes: Obtaining a to-be-executed task and an estimated execution duration of the to-be-executed task; the estimated execution duration is related to the task execution duration of a historical completed task similar to the to-be-executed task; the historical execution duration is the task execution duration of the historical completed task; Allocating task processing resources for the to-be-executed task according to the estimated execution duration; the amount of the task processing resources is inversely proportional to the estimated execution duration.

7. The method according to claim 6, characterized in that before allocating task processing resources for the to-be-executed task according to the estimated execution duration, the method further includes: When there is a target task being executed, reducing the task processing resources of the target task to a preset resource amount; the target task is a task with an estimated execution duration greater than or equal to the preset duration.

8. A resource allocation device characterized in that it includes: A functional unit for executing the method according to any one of claims 1-5, or a functional unit for executing the method according to claim 6 or 7; wherein, the actions performed by the functional unit are implemented by hardware or by hardware executing corresponding software.

9. An electronic device characterized in that it includes: A processor; The processor is connected to a memory, the memory is used to store computer execution instructions, and the processor executes the computer execution instructions stored in the memory to enable the resource allocation device to implement the method according to any one of claims 1-5.

10. A resource allocation device characterized in that it includes: A processor; The processor is connected to a memory, the memory is used to store computer execution instructions, and the processor executes the computer execution instructions stored in the memory to enable the resource allocation device to implement the method according to claim 6 or 7.

11. A resource allocation system characterized in that it includes: The electronic device according to claim 9 and the resource allocation device according to claim 10.

12. A computer-readable storage medium characterized in that it includes instructions that, when running on a computer, cause the computer to execute the method according to any one of claims 1-5, or cause the computer to execute the method according to claim 6 or 7.