Task allocation method and system, electronic equipment, storage medium and product
By using dynamic weighting algorithms to calculate task scores and allocate in real time in a distributed system, the problem of unintelligent resource allocation caused by static allocation strategies is solved, resource utilization and task execution efficiency are improved, and intelligent matching between tasks and devices is achieved.
Patent Information
- Application Number
- CN202411767248.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing task scheduling methods are unable to adapt in time when the device resource state changes in multiple device environments such as smart homes and industrial Internet of Things, resulting in unreasonable task allocation, affecting overall efficiency, and not intelligent resource allocation.
In a distributed system, a dynamic weighting algorithm calculates the weighted score of distributed tasks, and assigns tasks in real time to the device with the highest weighting score based on task requirements and device resource status, monitors the execution status and load, recalculates the score and migrates the task to Ensure optimal resource utilization.
It realizes intelligent matching of task requirements and device resources, improves resource utilization and task execution efficiency, reduces delay and failure rates, and solves the problem of unintelligent resource allocation.
Smart Images

Figure CN119225945A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of distributed resource allocation, and in particular to a task allocation method, system, electronic device, storage medium and computer program product. Background Art
[0002] In multi-device environments such as smart homes, industrial Internet of Things, and smart cities, distributed tasks require the collaboration of multiple devices to complete. Existing task scheduling methods are usually static allocation. However, in actual applications, the resource status of devices will continue to change with time, task execution and other factors, and static allocation cannot adapt to these changes in time. Some devices may affect the overall efficiency due to overload, resulting in unreasonable task allocation, thereby affecting the resource allocation of task scheduling. Therefore, there is a problem of unintelligent resource allocation in the current task scheduling method. Summary of the invention
[0003] The main purpose of the present application is to provide a task allocation method, system, electronic device, storage medium and computer program product, aiming to solve the technical problem of unintelligent resource allocation during task scheduling.
[0004] To achieve the above object, the present application proposes a task allocation method, which is applied to a distributed system, wherein the distributed system includes distributed devices, and the task allocation method includes: For any distributed task among the distributed tasks on the distributed system, determine the task requirement of the distributed task and obtain the resource status of each distributed device; Calculating a weighted score for each distributed device to execute the distributed task based on the task requirements, the status of each resource and a dynamic weighting algorithm; The distributed task is assigned to the best device with the highest weighted score for execution.
[0005] In one embodiment, the step of calculating the weighted score of each distributed device executing the distributed task based on the task requirement, each resource status and a dynamic weighting algorithm includes: For any one of the distributed devices, preprocessing the task requirement and the resource status corresponding to the distributed device; According to the task type of the distributed task, adjust the weight of the weighted scoring calculation formula; A weighted calculation is performed based on the preprocessed task requirements, the status of each resource and the adjusted weights to obtain a weighted score for the distributed device executing the distributed task.
[0006] In one embodiment, the task requirements include computing intensity, data transmission volume, and delay tolerance, and the step of adjusting the weight of the weighted score calculation formula according to the task type of the distributed task includes: Analyzing the task type of the distributed task; When the task type is a computationally intensive task, increasing the weight corresponding to the computational intensity; When the task type is a data-intensive task, increasing the weight corresponding to the data transmission amount; When the task type is a low-delay task, the weight corresponding to the task delay tolerance is increased.
[0007] In one embodiment, after the step of allocating the distributed task to the best device with the highest weighted score for execution, the method further includes: monitoring the execution status of the distributed tasks and the resource load of the optimal device; When the execution status is failed or the resource load is higher than a preset load threshold, recalculating the weighted score of each distributed device executing the distributed task to determine a new optimal device; The distributed task is migrated to the new optimal device for execution.
[0008] In one embodiment, the step of migrating the distributed task to the new optimal device for execution includes: Saving the status information of the distributed tasks and collating the intermediate data generated during the execution of the distributed tasks; Establishing a communication connection with the new optimal device, and transmitting the distributed task together with the state information and the intermediate data to the new optimal device; The execution state of the distributed task is restored on the new optimal device by using the state information and the intermediate data, and the distributed task is continued to be executed.
[0009] In one embodiment, after the step of monitoring the execution status of the distributed task and the resource load of the optimal device, the step further includes: Recording the execution status of the distributed task and the load change of the optimal device when the execution status is failure, and storing them in an abnormal fault table; If the execution condition is satisfied when executing on the optimal device and the optimal device satisfies the load change condition, determining that the optimal device has a risk of resource overload; Find an idle device that meets the execution requirements of the distributed device, and migrate the idle device to execute on the idle device.
[0010] In addition, to achieve the above purpose, the present application also proposes a task allocation system, wherein the task allocation system includes distributed devices, and the task allocation system includes: A data acquisition module, used for determining the task requirements of any one of the distributed tasks on the distributed system, and acquiring the resource status of each distributed device; A weighted scoring module, used to calculate the weighted score of each distributed device executing the distributed task based on the task requirements, the status of each resource and a dynamic weighting algorithm; The device allocation module is used to allocate the distributed task to the best device with the highest weighted score for execution.
[0011] In addition, to achieve the above objectives, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the task allocation method described above.
[0012] In addition, to achieve the above objectives, the present application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the task allocation method described above are implemented.
[0013] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the task allocation method described above are implemented.
[0014] The present application provides a task allocation method, which is applied to a distributed system, wherein the distributed system includes distributed devices. The task allocation method includes: for any distributed task among the distributed tasks on the distributed system, determining the task requirements of the distributed task and obtaining the resource status of each distributed device; calculating the weighted score of each distributed device executing the distributed task based on the task requirements, the resource status and a dynamic weighting algorithm; and allocating the distributed task to the best device with the highest weighted score for execution.
[0015] This application can accurately understand the specific resource requirements of the task by carefully analyzing the task requirements of the distributed task, and obtain the resource status of each distributed device in real time, providing accurate data support for resource allocation. It comprehensively considers the task requirements and the device resource status through a dynamic weighted algorithm, and calculates a weighted score for each device, reflecting its suitability for performing specific tasks. Based on the weighted score, the most suitable device is selected to perform the task, so that the task requirements are matched with the device, so that the device resources are reasonably applied, which not only improves the resource utilization rate, but also reduces the task execution delay and failure rate. Compared with the related schemes that allocate tasks based on static rules or simple priorities, which lack flexibility, this application dynamically analyzes the task requirements and monitors the device resource status in real time, uses a dynamic weighted algorithm for intelligent evaluation, and makes the best resource allocation decision based on the calculated weighted score, achieving high efficiency and flexibility in resource allocation, and effectively solving the problem of unintelligent resource allocation in the current task scheduling method. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A flowchart of the first embodiment of the task allocation method of this application is provided; Figure 2 A flowchart of the second embodiment of the task allocation method of this application is provided; Figure 3 A flowchart of the third embodiment of the task allocation method of this application is provided; Figure 4 This is a schematic diagram of the module structure of the task allocation system according to an embodiment of the present application; Figure 5 A schematic diagram of the device structure of the hardware operating environment involved in the task allocation method in the embodiment of the present application.
[0019] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0020] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0021] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0022] The embodiment of the present application is applied to a distributed system, which includes various distributed devices. The main solution is: for any distributed task among the distributed tasks on the distributed system, determine the task requirements of the distributed task and obtain the resource status of each distributed device; calculate the weighted score of each distributed device executing the distributed task based on the task requirements, the resource status and the dynamic weighting algorithm; assign the distributed task to the best device with the highest weighted score for execution.
[0023] In this embodiment, for the convenience of description, the following description is made with the task allocation system as the execution subject.
[0024] Since the existing technology uses a static allocation strategy for task scheduling, the task allocation is unreasonable. Some devices may experience performance degradation due to resource overload, affecting the overall task execution efficiency. It is also impossible to make optimal adjustments based on real-time conditions, limiting the efficient use of system resources and the overall performance.
[0025] The present application provides a solution to analyze the task requirements of distributed tasks and obtain the resource status of each distributed device, use a dynamic weighted algorithm to calculate the weighted score of each device executing the task, select the device with the highest weighted score, and assign the task to the device for execution, thereby realizing intelligent and dynamic resource allocation based on real-time task requirements and device resource status.
[0026] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a task allocation system, etc. The following takes the task allocation system as an example to illustrate this embodiment and the following embodiments.
[0027] Based on this, the present application embodiment provides a task allocation method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the task allocation method of the present application.
[0028] In this embodiment, the method is applied to a distributed system, which includes distributed devices. The task allocation method includes steps S01 to S03: Step S01, for any distributed task among the distributed tasks on the distributed system, determine the task requirements of the distributed task and obtain the resource status of each distributed device; It should be noted that a distributed environment refers to a whole formed by multiple physical or virtual devices connected through a network. These devices can work together to complete complex tasks. Distributed devices refer to each independent device in a distributed environment, such as servers, edge computing nodes, smart terminals, etc. They each have certain computing, storage and network resources. Distributed tasks refer to complex tasks that need to be completed by multiple devices in a distributed environment, such as deep learning model training, real-time video analysis, etc. Task requirements refer to the computing requirements of each distributed task, including computing intensity, data transmission volume, task delay tolerance, etc. These requirements determine the degree of demand for device resources during the execution of the task. Computational intensity indicates the degree of consumption of computing resources by the task, which is an important indicator for evaluating the computing requirements of the task. Data transmission volume indicates the degree of consumption of computing resources by the task during execution. The size of data that needs to be transmitted during the process is a key indicator for evaluating the network resource requirements of the task. The task delay tolerance indicates the sensitivity of the task to delay and is an important indicator for evaluating the real-time requirements of the task. The resource status refers to the current resource status of each distributed device, including CPU load, memory availability, network bandwidth, power consumption and temperature, etc., which reflects the current load capacity and resource availability of the device. The CPU load indicates the current computing resource usage of the device and is an important indicator for evaluating the computing power of the device. Memory availability indicates the remaining memory of the device and is an important indicator for evaluating the device's ability to handle large-scale data processing tasks. The network bandwidth indicates the network data transmission capacity of the device and is an important indicator for evaluating the device's ability to handle data transmission tasks. Power consumption and temperature indicate the energy consumption and temperature status of the device and are important indicators for evaluating the stability and performance of the device.
[0029] In addition, it should be noted that the system analyzes the algorithm complexity, data processing volume and required computing resource types (such as CPU, GPU) of distributed tasks, comprehensively evaluates these factors, and quantifies the degree of computing resource demand of the task, that is, computing intensity. For example, the inference task of the deep learning model requires a large number of matrix operations, so it has a high computing intensity; evaluate the amount of data transmission required during the execution of the task, including the size of the task input data, the size of the intermediate calculation results, and the size of the task output data; according to the real-time requirements of the task, based on the nature of the task (such as real-time video processing, batch tasks, etc.) and the user's expectations for the task response time, determine the task's sensitivity to delay, that is, the task delay tolerance. At the same time, the system monitors the CPU usage of each device in real time through OpenHarmony's resource-aware API. A higher CPU load means that the device's computing resources are insufficient. The system should avoid allocating large-scale data processing tasks in the low memory state to prevent memory overflow or performance degradation; monitor the current bandwidth availability of the device to evaluate the device's ability to handle data transmission tasks. The data transmission requirements of the task are closely related to the bandwidth resources of the device. Therefore, bandwidth is an important consideration when allocating data transmission intensive tasks; monitor the power consumption and temperature status of the device to prevent the device from consuming too much power or overheating under high load. OpenHarmony's resource-aware API refers to the intelligent perception scheduling component, which is located in the global resource scheduling and control subsystem. It updates the process scheduling grouping through the frame-aware scheduling mechanism, and adjusts the kernel scheduling parameters by obtaining information such as the application's life cycle status and application drawing frames, thereby controlling the kernel scheduling behavior and ensuring the system process scheduling supply.
[0030] It is understandable that, since existing solutions often perform task allocation based on static rules, resource information is periodically polled or manually configured, resulting in delayed or inaccurate information. Therefore, step S01 is performed to dynamically analyze task requirements and accurately understand task requirements, thereby providing a basis for subsequent resource allocation. Through real-time monitoring, the device resource status is obtained in real time, thereby achieving dynamic update of resource information and providing data support for dynamic resource allocation.
[0031] Step S02, calculating the weighted score of each distributed device executing the distributed task based on the task requirements, the status of each resource and the dynamic weighting algorithm; It should be noted that based on task requirements and device resource status, the system calculates the weighted score of each device executing distributed tasks through a dynamic weighted algorithm. The weighted score takes into account the computing intensity of the task, data transmission volume, delay tolerance, and factors such as the device's CPU load, memory availability, and network bandwidth. The dynamic weighted algorithm is an algorithm that dynamically adjusts weights based on task requirements and device resource status to calculate the weighted score of each device executing a task. The algorithm assigns a score to each device by comprehensively considering task requirements and device resource status. The higher the score, the more suitable the device is for executing the task. The weighted score is the result calculated by the dynamic weighted algorithm, which reflects the pros and cons of each device in executing a specific task. The higher the weighted score, the better the resource matching and performance of the device when executing the task.
[0032] It is understandable that, since existing solutions may adopt fixed weight allocation or simple threshold judgment and lack flexibility, step S02 is performed to dynamically adjust the weights according to real-time conditions through dynamic weighting to achieve optimal resource allocation, ensure that tasks can be executed efficiently and avoid equipment overload, realize intelligent and adaptable resource allocation, and improve resource utilization and task execution efficiency.
[0033] Step S03: Allocate the distributed task to the best device with the highest weighted score for execution.
[0034] It should be noted that the best device refers to the device with the highest weighted score calculated by the dynamic weighted algorithm among all distributed devices. This device is considered to be the most suitable device for performing the current task. The system selects the best device by sorting and assigns the task to this device for execution.
[0035] It is understandable that since the existing solutions rely on experience judgment or simple load balancing strategies, it is difficult to achieve the optimal solution, so step S03 is performed to ensure that the task can be executed on the optimal device through intelligent decision-making, reduce task execution delays and failure rates, improve task execution efficiency, and achieve high efficiency and accuracy in resource allocation.
[0036] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 2 In step S02, the step of calculating the weighted score of each distributed device executing the distributed task based on the task requirements, the resource status and the dynamic weighting algorithm includes steps S11 to S13: Step S11, for any one of the distributed devices, pre-processing the task requirements and the corresponding resource status of the distributed device; It should be noted that the task requirements and the corresponding resource status of distributed devices are standardized and converted into numerical values or ratios that can be used for comparison.
[0037] Step S12, adjusting the weight of the weighted scoring calculation formula according to the task type of the distributed task; It should be noted that the main requirements of the analysis task, such as computational complexity, data transmission volume or delay tolerance, are used to determine the task type. The task type refers to the nature or category of the distributed task, such as computationally intensive, data intensive or low-latency tasks. According to the task type, the weight of the corresponding resource requirement is increased, and the weight of other resources is reduced.
[0038] Step S13, performing weighted calculation based on the pre-processed task requirements, the status of each resource and the adjusted weights to obtain a weighted score for the distributed device to execute the distributed task.
[0039] It should be noted that the preprocessed task requirements and device resource status values, as well as the adjusted weights, are substituted into the weighted score calculation formula to calculate the weighted score of each device. The higher the score, the more suitable the device is for assigning the task. The weighted score calculation formula is:
[0040] in, Yes Equipment The weighted score of Indicates the device The CPU load, Indicates the device Memory availability, Indicates the device The network bandwidth Indicates the device The temperature, Indicates the device The power consumption, is the computational intensity of the distributed task, is the data transfer volume of distributed tasks, is the delay tolerance of the distributed task, is the weight of CPU and GPU resources, is the weight of the memory, is the weight of the network bandwidth, is the weight of task delay tolerance.
[0041] In this implementation, through preprocessing, all information is converted into a standardized form to facilitate subsequent calculations. By dynamically adjusting weights, intelligent identification and resource allocation of different task types are achieved, which improves the flexibility and adaptability of the scheduling algorithm. By calculating weighted scores, a comprehensive assessment of equipment capabilities and task requirements is achieved, which improves the accuracy and intelligence of resource allocation.
[0042] In a feasible implementation, the task requirements include computing intensity, data transmission volume, and delay tolerance. In step S12, according to the task type of the distributed task, the step of adjusting the weight of the weighted scoring calculation formula includes steps A01 to A04: Step A01, analyzing the task type of the distributed task; It should be noted that a detailed analysis is performed on the received distributed tasks to determine their task types. The analysis process includes multiple aspects such as the input data size of the task, the required computing amount, the execution time requirement, and the data transmission requirement.
[0043] Step A02, when the task type is a computationally intensive task, increase the weight corresponding to the computational intensity; It should be noted that computationally intensive tasks refer to tasks that require a large amount of computing resources to execute. Such tasks involve complex mathematical operations and data processing, such as the training and reasoning of deep learning models. Since computationally intensive tasks have high demands on computing resources such as CPU and GPU, the system needs to give priority to allocating these resources to such tasks. When the system determines that a task is computationally intensive, such as the training or reasoning of a deep learning model, it increases the weight corresponding to the computational intensity accordingly, that is, increases the weight of CPU and GPU resources, indicating that in the scheduling algorithm, devices with sufficient computing resources will be given priority to execute such tasks to ensure that the tasks can be completed efficiently.
[0044] Step A03, when the task type is a data-intensive task, increase the weight corresponding to the data transmission amount; It should be noted that data-intensive tasks refer to tasks that require processing of large amounts of data and involve frequent data transmission. Such tasks involve large-scale data sets and complex data processing processes, such as video processing, image analysis, and big data analysis. Since data-intensive tasks have high demands on network bandwidth and memory resources, the system needs to prioritize these resources for such tasks. When the system determines that a task is a data-intensive task, such as video processing or large-scale data analysis tasks, it increases the weight corresponding to the amount of data transmitted, that is, increases the weight of network bandwidth and memory, indicating that in the scheduling algorithm, devices with sufficient network bandwidth and memory resources will be given priority to perform such tasks to ensure that the task can proceed smoothly and process large amounts of data transmission.
[0045] Step A04, when the task type is a low-latency task, increase the weight corresponding to the task delay tolerance.
[0046] It should be noted that low-latency tasks refer to tasks that have strict requirements on delay response. Such tasks need to be processed and output results in a short time, such as real-time video analysis, online games, and real-time trading systems. Since low-latency tasks have high requirements on delay response, the system needs to give priority to assigning devices with low-latency characteristics to such tasks to ensure that the tasks can respond in time and meet user needs. When the system determines that a task is a low-latency task, such as a real-time video analysis task, it will increase the weight corresponding to the task delay tolerance accordingly, that is, increase the weight of delay tolerance, indicating that in the scheduling algorithm, devices with low-latency characteristics will be given priority to perform such tasks to ensure that the tasks can respond quickly and meet real-time requirements.
[0047] In this implementation, through detailed task analysis, the system can accurately determine the type of task and provide a reliable basis for subsequent resource allocation. By increasing the weight corresponding to the computing intensity, the system gives priority to devices with sufficient computing resources to perform tasks, thereby improving computing efficiency. By increasing the weight corresponding to the data transmission volume, the system gives priority to devices with sufficient bandwidth and memory resources to perform tasks, thereby improving data transmission efficiency and task processing speed. By increasing the weight corresponding to the task delay tolerance, the system gives priority to low-latency devices to perform tasks, thereby ensuring that the task can complete the response within the specified time.
[0048] Based on the first and second embodiments of the present application, in the third embodiment of the present application, the same or similar contents as those of the first and second embodiments can be referred to the above description, and will not be described in detail later. Figure 3 In step S03, after the step of allocating the distributed task to the best device with the highest weighted score for execution, steps S21 to S23 are also included: Step S21, monitoring the execution status of the distributed tasks and the resource load of the optimal device; It should be noted that the execution status refers to the execution status of the task on the current device, including success, failure, pause, etc. Resource load refers to the usage of various resources (such as CPU, memory, network, etc.) of the device when executing the task.
[0049] In addition, it should be noted that the execution status of the task is obtained through the built-in task management module, and the abnormal situations in the task execution process are captured and analyzed using logging and analysis tools to build a task demand vector. Through OpenHarmony's resource awareness API, the resource status of the device is obtained in real time, and the device resource vector is built for subsequent resource evaluation and task scheduling decisions.
[0050] Step S22, when the execution status is failed or the resource load is higher than the preset load threshold, recalculate the weighted score of each distributed device executing the distributed task and determine a new optimal device; It should be noted that the preset load threshold refers to the resource usage upper limit set by the system for the device. When the resource load of the device exceeds this threshold, the system will consider the device to be overloaded and needs to take measures to intervene. When the system detects that the execution status of the task is failed, or the resource load of the current best device exceeds the preset load threshold, it will trigger the process of recalculating the weighted score. According to the latest task demand vector and device resource vector, the scheduling algorithm is used to recalculate the weighted score for each device, and select the new best device to perform the task based on the scoring results.
[0051] Step S23, migrating the distributed task to a new optimal device for execution.
[0052] It should be noted that the execution of the current task is suspended, and the relevant data of the task is backed up. The task data is transferred from the current device to the new best device using a distributed file system or data transmission protocol. On the new best device, the execution of the task is resumed, and the execution status of the task and the resource load of the device continue to be monitored.
[0053] In this implementation, dynamic perception of task execution status and accurate assessment of resource load are achieved through real-time monitoring. Flexible migration of tasks and dynamic adjustment of resources are achieved through recalculation of weighted scores and selection of new optimal equipment. Flexible migration of tasks improves the system's adaptability and resource utilization.
[0054] In a feasible implementation manner, in step S23, the step of migrating the distributed task to the new optimal device includes steps B01 to B03: Step B01, save the status information of the distributed task and organize the intermediate data generated during the execution of the distributed task; It should be noted that when the system recognizes that the device resource status has changed drastically or a failure has caused the task to be unable to continue, the task migration mechanism is immediately triggered. After the trigger, the status information of the current distributed task is saved. The status information refers to various parameters and states during the task execution process, including but not limited to the progress of the task, the currently executed instructions, the required resources, etc. At the same time, the intermediate data generated during the execution of the task is sorted out. The intermediate data refers to the temporary data generated during the task execution process, which is necessary for the task to execute to the current state, such as calculation results, temporary files, etc.
[0055] Step B02, establishing a communication connection with a new optimal device, and transmitting the distributed task together with the state information and intermediate data to the new optimal device; It should be noted that a communication connection with the new optimal device is established through OpenHarmony's distributed soft bus. OpenHarmony's distributed soft bus provides an efficient, low-latency, and highly reliable data transmission channel. The system transmits the saved distributed tasks, status information, and intermediate data to the new optimal device.
[0056] Step B03: Restore the execution status of the distributed task on the new optimal device through the status information and the intermediate data, and continue to execute the distributed task.
[0057] It should be noted that after the state information and intermediate data are successfully migrated to the new best device, the system will restore the execution status of the task on the new best device, including parsing the migrated state information and intermediate data, rebuilding the task execution environment, and continuing to execute the task from the correct location.
[0058] The system ensures that the task continues from the correct position on the new device without having to start over, thus ensuring the continuity and efficiency of task execution.
[0059] In this implementation, by accurately saving status information, the system can quickly restore the task execution status after migration, thereby improving the continuity and stability of task execution. Through the distributed soft bus, the speed and efficiency of task migration are significantly improved, and the task interruption time caused by migration is reduced. By accurately saving and parsing task status information, seamless recovery of tasks on new devices is achieved, significantly improving the reliability of task migration and user experience.
[0060] In a feasible implementation manner, in step S21, after the step of monitoring the execution status of the distributed tasks and the resource load of the optimal device, steps B11 to B13 are also included: Step B11, recording the execution status of the distributed task and the load change of the optimal device when the execution status is failure, and storing them in the abnormal fault table; It should be noted that the execution status refers to the specific state and results of the task during the execution process, such as success, failure, abnormal interruption, etc. The load change status refers to the dynamic changes in the resource usage of the device when executing the task, such as the increase or decrease of indicators such as CPU usage and memory occupancy.
[0061] When the execution status of a distributed task is recorded as failed, the exception handling mechanism is triggered to record the specific situation of the distributed task when it fails to execute, including but not limited to the task name, execution stage, failure reason, error code, etc. At the same time, the load changes of the optimal device are monitored and recorded, such as abnormal fluctuations in key resource indicators such as CPU usage, memory occupancy, and disk I / O. This information and data are then integrated and stored in the exception fault table for subsequent analysis and optimization.
[0062] Step B12, if the execution condition is satisfied when executed on the best device and the best device satisfies the load change condition, it is determined that the best device has a risk of resource overload; It should be noted that for each distributed task, its execution on the current best device is evaluated regularly. If the task meets specific abnormal conditions during execution (such as frequent failures, significantly slowed execution speed, etc.), and at the same time, the load changes of the best device are monitored to show an obvious overload trend (such as CPU usage continues to be high, memory usage approaches the upper limit, etc.), the system will determine that the best device is at risk of resource overload.
[0063] Step B13, searching for an idle device that meets the distributed device execution requirements, and migrating the idle device to the idle device for execution.
[0064] It should be noted that once the system determines that the best device is at risk of resource overload, the task migration mechanism is activated to find idle devices in the current system that meet the distributed task execution requirements. Idle devices refer to devices in the current system that have no assigned tasks or have low resource utilization. These devices have sufficient resources to take on new tasks. After finding idle devices that meet the conditions, distributed tasks that are at risk of resource overload will be migrated from the current best device to the idle device for execution.
[0065] In this implementation, by introducing the abnormal fault table, the system's ability to identify and handle abnormal situations is improved, providing strong data support for subsequent resource optimization and task scheduling. By real-time evaluation of task execution and equipment load changes, early warning of resource overload risks can be given and corresponding measures can be taken, effectively avoiding task execution failure or system crash due to equipment overload. The introduction of a migration mechanism can dynamically adjust task allocation to ensure effective resource utilization and smooth task execution.
[0066] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the task allocation method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0067] The present application also provides a task allocation system, which includes various distributed devices. Figure 4 , the task allocation system includes: The data acquisition module 10 is used to determine the task requirements of any distributed task in the distributed system and obtain the resource status of each distributed device; A weighted scoring module 20, for calculating a weighted score of each distributed device executing a distributed task based on task requirements, resource status and a dynamic weighting algorithm; The device allocation module 30 is used to allocate the distributed task to the best device with the highest weighted score for execution.
[0068] Optionally, the data acquisition module 10 is further used for: For any distributed device among the distributed devices, pre-process the task requirements and the corresponding resource status of the distributed device; Adjust the weights of the weighted scoring calculation formula according to the task type of the distributed task; A weighted calculation is performed based on the preprocessed task requirements, the status of each resource and the adjusted weights to obtain a weighted score for the distributed devices executing the distributed tasks.
[0069] Optionally, the task requirements include computing intensity, data transmission volume and delay tolerance, and the weighted scoring module 20 is further used to: Analyze the task types of distributed tasks; When the task type is a computationally intensive task, increase the weight corresponding to the computational intensity; When the task type is a data-intensive task, increase the weight corresponding to the data transmission amount; When the task type is a low-latency task, increase the corresponding weight of the task delay tolerance.
[0070] Optionally, the task allocation system further includes a task migration module 40, and the task migration module 40 is further used for: Monitor the execution status of distributed tasks and the resource load of optimal devices; When the execution status is failed or the resource load is higher than the preset load threshold, the weighted score of each distributed device executing the distributed task is recalculated to determine a new optimal device; Migrate distributed tasks to new and optimal devices for execution.
[0071] Optionally, the task migration module 40 is further configured to: Save the status information of distributed tasks and organize the intermediate data generated during the execution of distributed tasks; establishing a communication connection with a new optimal device and transmitting the distributed tasks together with the status information and the intermediate data to the new optimal device; The distributed task execution status is restored on the new best device using the state information and intermediate data, and the distributed task execution continues.
[0072] Optionally, the task migration module 40 is further configured to: Record the execution status of the distributed tasks and the load change of the best device when the execution status is failed, and store them in the abnormal fault table; If the execution condition is satisfied when executing on the best device and the best device satisfies the load variation condition, it is determined that the best device has a risk of resource overload; Find idle devices that meet the distributed device execution requirements and migrate the idle devices to execute them.
[0073] The task allocation system provided by the present application adopts the task allocation method in the above embodiment, which can solve the technical problem of unintelligent resource allocation. Compared with the prior art, the beneficial effects of the task allocation system provided by the present application are the same as the beneficial effects of the task allocation method provided by the above embodiment, and other technical features in the task allocation system are the same as the features disclosed in the above embodiment method, which will not be described in detail here.
[0074] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the task allocation method in the above-mentioned embodiment 1.
[0075] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, notebook computers, PADs (Portable Application Description: tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0076] like Figure 5As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a microphone, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0077] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0078] The electronic device provided by the present application adopts the task allocation method in the above embodiment to solve the technical problem of unintelligent resource allocation. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the task allocation method provided by the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0079] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0080] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0081] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the task allocation method in the above-mentioned embodiment.
[0082] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0083] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0084] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the task allocation device is applied to a distributed system, and the distributed system includes various distributed devices. It can: determine the task requirements of any distributed task among the distributed tasks on the distributed system, and obtain the resource status of each distributed device; calculate the weighted score of each distributed device executing the distributed task based on the task requirements, the resource status and the dynamic weighting algorithm; and allocate the distributed tasks to the best device with the highest weighted score for execution.
[0085] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0086] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0087] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0088] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned task allocation method, and can solve the technical problem of unintelligent resource allocation. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the task allocation method provided by the above-mentioned embodiment, and will not be described in detail here.
[0089] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned task allocation method when executed by a processor.
[0090] The computer program product provided by this application can solve the technical problem of unintelligent resource allocation. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the task allocation method provided by the above embodiment, which will not be repeated here.
[0091] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A task allocation method, characterized in that: Applied to a distributed system, the distributed system includes distributed devices, and the task allocation method includes: For any distributed task among the distributed tasks on the distributed system, determine the task requirement of the distributed task and obtain the resource status of each distributed device; Calculating a weighted score for each distributed device to execute the distributed task based on the task requirements, the status of each resource and a dynamic weighting algorithm; The distributed task is assigned to the best device with the highest weighted score for execution.
2. The task allocation method according to claim 1, characterized in that: The step of calculating the weighted score of each distributed device executing the distributed task based on the task requirement, each resource status and a dynamic weighting algorithm comprises: For any one of the distributed devices, preprocessing the task requirement and the resource status corresponding to the distributed device; Adjusting the weight of the weighted scoring calculation formula according to the task type of the distributed task; A weighted calculation is performed based on the preprocessed task requirements, the status of each resource and the adjusted weights to obtain a weighted score for the distributed device executing the distributed task.
3. The task allocation method according to claim 2, characterized in that: The task requirements include computing intensity, data transmission volume, and delay tolerance. The step of adjusting the weight of the weighted scoring calculation formula according to the task type of the distributed task includes: Analyzing the task type of the distributed task; When the task type is a computationally intensive task, increasing the weight corresponding to the computational intensity; When the task type is a data-intensive task, increasing the weight corresponding to the data transmission amount; When the task type is a low-delay task, the weight corresponding to the task delay tolerance is increased.
4. The task allocation method according to claim 1, characterized in that: After the step of allocating the distributed task to the best device with the highest weighted score for execution, the following step further comprises: monitoring the execution status of the distributed tasks and the resource load of the optimal device; When the execution status is failed or the resource load is higher than a preset load threshold, recalculating the weighted score of each distributed device executing the distributed task to determine a new optimal device; The distributed task is migrated to the new optimal device for execution.
5. The task allocation method according to claim 4, characterized in that: The step of migrating the distributed task to the new optimal device for execution comprises: Saving the status information of the distributed tasks and collating the intermediate data generated during the execution of the distributed tasks; Establishing a communication connection with the new optimal device, and transmitting the distributed task together with the state information and the intermediate data to the new optimal device; The execution state of the distributed task is restored on the new optimal device by using the state information and the intermediate data, and the distributed task is continued to be executed.
6. The task allocation method according to claim 4, characterized in that: After the step of monitoring the execution status of the distributed task and the resource load of the optimal device, the method further includes: Recording the execution status of the distributed task and the load change of the optimal device when the execution status is failure, and storing them in an abnormal fault table; If the execution condition is satisfied when executing on the optimal device and the optimal device satisfies the load change condition, determining that the optimal device has a risk of resource overload; Find an idle device that meets the execution requirements of the distributed device, and migrate the idle device to execute on the idle device.
7. A task allocation system, characterized in that: The task allocation system includes various distributed devices, and the task allocation system includes: A data acquisition module, used for determining the task requirements of any one of the distributed tasks on the distributed system, and acquiring the resource status of each distributed device; A weighted scoring module, used to calculate the weighted score of each distributed device executing the distributed task based on the task requirements, the status of each resource and a dynamic weighting algorithm; The device allocation module is used to allocate the distributed task to the distributed device with the highest weighted score for execution.
8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the task allocation method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the task allocation method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the task allocation method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Cloud computing resource allocation method and device
CN111225050A
Storage resource scheduling method and device based on machine learning and storage medium
CN117076093A
Server load balancing method and device, server cluster, equipment and medium
CN118260080A
End side equipment unloading method and system based on edge arrangement technology
CN118819684A
Cited By
Task scheduling method and device
CN120144249A
Device multi-parameter statistical calculation method and system based on general task scheduling platform
CN120704820A
Multi-home equipment control method and device, electronic equipment and storage medium
CN120915621A
