Task scheduling method and device, electronic equipment, storage medium and program product
By using dynamically updated task scheduling models in an edge cloud environment, processing the tasks to be scheduled and the device status parameters are determined, and the target devices of each task are solved, the problem of low task scheduling performance in edge cloud is solved, and more efficient resource utilization and lower latency are achieved.
Patent Information
- Application Number
- CN202411824659.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-05-06
AI Technical Summary
In edge cloud environments, low task scheduling performance leads to low resource utilization, increased latency and increased costs, making it difficult to cope with dynamically changing workloads and device status.
A task scheduling method is adopted to obtain the status parameters of the tasks to be scheduled in the current scheduling cycle and the equipment to be allocated, and to process these information using the trained task scheduling model to generate the scheduling information for each device, thereby determining the target equipment of each task. This model is based on the historical data update and training of the previous scheduling cycle, and can better adapt to dynamic changes.
Through dynamic update and training of task scheduling models, the accuracy and robustness of scheduling tasks are improved, resource utilization is optimized, task execution delay is reduced, and overall scheduling performance is improved.
Smart Images

Figure CN119938257A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of edge computing technology, and in particular to a task scheduling method, device, electronic device, storage medium and program product. Background Art
[0002] In edge cloud environments, task scheduling is a key link to ensure efficient operation of the system. With the popularization of IoT devices and the diversification of user needs, the dynamic nature and uncertainty of tasks have increased significantly. The static scheduling methods in related technologies are difficult to cope with such dynamic changes, resulting in low resource utilization, increased latency, and rising costs of devices, and poor scheduling performance. Summary of the invention
[0003] In order to solve the technical problems existing in the related art, the embodiments of the present application provide a task scheduling method, device, electronic device, storage medium and program product.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The present application provides a task scheduling method, the method comprising:
[0006] Acquire a plurality of first tasks to be scheduled in a current scheduling cycle, and determine a first workload required for each of the first tasks to be scheduled to be executed on a device to be allocated;
[0007] Acquire a first state parameter of the device to be allocated;
[0008] Scheduling a first task scheduling model, processing the first workloads of the plurality of first tasks to be scheduled and the first state parameters of the plurality of devices to be allocated, and obtaining first scheduling information of each of the first tasks to be scheduled for each of the devices to be allocated;
[0009] The first task scheduling model is obtained by training based on the second state parameters of the plurality of devices to be assigned in the last scheduling cycle and the second workloads of the plurality of second tasks to be scheduled;
[0010] Based on the first scheduling information of each of the first tasks to be scheduled for each of the devices to be assigned, a target device for executing each of the first tasks to be scheduled is determined from the multiple devices to be assigned.
[0011] The present application also provides a task scheduling device, the device comprising:
[0012] A load acquisition module, used to acquire a plurality of first tasks to be scheduled in a current scheduling cycle, and determine a first workload required for each of the first tasks to be scheduled to be executed on a device to be allocated;
[0013] A parameter acquisition module, used to acquire a first state parameter of the device to be allocated;
[0014] A scheduling module, used for scheduling a first task scheduling model, processing the first workloads of the plurality of first tasks to be scheduled and the first state parameters of the plurality of devices to be assigned, and obtaining first scheduling information of each of the first tasks to be scheduled for each of the devices to be assigned; wherein the first task scheduling model is trained based on the second state parameters of the plurality of devices to be assigned in the previous scheduling cycle, and the second workloads of the plurality of second tasks to be scheduled to be executed;
[0015] The target device determining module is used to determine a target device for executing each of the first tasks to be scheduled from the multiple devices to be assigned based on the first scheduling information of each of the first tasks to be scheduled for each of the devices to be assigned.
[0016] An embodiment of the present application also provides an electronic device, including a processor and a memory for storing a computer program that can be run on the processor, wherein the processor is used to execute the steps of any one of the above methods when running the computer program.
[0017] An embodiment of the present application further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0018] An embodiment of the present application further provides a computer program product, including a computer program, which implements the steps of any of the above methods when executed by a processor.
[0019] In the task scheduling method, device, electronic device, storage medium and program product provided in the embodiments of the present application, a first task scheduling model is scheduled, and the first workload of multiple first tasks to be scheduled and the first state parameters of multiple devices to be assigned are processed to obtain the first scheduling information of the first task to be scheduled for each device to be assigned, wherein the first task scheduling model is obtained by training based on the second state parameters of multiple devices to be assigned in the previous scheduling cycle and the second workload of multiple second tasks to be scheduled, so that the task scheduling model in each scheduling cycle is obtained by updating and training based on the historical data of the previous scheduling cycle, and the task scheduling model can better adapt to the dynamically changing workload and state parameters of the devices to be assigned, thereby improving the accuracy and robustness of the scheduling tasks. Finally, based on the generated first scheduling information, the target device for executing the first task to be scheduled is determined from the multiple devices to be assigned, ensuring that each task to be scheduled is assigned to the most suitable target device, thereby optimizing resource utilization, reducing task execution delays, and improving scheduling performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 The process diagram of the task scheduling method of the embodiment of the present application is as follows: Figure 1 ;
[0021] Figure 2 A diagram showing the architecture of a task scheduling method according to an embodiment of the present application;
[0022] Figure 3 A workload diagram of a dynamic task provided in an embodiment of the present application;
[0023] Figure 4 A schematic diagram of the structure of a task scheduling device according to an embodiment of the present application;
[0024] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0027] With the development of cloud computing, more and more mobile applications can take advantage of the rich computing resources of cloud data centers. Instead of relying on resource-limited mobile devices, mobile applications can offload their computationally intensive work (such as image processing tasks) to remote clouds. However, since remote clouds are usually far away from mobile users, long communication delays are inevitable.
[0028] To alleviate the problem of long latency, edge cloud came into being. Edge cloud refers to multiple small servers placed at the edge of the network. Mobile users nearby can connect to edge cloud servers through wireless networks. However, since these specially deployed edge cloud servers are smaller than remote cloud servers, the resources and computing power of edge cloud are relatively limited compared to remote cloud data centers.
[0029] Resources at the edge of the network are constrained due to cost and feasibility factors. It is very necessary to design a scheduler to effectively manage workloads and underlying resources to accommodate more applications and maximize their quality of service at the same time. However, scheduling in the edge computing paradigm is very challenging. First, due to heterogeneity, there are significant differences in capacity, speed, response time, and energy consumption between the computing servers in the remote cloud and local edge nodes. Second, in the remote cloud and edge layers, machines can also be heterogeneous. In addition, due to the mobility factor in the edge paradigm, the bandwidth keeps changing between the data source and the computing nodes (edge devices), and dynamic optimization needs to be performed continuously to meet application needs. Finally, the edge cloud environment has randomness in terms of task arrival rate, task duration, and resource requirements, which further increases the challenge of the scheduling problem.
[0030] The job scheduling algorithms in edge cloud environments in related technologies include: heuristic strategy-based methods; rule-based strategies. The following describes the above two scheduling algorithms respectively:
[0031] Heuristic strategy-based approach: The job scheduling problem of applications on edge resources is modeled as an optimization problem that explicitly considers the heterogeneity of applications and resources in terms of service quality attributes. A scheduling heuristic algorithm is established by combining several factors in latency, cost, bandwidth, maximum time span, and service quality. With the support of heuristic algorithms, edge computing can reduce network communication latency, save energy, and improve cost-effectiveness and service quality.
[0032] Rule-based policy approach: Priority-based rule-based policy first checks whether the resources available in the edge node meet the client's needs. If there are not enough available resources, the request is moved to the cloud layer. In addition, the algorithm in the edge node handles all client requests and serves them according to the priority of the client requests. After receiving the client request, the edge service manager performs the following steps: If the request cannot be served before its deadline, the request is rejected; otherwise, the edge service manager determines the priority queue of the request based on the priority, deadline, and available resources of the request. The priority rule-based task scheduling algorithm aims to meet the user's needs or service quality by minimizing the time that the service request spends in the system queue and achieves high throughput through efficient resource provision.
[0033] Due to limited resource capacity, mobility factors in the Internet of Things, resource heterogeneity, network hierarchy and random behavior, it is challenging to efficiently schedule application tasks in this environment. The above heuristic strategy-based methods lack versatility and rapid adaptability. Most of the above methods adopt a centralized scheduling strategy, and the algorithm schedules cloud computing resources in a unified manner. However, most cloud servers are decentralized or hierarchical, and the system is constantly changing during the application process, which requires certain adaptability of the algorithm in a dynamic environment. Therefore, the applicability of the above methods in cloud environments is low. In a random edge environment, the task scenarios are becoming more and more complex, and ordinary scheduling algorithms are difficult to guarantee the optimization of scheduling problems. Therefore, in practical applications, the scheduling algorithm should be adaptive, and the model parameters should be learned through machine or deep learning to help the scheduling algorithm optimize itself with the help of scheduling data in practical applications to achieve better results.
[0034] Based on this, an embodiment of the present application proposes a task scheduling method. In various embodiments of the present application, multiple first tasks to be scheduled in the current scheduling cycle are obtained, and the first workload required for each first task to be scheduled to be executed on the device to be assigned is determined; the first state parameters of the device to be assigned are obtained; the first task scheduling model is scheduled, and the first workloads of the multiple first tasks to be scheduled and the first state parameters of the multiple devices to be assigned are processed to obtain the first scheduling information of each first task to be scheduled for each device to be assigned; wherein the first task scheduling model is trained based on the second state parameters of the multiple devices to be assigned in the previous scheduling cycle, and the second workloads of the multiple second tasks to be scheduled; based on the first scheduling information of each first task to be scheduled for each device to be assigned, the target device to execute each first task to be scheduled is determined from the multiple devices to be assigned.
[0035] The embodiment of the present application provides a task scheduling method, which is applied to an electronic device, wherein the electronic device includes a server and / or a terminal, and the server can be deployed in the cloud (cloud server) or on the device side (edge server). Figure 1 The process diagram of the task scheduling method of the embodiment of the present application is as follows: Figure 1 ;like Figure 1 As shown, the method includes:
[0036] Step 101: Acquire a plurality of first tasks to be scheduled in a current scheduling cycle, and determine a first workload required for each first task to be scheduled to be executed on a device to be allocated.
[0037] In the embodiment of the present application, the scheduling period refers to a fixed time period divided on the time axis, and a task scheduling decision is made in each scheduling period for regular evaluation and adjustment of task allocation. The embodiment of the present application does not limit the method for dividing the scheduling period, and the time length of each scheduling period can be the same or different. Exemplarily, the time axis can be evenly divided to obtain multiple scheduling periods. The first task to be scheduled refers to a task that needs to be assigned to a certain device to be assigned for execution in the current scheduling period, and the multiple first tasks to be scheduled include the newly arrived tasks in the current scheduling period, and at least one of the unfinished tasks in the previous scheduling period. The device to be assigned refers to a computing resource that can be used to execute the task, such as an edge server, a cloud node or other computing device. The devices to be assigned usually have different performance indicators and resource constraints. The first workload refers to the amount of resources and processing time required by the first task to be scheduled during execution. Exemplarily, the first workload may include the central processing unit (CPU) computing resources, random access memory (RAM) memory occupancy, network bandwidth and disk input / output (disk I / O) required for the execution of the first task to be scheduled.
[0038] In actual applications, a resource management system (RMS) is deployed on the cloud node. The resource management system RMS responds to the task request received in the current scheduling cycle and obtains one or more new tasks from the task request. A plurality of second tasks to be scheduled in the previous scheduling cycle adjacent to the current scheduling cycle are obtained, and the plurality of second tasks to be scheduled include tasks completed in the previous scheduling cycle and old tasks that were not completed in the previous scheduling cycle. The plurality of new tasks and the plurality of uncompleted old tasks are determined as a plurality of first tasks to be scheduled.
[0039] Step 102: Obtain a first state parameter of the device to be allocated.
[0040] In an embodiment of the present application, the state parameters of each device to be allocated (such as current load, available resources, performance indicators, etc.) are dynamically changing, and the scheduling algorithm needs to obtain these parameters in real time to make the best scheduling decision. The first state parameters of the device to be allocated may include CPU, RAM, bandwidth, disk utilization and capacity, power characteristics, unit time cost, million instructions per second (MIPS) of the device to be allocated, response time, and the number of tasks assigned to the device to be allocated. The number of tasks assigned to the device to be allocated included in the first state parameters of the device to be allocated in the current scheduling cycle refers to the number of second tasks to be scheduled that are actually assigned to the device to be allocated after the scheduling decision in the previous scheduling cycle.
[0041] Step 103: Schedule the first task scheduling model, process the first workloads of the plurality of first tasks to be scheduled and the first state parameters of the plurality of devices to be allocated, and obtain first scheduling information of each first task to be scheduled for each device to be allocated.
[0042] The first task scheduling model is obtained by training based on the second state parameters of a plurality of devices to be assigned in a previous scheduling cycle and the second workloads of a plurality of second tasks to be scheduled.
[0043] In an embodiment of the present application, the task scheduling model is a deep reinforcement learning (DRL) model, which is used to generate the optimal task scheduling decision according to the workload of the task to be scheduled in the current scheduling cycle and the state parameters of the device to be assigned. The first scheduling information refers to the scheduling decision generated by the first task scheduling model for each task to be scheduled. Exemplarily, the first scheduling information of each first task to be scheduled for each device to be assigned is the probability of assigning the first task to be scheduled to each device to be assigned. The first task scheduling model is obtained by updating the parameters of the second task scheduling model scheduled in the previous scheduling cycle based on the historical data of the previous scheduling cycle. The historical data includes the second state parameters of multiple devices to be assigned in the previous scheduling cycle and the second workload of multiple second tasks to be scheduled, as well as the scheduling results output by the second task scheduling model. By iteratively updating the task scheduling model based on the historical data of the previous scheduling cycle at the beginning of each scheduling cycle, the task scheduling model can learn how to generate the optimal scheduling decision under different circumstances.
[0044] Processing the first workloads of multiple first tasks to be scheduled and the first state parameters of multiple devices to be allocated can be achieved in the following way: first, feature extraction is performed on the first state parameters of the multiple devices to be allocated to obtain a first feature vector; then, feature extraction is performed on the first workloads of new tasks in the multiple first tasks to be scheduled to obtain a second feature vector; then, feature extraction is performed on the first workloads of old tasks in the multiple first tasks to be scheduled and the indexes of the devices to be allocated to which the old tasks were allocated in the previous scheduling cycle to obtain a third feature vector; finally, the first feature vector, the second feature vector and the third feature vector are processed to obtain the first scheduling information of each first task to be scheduled for each device to be allocated.
[0045] In practical applications, the model structure of the first task scheduling model is a residual recurrent neural network, which includes at least 2 fully connected layers and 3 skip-connected recurrent layers. The first state parameters of multiple devices to be assigned and the first workloads of multiple first tasks to be scheduled are feature extracted through the two fully connected layers of the first task scheduling model to obtain the first feature vector, the second feature vector and the third feature vector. Then, the first feature vector, the second feature vector and the third feature vector are processed through three skip-connected recurrent layers to obtain the first scheduling information of each first task to be scheduled for each device to be assigned. The skip connection refers to skipping the output of the first recurrent layer with the output of the fully connected layer to form a residual block. For example, if the output dimension of the fully connected layer is D2, the output shape is (N, D2). The first recurrent layer passes the output of the fully connected layer through a recurrent layer to capture the time feature. Assuming that the number of hidden units in the recurrent layer is H1, the output shape is (N, H1). It is assumed that the output shape after the skip connection is (N, H1+D2). The skip connection between the second and third recurrent layers is similar and will not be described again.
[0046] Step 104: Based on the first scheduling information of each first task to be scheduled for each device to be assigned, determine a target device for executing each first task to be scheduled from a plurality of devices to be assigned.
[0047] Based on this, in one embodiment, the multiple first tasks to be scheduled include new tasks received in the current scheduling cycle, and old tasks in the multiple second tasks to be scheduled that were not completed in the previous scheduling cycle. Based on the first scheduling information of each first task to be scheduled for each device to be assigned, the target device to execute each first task to be scheduled is determined from the multiple devices to be assigned, including: for each first task to be scheduled, when the first task to be scheduled is an old task, based on the task type of the first task to be scheduled and the first scheduling information of the first task to be scheduled for each device to be assigned, the target device to execute the first task to be scheduled is determined from the multiple devices to be assigned; when the first task to be scheduled is a new task, based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be assigned, and the first scheduling information of the first task to be scheduled for each device to be assigned, the target device is determined from the multiple devices to be assigned.
[0048] In an embodiment of the present application, for each first task to be scheduled, when the first task to be scheduled is an old task, the first task to be scheduled has been scheduled to a certain device to be allocated in the previous scheduling cycle, and it is determined in the current cycle whether the first task to be scheduled needs to be migrated to other devices to be allocated. Task types include migratable tasks and non-migratable tasks. Based on the task type of the first task to be scheduled and the first scheduling information of the first task to be scheduled for each device to be allocated, a target device is determined from multiple devices to be allocated. When the first task to be scheduled is a new task, the first task to be scheduled has not been allocated to any device to be allocated, therefore, based on the first workload, the first state parameter and the first scheduling information, the target device is determined from multiple devices to be allocated.
[0049] Based on this, in one embodiment, a target device is determined from multiple devices to be allocated based on the task type of the first task to be scheduled and the first scheduling information of the first task to be scheduled for each device to be allocated, including: when the task type is a migratable task, the target device is determined from multiple devices to be allocated based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be allocated and the first scheduling information of the first task to be scheduled for each device to be allocated; when the task type is a non-migratable task, the device to be allocated to which the first task to be scheduled was scheduled in the previous scheduling cycle is determined as the target device.
[0050] Based on this, in one embodiment, based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be allocated and the first scheduling information of the first task to be scheduled for each device to be allocated, a target device is determined from the multiple devices to be allocated, including: screening out one or more candidate devices from the multiple devices to be allocated, wherein the first state parameters of the candidate devices match the first workload; and determining the candidate device with the largest first scheduling information as the target device.
[0051] In an embodiment of the present application, for each first task to be scheduled, when the first task to be scheduled is a new task or a migratable task, one or more candidate devices can be screened out from multiple devices to be allocated based on the first workload of the first task to be scheduled and the first state parameters of multiple devices to be allocated. For each device to be allocated, when the first workload of the first task to be scheduled matches the first state parameter of the device to be allocated, the device to be allocated is determined as a candidate device. The first workload of the first task to be scheduled matches the first state parameter of the device to be allocated, which means that the first state parameter of the device to be allocated can meet the first workload, that is, the device to be allocated has sufficient resources to run the first task to be scheduled. For example, the remaining capacity of the CPU in the first state parameter is greater than or equal to the CPU computing resources in the first workload, the remaining capacity of the RAM in the first state parameter is greater than or equal to the RAM memory occupancy in the first workload, etc. After obtaining one or more candidate devices, the candidate device with the largest first scheduling information is determined as the target device for executing the first task to be scheduled.
[0052] Exemplarily, the two first tasks to be scheduled are Task 1 and Task 2, the first workload of Task 1 is: CPU requirement 2, RAM requirement 1024, bandwidth requirement 100, disk requirement 50; the first workload of Task 2 is: CPU requirement 1, RAM requirement 512, bandwidth requirement 50, disk requirement 25. The three devices to be allocated are Host 1, Host 2 and Host 3, the first state parameters of Host 1 are: CPU capacity 4, RAM capacity 2048, bandwidth capacity 200, disk capacity 100; the first state parameters of Host 2 are: CPU capacity 2, RAM capacity 1024, bandwidth capacity 150, disk capacity 50; the first state parameters of Host 3 are: CPU capacity 3, RAM capacity 1536, bandwidth capacity 180, disk capacity 75. For Task 1, the device priority list arranged from large to small according to the first scheduling information output by the first task scheduling model is: [Host 1, Host 2, Host 3]. Check host 1: CPU4>2, RAM2048>1024, bandwidth200>100, disk100>50, host 1 is a candidate device, and the first scheduling information of host 1 is the largest, so host 1 is determined as the target device. For task 2, the device priority list arranged from large to small according to the first scheduling information output by the first task scheduling model is: [host 2, host 3, host 1]. Check host 2: CPU2>1, RAM1024>512, bandwidth150>50, disk50=25, host 2 is a candidate device, and the first scheduling information of host 2 is the largest, so host 2 is determined as the target device.
[0053] The embodiment of the present application not only selects the device to be allocated with the first maximum scheduling information, but also considers whether the first state parameter of the device to be allocated matches the first workload of the first task to be scheduled, thereby ensuring that the determined target device can successfully execute the first task to be scheduled, thereby improving the accuracy and reliability of task scheduling.
[0054] In one embodiment, the task scheduling method provided by the embodiment of the present application also includes: determining a first loss value based on second state parameters of multiple devices to be assigned and second workloads of multiple second tasks to be scheduled. Determine a second loss value based on second scheduling information for each device to be assigned for each second task to be scheduled. The second scheduling information is a second task scheduling model for the previous scheduling cycle, which is obtained by processing the second workloads of multiple second tasks to be scheduled and the second state parameters of multiple devices to be assigned. The first loss value and the second loss value are calculated to obtain a model loss value. Based on the model loss value, the second task scheduling model is updated to obtain the first task scheduling model.
[0055] In an embodiment of the present application, in the last scheduling cycle, the second task scheduling model processes the second workload of multiple second tasks to be scheduled and the second state parameters of multiple devices to be allocated, and obtains the second scheduling information of each second task to be scheduled for each device to be allocated. Based on the second scheduling information of each second task to be scheduled for each device to be allocated, the second loss value of the second task scheduling model is determined. In the last scheduling cycle, after the device to be allocated is completed for each second task to be scheduled, multiple performance indicators can be determined based on the second state parameters of multiple devices to be allocated and the second workload of multiple second tasks to be scheduled. The multiple performance indicators include at least average energy consumption (Average Energy Consumption, AEC), average response time (Average Response Time, ART), average migration time (Average Migration Time, AMT), and cost (Cost). Average energy consumption refers to the average value of the total energy consumed during the execution of all second tasks to be scheduled in the last scheduling cycle. Average response time is the average time from submission to completion of all second tasks to be scheduled in the last scheduling cycle. Average migration time is the average migration time of migratable tasks in all second tasks to be scheduled in the last scheduling cycle. The cost is the total cost of executing and migrating all second tasks to be scheduled in the previous scheduling cycle. The first loss value and the second loss value are calculated, and the first loss value and the second loss value are added to obtain the model loss value. The model loss value can be used to update the parameters in the second task scheduling model through back propagation and gradient descent methods. When the model loss value is minimized, the first task scheduling model is obtained.
[0056] In one embodiment, based on the second scheduling information of each second task to be scheduled for each device to be allocated, a second loss value is determined, including: for each second task to be scheduled, based on the second workload of the second task to be scheduled, the second state parameters of the plurality of devices to be allocated and the second scheduling information of the second task to be scheduled for each device to be allocated, a first device planned to execute the second task to be scheduled is determined from the plurality of devices to be allocated; when the task type of the second task to be scheduled is a non-migratable task and the device to be allocated to which the second task to be scheduled is actually scheduled is different from the first device, the second task to be scheduled is determined as a third task to be scheduled; a first ratio of a first number of third tasks to be scheduled to a total number of the plurality of second tasks to be scheduled is determined; for each second task to be scheduled, a second number of second devices corresponding to the second task to be scheduled is determined, wherein the second device is one or more devices to be allocated among the plurality of devices to be allocated, and the second scheduling information of the second task to be scheduled for the second device is greater than the second scheduling information of the second task to be scheduled for the first device; a second loss value is determined based on the first ratio and the second numbers corresponding to the plurality of second tasks to be scheduled.
[0057] In the embodiment of the present application, the second task to be scheduled also includes the new task received in the last scheduling cycle and the old task that was not completed in the last scheduling cycle. A third task to be scheduled whose task type is a non-migratable task is selected from these unfinished old tasks. One or more third tasks to be scheduled whose task type is a non-migratable task are selected from multiple second tasks to be scheduled; wherein the first device corresponding to the third task to be scheduled is different from the third device, the third device is the device to be allocated to which the third task to be scheduled is actually scheduled in the last scheduling cycle, and the first device is the device to be allocated determined from multiple devices to be allocated based on the second scheduling information of the third task to be scheduled for each device to be allocated. After the second scheduling information of each second task to be scheduled for each device to be allocated is obtained by scheduling the second task scheduling model, for each second task to be scheduled, the device with the largest second scheduling information is selected from multiple devices to be allocated whose second state parameters match the second workload of the second task to be scheduled as the first device. For the third task to be scheduled whose task type is a non-migratable task, the third task to be scheduled has a device to be allocated that is actually allocated and cannot be migrated, so the first number of the third task to be scheduled is determined. The ratio of the first quantity to the total number of second tasks to be scheduled is determined as the first ratio. For each second task to be scheduled, the device with the largest second scheduling information is selected as the target device from multiple devices to be allocated whose second state parameters match the second workload of the second scheduling task, and the other multiple devices to be allocated with second scheduling information greater than the target device are used as second devices, that is, the second device is a device to be allocated with greater second scheduling information, but the second state parameter does not match the second workload. The second quantity of the second device corresponding to each second task to be scheduled is obtained, and the multiple second quantities are added to the first ratio to obtain the second loss value.
[0058] The embodiment of the present application adds a second loss value of migration penalty and device allocation penalty on the basis of the first loss value of the performance indicator, so that the task scheduling model can learn scheduling experience based on the scheduling results of each scheduling cycle, adapt to various complex edge cloud application scenarios, and improve the universality and accuracy of task scheduling.
[0059] In one embodiment, a device to be assigned corresponds to a first task scheduling model and a second task scheduling model, and based on the model loss value, the second task scheduling model is updated to obtain the first task scheduling model, including: scheduling each first task scheduling model, predicting the first workloads of multiple first tasks to be scheduled and the first state parameters of multiple devices to be assigned, and obtaining the third loss value of each first task scheduling model in the next scheduling cycle; obtaining the fourth loss value of each second task scheduling model, the fourth loss value is for scheduling the second task scheduling model, predicting the second workloads of multiple second tasks to be scheduled and the second state parameters of multiple devices to be assigned, and obtaining the loss value of the second task scheduling model in the current scheduling cycle; based on the model loss value, the third loss value and the fourth loss value, updating each second task scheduling model to obtain the corresponding first task scheduling model.
[0060] In an embodiment of the present application, a resource management system is deployed on each device to be allocated, that is, in the current scheduling cycle, each device to be allocated has a first task scheduling model, and in the previous scheduling cycle, each device to be allocated has a second task scheduling model. For each first task scheduling model, the first workloads of multiple first tasks to be scheduled and the first state parameters of multiple devices to be allocated are processed through the fully connected layer and the loop layer in the first task scheduling model, and the third loss value of the first task scheduling model in the next scheduling cycle is predicted. The third loss value is generally a value function, which is a constant. Based on the model loss value, the third loss value and the fourth loss value, the global model parameters are updated. The global model parameters are synchronized to the model parameters in each second task scheduling model to obtain the first task scheduling model corresponding to each second task scheduling model after the update.
[0061] The embodiments of the present application can achieve the periodic update of global network parameters while asynchronously accumulating the gradient of the local network on each device to be assigned, so that the task scheduling model can be distributed on different devices to be assigned, thereby achieving faster model learning within the range of resource-constrained edge devices and improving the efficiency and accuracy of task scheduling.
[0062] In the task scheduling method, device, electronic device, storage medium and program product provided in the embodiments of the present application, a first task scheduling model is scheduled, and the first workload of multiple first tasks to be scheduled and the first state parameters of multiple devices to be assigned are processed to obtain the first scheduling information of the first task to be scheduled for each device to be assigned, wherein the first task scheduling model is obtained by training based on the second state parameters of multiple devices to be assigned in the previous scheduling cycle and the second workload of multiple second tasks to be scheduled, so that the task scheduling model in each scheduling cycle is obtained by updating and training based on the historical data of the previous scheduling cycle, and the task scheduling model can better adapt to the dynamically changing workload and state parameters of the devices to be assigned, thereby improving the accuracy and robustness of the scheduling tasks. Finally, based on the generated first scheduling information, the target device for executing the first task to be scheduled is determined from the multiple devices to be assigned, ensuring that each task to be scheduled is assigned to the most suitable target device, thereby optimizing resource utilization, reducing task execution delays, and improving scheduling performance.
[0063] The present application is described below in conjunction with application examples.
[0064] The technical solution described in this application is a dynamic scheduling solution based on a random edge cloud environment. The key part is to use a reinforcement learning model suitable for policy gradient learning to optimize the performance of the scheduler in dynamic workloads. The overall task flow is as follows: (1) RMS receives task requests. (2) The DRL model predicts the scheduling strategy (3) The constraint satisfaction module finds possible migration and scheduling decisions from the output of the DRL model. (4) The loss function of the DRL model is calculated and its parameters are updated. (5) Policy gradient learning is used for random dynamic scheduling.
[0065] Figure 2 The scheme architecture diagram of the task scheduling method of the embodiment of the present application is as follows: Figure 2 As shown, the task scheduling method includes an edge cloud environment, and the edge cloud environment includes multiple edge nodes (corresponding to the devices to be allocated in the above embodiment). Specifically, the process of RMS receiving a task request is described below.
[0066] The infrastructure of the edge node is controlled by RMS, and the resource management system RMS consists of scheduling and migration services, and resource monitoring services. The scheduling and migration services are used to perform new task allocation and migration of active tasks (corresponding to the old tasks in the above embodiment), and the resource monitoring service is used to obtain host configuration, new and old task parameters, and calculate loss functions. RMS receives tasks from IoT mobile devices that follow the message queue telemetry transmission (Message Queuing Telemetry Transport, MQTT) protocol request format with service quality and service level agreement requirements. RMS schedules new tasks and regularly decides whether to migrate existing tasks to new hosts (other devices to be allocated) based on optimization goals (such as minimizing delay, cost, maximizing resource utilization, balancing load, ensuring service quality and service level agreement requirements, etc.). The resources such as CPU, RAM, bandwidth, and disk required for the request sent by the IoT mobile device are determined in advance by the device's specification configuration. The CPU, RAM, bandwidth, and disk requirements of different tasks and their expected completion time or deadline will affect the decision of RMS. Task generation is random, and each task has a dynamic workload. Based on the changing user needs and the mobility of IoT mobile devices, the computing volume and bandwidth requirements of the task will change over time. The execution time is divided into scheduling intervals of equal duration (corresponding to the scheduling periods in the above embodiment), and the scheduling intervals are numbered according to the order in which they appear. Figure 3 The following is a schematic diagram of the workload of dynamic tasks provided in the embodiment of the present application. Figure 3 The i-th scheduling interval is shown as S i , it starts from time t i and continues until the beginning of the next scheduling interval, i.e., t i+1 In each scheduling interval S i In the , active tasks are tasks that are being executed on the host, using at i Similarly, in the scheduling interval S i At the beginning, the set of completed tasks is denoted as f i , the new task set sent by the workload generation module is denoted as n i . Complete the task set f i Leave the system, new task n i Join the system. Therefore, in the scheduling interval S i At the beginning, RMS receives the task request and updates the cloud environment: i-1 Active tasks in the cloud environment i-1 Update to the scheduling interval S i Active tasks in the cloud environment i , activity tasks at i for i-1 ∪n i-f i .
[0067] The following describes the process of DRL model prediction scheduling strategy. The DRL model uses task requirements and host characteristics from resource monitoring services to predict the next scheduling decision. The problem considered by the DRL model is to optimize the performance of the scheduler in edge cloud environments and dynamic workloads. The performance of the scheduler is quantified by the loss metric defined for each scheduling interval. The lower the value of Loss, the better the scheduler. i The loss is expressed as L i In the edge cloud environment, the host set is denoted as Hosts, and its enumeration number is denoted as [H0, H1, ..., H n ]. Assume that at any time when executing a task, the maximum number of hosts is n, and denote the hosts assigned to task T as {T}. Define the scheduler as a mapping between system states and operations, which consists of host assignments for new tasks and migration decisions for active tasks. The system is in S i The state at the beginning, use State i It is represented by the parameter value of the host set (corresponding to the state parameter in the above embodiment), the remaining active tasks in the previous time period (at i-1 -f i ) and new task n i The scheduler must be active for tasks at i Each task in decides the host to be assigned or migrated to, which is represented by S i Action i However, not all tasks are transferable. Let m i ∈at i-1 -f i is a transferable task, then Action i ={h∈Hosts for task T|T∈m i ∪n i} is m i The migration decision of tasks in n i Therefore, the scheduler represented by the model is a function: i →Action i The loss of the scheduling interval depends on the assignment of tasks to hosts, i.e. the behavior of the model. Therefore, for the optimal model, the problem can be formulated as follows:
[0068]
[0069] In each scheduling interval S iIn the DRL, the action Action is generated according to the state State. For all migratable tasks and new tasks, the task T is assigned to the host indicated by the action Action(T). Under this condition, the model loss L of all scheduling intervals is minimized. i The sum of .
[0070] The input of the scheduling model is a State consisting of host parameters i , including the utilization and capacity of CPU, RAM, bandwidth, and disk. It also includes power characteristics, unit time cost, million instructions per second of the host, response time, and the number of tasks assigned to the host. All these parameters are defined for all hosts in the feature vector, denoted as at i The tasks in are divided into two disjoint sets: n i and at i-1 -f i The former consists of parameters such as task CPU, RAM, bandwidth, and disk requirements. The latter also includes the index of the host assigned in the previous interval. The feature vectors of this set of tasks are recorded as and Therefore, State i Became This is the input to the model.
[0071] In the interval S i At the beginning, the model needs to be based on the input State i for i Each task in the output action provides a host allocation. i is each new task n i The host allocation, and the preceding interval at i-1 -f i The migration decision of the remaining active tasks in is . This assignment must be valid in terms of feasibility constraints, which means that each task to be migrated must be migratable to the new host. Also, when a host h is assigned to any task T, the host h should not be overloaded after the assignment. Therefore, Action i The description is as follows:
[0072]
[0073] The following describes the specific process of the constraint satisfaction module finding possible migration and scheduling decisions from the output of the DRL model. Figure 2In , the constraint satisfaction module is used to ensure that the output Action of the DRL model satisfies various constraints, and converts the unconstrained actions generated by the DRL model into actions that satisfy the actual constraints, that is, to determine the model penalty. This scheme uses an unconstrained definition of the model action and compensates for the constraints in the objective function. The unconstrained definition means that in the DRL model, in order to simplify the learning process of the model, the output of the model is usually an unconstrained action, that is, the model does not directly consider the various constraints in the actual system. For example, the model may output a host priority list for each task instead of directly specifying which host each task should be assigned to. Compensation means that in order to ensure that the model can take into account the actual constraints during the learning process, a compensation term (penalty term) can be added to the loss function. This penalty term will increase the loss value when the unconstrained action generated by the model does not meet the actual constraints, thereby guiding the model to learn actions that meet the constraints. In the unconstrained representation of the model action, the output will be a host priority list for each task. Therefore, for the task There is a list of hosts Arrange in descending order by allocation preference (corresponding to the first scheduling information in the above embodiment). For a neural network, the output can be an allocation preference vector for each host for each task. This means that instead of specifying a single host for each task, the model provides a sorted list of hosts. The unconstrained model action set by the policy gradient is represented as However, this unconstrained operation cannot be used directly to update the tasks assigned to the host. It is necessary to select the most suitable host for each migratable task. if and If it is not possible to migrate, then it will not be migrated. will be assigned to the most appropriate highest level host. Convert to Action i The definition of is as follows:
[0074]
[0075] in, Determine the task is the set of transferable tasks m i Or a new task set n i A task in Make sure you select the host Suitable for the task Suitable conditions include that the host's resources (CPU, RAM, bandwidth, disk) can meet the needs of the task; Make sure to select the current host Previously, all hosts with higher priority It has already been considered in the unconstrained action of the previous interval; Make sure all higher priority hosts Hosts that have been determined to be unsuitable in the previous scheduling interval can avoid repeated selection of unsuitable hosts, thereby improving scheduling efficiency and accuracy.
[0076] The penalty for unconstrained actions includes two aspects: ① Migration penalty: the proportion of tasks that the model wants to migrate but cannot migrate in the total number of tasks; ② Host allocation penalty: for each task, count the number of hosts in the priority list that cannot be assigned to the task but are given a higher priority, and add up the number of hosts that cannot be assigned to all tasks. This penalty guides the learning model to make decisions based on constraints, expressed as Penalty i+1 Therefore, the output First processed by the constraint satisfaction module to generate an Action i and Penalty i+1 .
[0077] The following is the process of calculating the loss function of the DRL model and updating its parameters. To make the learning model optimal, it is necessary to reduce the loss of each interval, thereby reducing the cumulative loss. In addition, if you want the model (from State i To Action i The mapping of the average energy consumption (AEC), average response time (ART), average migration time (AMT), and cost (Cost) need to be optimized. To this end, the loss function L is defined as i , as a measure of model parameter update. L i The definition of is as follows:
[0078] L i =α×AEC i-1 +β×ART i-1 +γ×AMT i-1 +δ×Cost i-1
[0079] Among them, the hyperparameters α, β, γ, δ ≥ 0 and α + β + γ + δ = 1. The hyperparameters (α, β, γ, δ) will be set to different values according to different user service quality requirements and applications. For example, for energy-sensitive applications, α needs to be set to a larger value, or even to 1. Considering the penalty of unconstrained actions, the model updates its parameters to minimize L i , and the corresponding constraints must be met. Therefore, the loss of the scheduling model is defined as follows:
[0080]
[0081] The following describes the process of using policy gradient learning for stochastic dynamic scheduling. The above scheme gives a deterministic policy that cannot adapt to the random setting. However, this scheme attempts to approximate the policy itself and uses the policy gradient method to As a signal to update the network, we optimize it. To approximate each scheduling interval S i From State i arrive As a function of , this scheme uses a residual recurrent neural network. The advantage of using a residual recurrent neural network is that it can capture complex temporal relationships between inputs and outputs. A single network is used to predict the policy (actor head) and the cumulative loss after the current interval (critic head). The residual recurrent neural network has 2 fully connected layers followed by 3 recurrent layers with skip connections. The 2D input is first flattened and then passed through the recurrent layers. The output of the last recurrent layer is sent to both network heads. The actor head output size is 10 4 , it is deformed into a two-dimensional vector of 100 × 100. This means that the model can manage up to 100 tasks and 100 hosts.
[0082] Finally, a normalization function (Softmax function) is applied on the second dimension so that all values are in [0, 1] and the sum of all values in a row is equal to 1. This output can be interpreted as a probability map where O jk Indicates the task Should be assigned to host H k The probability that host H k is the kth host in the host enumeration. The output of the critic head is a single constant representing the value function, i.e., the accumulated loss from the next time interval C is Cumulative. The recurrent layer consists of Gated Recurrent Units (GRUs), which model the temporal aspects of task and host characteristics, including the CPU, RAM, and bandwidth requirements of the task and the CPU, RAM, and bandwidth capacity of the host. While GRU layers help make smart scheduling decisions by modeling temporal features, they increase training complexity due to the large number of network parameters. This is solved by using skip connections between these layers to propagate gradients faster. The value function is a prediction of future loss, rather than a direct calculation result, and this prediction is based on the input state state and the output action action prediction.
[0083] To learn the weights and biases of the residual recurrent neural network, the reward is For the current model, we use the back propagation algorithm from 10 -2The adaptive learning rate is started and reduced to 1 / 10 when the absolute sum of the reward changes in the last 10 iterations is less than 0.1. The reward is The network parameters are updated by performing automatic differentiation. The gradients of the local network are asynchronously accumulated at all edge nodes, and the global network parameters are updated periodically. The formula is as follows:
[0084]
[0085] Among them, θ represents the global network parameters, and θ′ represents the local network parameters. The logarithmic term represents the direction of parameter change, Indicates that from State i The cumulative prediction loss for the first episode. In order to minimize The gradient is proportional to this quantity and has a negative sign to reduce the total loss. The second gradient term is the mean squared error between the predicted cumulative loss and the cumulative loss one step later. The output Transformation from constraint satisfaction module to action i , sent to the resource monitoring service every other scheduling cycle. Therefore, for each interval, the residual recurrent neural network has a forward pass. For backpropagation, this scheme uses a size of 12 episodes, thus saving the experience of the previous episode to find and accumulate gradients and update model parameters after 12 intervals. For large batches, parameter updates are slow, while for small batches, gradient accumulation cannot generalize and has high variance. Based on this, the empirical analysis concludes that the optimal number of episodes is 12 episodes.
[0086] The embodiment of the present application uses a reinforcement learning method based on policy gradient learning, and uses technical means such as a model penalty mechanism to achieve task scheduling in a decentralized edge environment. The algorithm provides a host priority list for each task and combines evaluation indicators such as host parameters, response time and cost, and the number of jobs assigned to the host to calculate the placement decision of each job. The embodiment of the present application uses a method based on a residual recurrent neural network, using technical methods such as a gated recurrent unit, to achieve scheduling using a timing pattern in a dynamic edge cloud environment by capturing the complex temporal relationship between input and output. The gated recurrent unit helps to make wise scheduling decisions by modeling temporal features, and the residual connection facilitates rapid gradient propagation. In summary, the embodiment of the present application aims to provide an end-to-end real-time task scheduler for an integrated edge and cloud computing environment. A new scheduler based on asynchronous advantage actor-critic (Asynchronous-advantage-actor-critic, A3C) and residual recurrent neural network is proposed, which can consider all important parameters of tasks and hosts to make scheduling decisions to provide better performance. In addition, A3C allows the scheduler to quickly adapt to dynamically changing environments using asynchronous updates, and the residual recurrent neural network can also quickly learn network weights using temporary task / workload behavior.
[0087] The embodiments of the present application can effectively cope with complex edge environments and achieve efficient scheduling. In the decentralized and layered environment of edge clouds, most of the existing technical solutions adopt centralized scheduling strategies. This proposal runs multiple schedulers with separate partitions for tasks and nodes. These schedulers can run on a single node or a separate edge cloud node. Multiple participants learning parameter updates in an asynchronous manner can distribute the computing load on different hosts, thereby achieving faster learning within the scope of resource-constrained edge devices.
[0088] The embodiment of the present application learns scheduling parameters and scheduling experience, and has strong adaptability. General technical solutions can only take into account one or two of the indicators such as energy consumption, response time, cost and migration time, and are suitable for specific scenarios. The embodiment of the present application can take into account the above indicators at the same time through reinforcement learning, calculate the loss according to the indicators to optimize the parameters, and learn scheduling experience through policy gradient learning, which can adapt to various complex edge cloud application scenarios.
[0089] In practical applications, the current access data is generated in huge quantities and speeds, while the computing resources of the cloud center are limited and the network delay increases. A reasonable scheduling algorithm can reduce the communication delay and make better use of the available computing, storage and network resources in the cloud. An efficient scheduling algorithm is the "brain" of the cloud center. The embodiments of the present application introduce reinforcement learning and policy gradient learning, which can adapt to various complex cloud environments, achieve significant efficiency in several key indicators such as energy, response time, migration time and cost, and provide a new idea for resource scheduling in the cloud. The cost of cloud augmented reality (AR) services is high, requiring intensive computing services and requiring low latency. If too much computing power is provided, it will cause costs to the cloud service provider; if all the computing power is placed in the cloud service center, it will cause a high latency of the service. Therefore, the embodiments of the present application solve the high cost problem of AR live broadcast by providing a dynamic scheduling method based on a random edge cloud computing environment, improve resource utilization, reduce response time, and provide users with higher quality services.
[0090] In order to implement the task scheduling method of the embodiment of the present application, the embodiment of the present application also provides a task scheduling device, Figure 4 Schematic diagram of the structure of the task scheduling device according to the embodiment of the present application. Figure 4 As shown, the task scheduling device includes:
[0091] The load acquisition module 401 is used to acquire a plurality of first tasks to be scheduled in the current scheduling cycle, and determine a first workload required for each first task to be scheduled to be executed on the device to be allocated;
[0092] The parameter acquisition module 402 is used to acquire the first state parameter of the device to be allocated;
[0093] The scheduling module 403 is used to schedule the first task scheduling model, process the first workloads of the plurality of first tasks to be scheduled and the first state parameters of the plurality of devices to be assigned, and obtain the first scheduling information of each first task to be scheduled for each device to be assigned; wherein the first task scheduling model is trained based on the second state parameters of the plurality of devices to be assigned in the previous scheduling cycle and the second workloads of the plurality of second tasks to be scheduled;
[0094] The target device determining module 404 is used to determine a target device for executing each first task to be scheduled from a plurality of devices to be assigned based on the first scheduling information of each first task to be scheduled for each device to be assigned.
[0095] In one embodiment, the plurality of first tasks to be scheduled include new tasks received in the current scheduling cycle, and old tasks among the plurality of second tasks to be scheduled that were not completed in the previous scheduling cycle. The target device determination module 404 is also used to determine, for each first task to be scheduled, when the first task to be scheduled is an old task, the target device for executing the first task to be scheduled from the plurality of devices to be assigned based on the task type of the first task to be scheduled and the first scheduling information of the first task to be scheduled for each device to be assigned; when the first task to be scheduled is a new task, the target device is determined from the plurality of devices to be assigned based on the first workload of the first task to be scheduled, the first state parameters of the plurality of devices to be assigned, and the first scheduling information of the first task to be scheduled for each device to be assigned.
[0096] In one embodiment, the target device determination module 404 is also used to determine the target device from multiple devices to be allocated based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be allocated, and the first scheduling information of the first task to be scheduled for each device to be allocated when the task type is a migratable task; when the task type is a non-migratable task, the device to be allocated to which the first task to be scheduled was scheduled in the previous scheduling cycle is determined as the target device.
[0097] In one embodiment, the target device determination module 404 is further used to screen out one or more candidate devices from multiple devices to be allocated, wherein the first state parameter of the candidate device matches the first workload; and determine the candidate device with the maximum first scheduling information as the target device.
[0098] In one embodiment, the task scheduling device also includes a model updating module, which is used to determine the first loss value based on the second state parameters of multiple devices to be assigned and the second workload of multiple second tasks to be scheduled; determine the second loss value based on the second scheduling information of each second task to be scheduled for each device to be assigned; wherein the second scheduling information is the second task scheduling model of the previous scheduling cycle, which is obtained by processing the second workload of multiple second tasks to be scheduled and the second state parameters of multiple devices to be assigned; calculate the first loss value and the second loss value to obtain the model loss value; based on the model loss value, update the second task scheduling model to obtain the first task scheduling model.
[0099] In one embodiment, the model updating module is also used to determine, for each second task to be scheduled, a first device planned to execute the second task to be scheduled from multiple devices to be assigned based on the second workload of the second task to be scheduled, the second state parameters of multiple devices to be assigned, and the second scheduling information of the second task to be scheduled for each device to be assigned; when the task type of the second task to be scheduled is a non-migratable task, and the device to be assigned to which the second task to be scheduled is actually scheduled is different from the first device, determine the second task to be scheduled as a third task to be scheduled; determine a first ratio of the first number of third tasks to be scheduled to the total number of multiple second tasks to be scheduled; for each second task to be scheduled, determine the second number of second devices corresponding to the second task to be scheduled, wherein the second device is one or more devices to be assigned among the multiple devices to be assigned, and the second scheduling information of the second task to be scheduled for the second device is greater than the second scheduling information of the second task to be scheduled for the first device; determine a second loss value based on the first ratio and the second numbers corresponding to the multiple second tasks to be scheduled.
[0100] In one embodiment, the model update module is also used to schedule each first task scheduling model, predict the first workloads of multiple first tasks to be scheduled and the first state parameters of multiple devices to be allocated, and obtain the third loss value of each first task scheduling model in the next scheduling cycle; obtain the fourth loss value of each second task scheduling model, the fourth loss value is used to schedule the second task scheduling model, predict the second workloads of multiple second tasks to be scheduled and the second state parameters of multiple devices to be allocated, and obtain the loss value of the second task scheduling model in the current scheduling cycle; based on the model loss value, the third loss value and the fourth loss value, update each second task scheduling model to obtain the corresponding first task scheduling model.
[0101] In actual application, the load acquisition module 401, the parameter acquisition module 402, the scheduling module 403, the target device determination module 404 and the model updating module can be implemented by a processor in the task scheduling device.
[0102] It should be noted that: the task scheduling device provided in the above embodiment only uses the division of the above program modules as an example when performing task scheduling. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the task scheduling device provided in the above embodiment and the task scheduling method embodiment belong to the same concept. The specific implementation process is detailed in the task scheduling method embodiment, which will not be repeated here.
[0103] Based on the hardware implementation of the above program modules, and in order to implement a task scheduling method provided in an embodiment of the present application, an embodiment of the present application further provides an electronic device, such as Figure 5 As shown, the electronic device 500 includes:
[0104] Communication interface 501, capable of exchanging information with other network nodes;
[0105] The processor 502 is connected to the communication interface 501 to implement information exchange with other network nodes, and is used to execute the method provided by one or more technical solutions when running a computer program. The computer program is stored in the memory 503.
[0106] Specifically, the processor 502 is used to obtain multiple first tasks to be scheduled in the current scheduling cycle, and determine the first workload required for each first task to be scheduled to be executed on the device to be assigned; obtain the first state parameters of the device to be assigned; schedule the first task scheduling model, process the first workloads of the multiple first tasks to be scheduled and the first state parameters of the multiple devices to be assigned, and obtain the first scheduling information of each first task to be scheduled for each device to be assigned; wherein the first task scheduling model is trained based on the second state parameters of the multiple devices to be assigned in the previous scheduling cycle, and the second workloads of the multiple second tasks to be scheduled; based on the first scheduling information of each first task to be scheduled for each device to be assigned, determine the target device to execute each first task to be scheduled from the multiple devices to be assigned.
[0107] In one embodiment, the processor 502 is also used to determine, for each first task to be scheduled, a target device for executing the first task to be scheduled from multiple devices to be assigned based on the task type of the first task to be scheduled and the first scheduling information of the first task to be scheduled for each device to be assigned for each first task to be scheduled when the first task to be scheduled is an old task; and to determine, when the first task to be scheduled is a new task, a target device for executing the first task to be scheduled from multiple devices to be assigned based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be assigned and the first scheduling information of the first task to be scheduled for each device to be assigned.
[0108] In one embodiment, the processor 502 is also used to determine a target device from multiple devices to be allocated based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be allocated, and the first scheduling information of the first task to be scheduled for each device to be allocated when the task type is a migratable task; when the task type is a non-migratable task, the device to be allocated to which the first task to be scheduled was scheduled in the previous scheduling cycle is determined as the target device.
[0109] In one embodiment, the processor 502 is further used to screen out one or more candidate devices from a plurality of devices to be allocated, wherein the first state parameter of the candidate device matches the first workload; and determine the candidate device with the maximum first scheduling information as the target device.
[0110] In one embodiment, the processor 502 is also used to determine the first loss value based on the second state parameters of multiple devices to be assigned and the second workload of multiple second tasks to be scheduled; determine the second loss value based on the second scheduling information of each second task to be scheduled for each device to be assigned; wherein the second scheduling information is the second task scheduling model of the previous scheduling cycle, which is obtained by processing the second workload of multiple second tasks to be scheduled and the second state parameters of multiple devices to be assigned; calculate the first loss value and the second loss value to obtain the model loss value; based on the model loss value, update the second task scheduling model to obtain the first task scheduling model.
[0111] In one embodiment, the processor 502 is also used to determine, for each second task to be scheduled, a first device planned to execute the second task to be scheduled from multiple devices to be assigned based on the second workload of the second task to be scheduled, the second state parameters of multiple devices to be assigned, and the second scheduling information of the second task to be scheduled for each device to be assigned; when the task type of the second task to be scheduled is a non-migratable task, and the device to be assigned to which the second task to be scheduled is actually scheduled is different from the first device, determine the second task to be scheduled as a third task to be scheduled; determine a first ratio of the first number of third tasks to be scheduled to the total number of multiple second tasks to be scheduled; for each second task to be scheduled, determine the second number of second devices corresponding to the second task to be scheduled, wherein the second device is one or more devices to be assigned among the multiple devices to be assigned, and the second scheduling information of the second task to be scheduled for the second device is greater than the second scheduling information of the second task to be scheduled for the first device; determine a second loss value based on the first ratio and the second numbers corresponding to the multiple second tasks to be scheduled.
[0112] In one embodiment, the processor 502 is also used to schedule each first task scheduling model, predict the first workloads of multiple first tasks to be scheduled and the first state parameters of multiple devices to be allocated, and obtain the third loss value of each first task scheduling model in the next scheduling cycle; obtain the fourth loss value of each second task scheduling model, the fourth loss value is used to schedule the second task scheduling model, predict the second workloads of multiple second tasks to be scheduled and the second state parameters of multiple devices to be allocated, and obtain the loss value of the second task scheduling model in the current scheduling cycle; based on the model loss value, the third loss value and the fourth loss value, update each second task scheduling model to obtain the corresponding first task scheduling model.
[0113] It should be noted that the specific processing process of the processor 502 can be understood by referring to the above method.
[0114] Of course, in actual application, the various components in the electronic device 500 are coupled together through the bus system 504. It is understandable that the bus system 504 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 504 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 5 Various buses are labeled as bus system 504 .
[0115] The memory 503 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device 500. Examples of such data include: any computer program used to operate on the electronic device 500.
[0116] The method disclosed in the above embodiment of the present application can be applied to the processor 502, or implemented by the processor 502. The processor 502 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor 502 or an instruction in the form of software. The above-mentioned processor 502 may be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 502 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 503, and the processor 502 reads the information in the memory 503 and completes the steps of the above method in combination with its hardware.
[0117] In an exemplary embodiment, the electronic device 500 can be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), field programmable gate array (FPGA), general processor, controller, microcontroller (MCU), microprocessor, or other electronic components to execute the aforementioned method.
[0118] It can be understood that the memory 503 of the embodiment of the present application can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAMbus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 703 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memories.
[0119] In an exemplary embodiment, the embodiment of the present application further provides an electronic device, including a processor and a memory for storing a computer program that can be run on the processor, wherein the processor is used to execute the steps of any of the above methods when running the computer program.
[0120] The embodiment of the present application further provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, including a memory 503 storing a computer program, and the computer program can be executed by a processor 502 of an electronic device 500 to complete the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.
[0121] An embodiment of the present application also provides a computer program product, including a computer program, which implements the steps of any of the above methods when executed by a processor.
[0122] It should be noted that: "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. The term "and / or" herein is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "one or more" herein represents any combination of at least two of any one or more of a plurality of items. For example, including one or more of A, B, and C can represent including any one or at least two or more elements selected from the set consisting of A, B, and C.
[0123] In addition, the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.
[0124] 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.
Claims
1. A task scheduling method, characterized in that: The method comprises: Acquire a plurality of first tasks to be scheduled in a current scheduling cycle, and determine a first workload required for each of the first tasks to be scheduled to be executed on a device to be allocated; Acquire a first state parameter of the device to be allocated; Scheduling a first task scheduling model, processing the first workloads of the plurality of first tasks to be scheduled and the first state parameters of the plurality of devices to be allocated, and obtaining first scheduling information of each of the first tasks to be scheduled for each of the devices to be allocated; The first task scheduling model is obtained by training based on the second state parameters of the plurality of devices to be assigned in the last scheduling cycle and the second workloads of the plurality of second tasks to be scheduled; Based on the first scheduling information of each of the first tasks to be scheduled for each of the devices to be assigned, a target device for executing each of the first tasks to be scheduled is determined from the multiple devices to be assigned.
2. The method according to claim 1, characterized in that The plurality of first tasks to be scheduled include new tasks received in the current scheduling period, and old tasks among the plurality of second tasks to be scheduled that were not completed in the previous scheduling period; The step of determining a target device for executing each of the first tasks to be scheduled from the plurality of devices to be assigned based on the first scheduling information of each of the first tasks to be scheduled for each of the devices to be assigned comprises: For each of the first tasks to be scheduled, when the first tasks to be scheduled are the old tasks, based on the task type of the first tasks to be scheduled and the first scheduling information of the first tasks to be scheduled for each of the devices to be allocated, determining a target device for executing the first tasks to be scheduled from the multiple devices to be allocated; When the first task to be scheduled is the new task, the target device is determined from the multiple devices to be assigned based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be assigned, and the first scheduling information of the first task to be scheduled for each of the devices to be assigned.
3. The method according to claim 2, characterized in that The determining, from the plurality of devices to be allocated, a target device for executing the first task to be scheduled based on the task type of the first task to be scheduled and the first scheduling information of the first task to be scheduled for each device to be allocated, comprises: When the task type is a migratable task, determining the target device from the multiple devices to be allocated based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be allocated, and the first scheduling information of the first task to be scheduled for each of the devices to be allocated; When the task type is a non-migratable task, the device to be allocated to which the first task to be scheduled was scheduled in the last scheduling cycle is determined as the target device.
4. The method according to claim 2 or 3, characterized in that: The determining the target device from the multiple devices to be allocated based on the first workload of the first task to be scheduled, the first state parameters of the multiple devices to be allocated, and the first scheduling information of the first task to be scheduled for each of the devices to be allocated, comprises: Filtering one or more candidate devices from the multiple devices to be allocated, wherein a first state parameter of the candidate device matches the first workload; A candidate device having the largest first scheduling information is determined as the target device.
5. The method according to claim 1, characterized in that The method further comprises: Determining a first loss value based on second state parameters of the plurality of devices to be allocated and second workloads of the plurality of second tasks to be scheduled; Determine a second loss value based on second scheduling information of each of the second tasks to be scheduled for each of the devices to be allocated; wherein the second scheduling information is a second task scheduling model for scheduling the previous scheduling period, obtained by processing the second workloads of the plurality of second tasks to be scheduled and the second state parameters of the plurality of devices to be allocated; Calculating the first loss value and the second loss value to obtain a model loss value; Based on the model loss value, the second task scheduling model is updated to obtain the first task scheduling model.
6. The method according to claim 5, characterized in that The determining the second loss value based on the second scheduling information of each of the second tasks to be scheduled for each of the devices to be allocated comprises: For each of the second tasks to be scheduled, based on the second workload of the second tasks to be scheduled, the second state parameters of the plurality of devices to be assigned, and the second scheduling information of the second tasks to be scheduled for each of the devices to be assigned, determining a first device that is planned to execute the second tasks to be scheduled from the plurality of devices to be assigned; When the task type of the second task to be scheduled is a non-migratable task, and the device to be assigned to which the second task to be scheduled is actually scheduled is different from the first device, determining the second task to be scheduled as the third task to be scheduled; Determine a first ratio of a first number of the third tasks to be scheduled to a total number of the plurality of second tasks to be scheduled; For each of the second tasks to be scheduled, determine a second number of second devices corresponding to the second tasks to be scheduled, wherein the second devices are one or more devices to be allocated among the multiple devices to be allocated, and the second scheduling information of the second tasks to be scheduled for the second devices is greater than the second scheduling information of the second tasks to be scheduled for the first devices; The second loss value is determined based on the first ratio and a second number corresponding to a plurality of second scheduling tasks.
7. The method according to claim 5 or 6, characterized in that: One device to be assigned corresponds to a first task scheduling model and a second task scheduling model. The second task scheduling model is updated based on the model loss value to obtain the first task scheduling model, including: Scheduling each of the first task scheduling models, predicting the first workloads of the plurality of first tasks to be scheduled and the first state parameters of the plurality of devices to be allocated, and obtaining a third loss value of each of the first task scheduling models in the next scheduling cycle; Obtaining a fourth loss value of each second task scheduling model, wherein the fourth loss value is a loss value of the second task scheduling model in the current scheduling period obtained by scheduling the second task scheduling model, predicting the second workloads of the plurality of second tasks to be scheduled and the second state parameters of the plurality of devices to be allocated; Based on the model loss value, the third loss value and the fourth loss value, each of the second task scheduling models is updated to obtain a corresponding first task scheduling model.
8. A task scheduling device, characterized in that: include: A load acquisition module, used to acquire a plurality of first tasks to be scheduled in a current scheduling cycle, and determine a first workload required for each of the first tasks to be scheduled to be executed on a device to be allocated; A parameter acquisition module, used to acquire a first state parameter of the device to be allocated; A scheduling module, used for scheduling a first task scheduling model, processing the first workloads of the plurality of first tasks to be scheduled and the first state parameters of the plurality of devices to be assigned, and obtaining first scheduling information of each of the first tasks to be scheduled for each of the devices to be assigned; wherein the first task scheduling model is trained based on the second state parameters of the plurality of devices to be assigned in the previous scheduling cycle and the second workloads of the plurality of second tasks to be scheduled; The target device determining module is used to determine a target device for executing each of the first tasks to be scheduled from the multiple devices to be assigned based on the first scheduling information of each of the first tasks to be scheduled for each of the devices to be assigned.
9. An electronic device, characterized in that: The method comprises a processor and a memory for storing a computer program that can be run on the processor, wherein the processor is used to execute the steps of the method according to any one of claims 1 to 7 when running the computer program.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that The computer program implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Cited By
Task migration method, system and device and storage medium
CN121411987A
Task migration method, system, device and storage medium
CN121411987B