Job scheduling method and device
By building matching pairs in Hadoop and using fully connected neural networks and attention mechanisms to allocate resources, combined with reinforcement learning optimization scheduling strategies, the lack of resource management and allocation of Hadoop scheduling framework is solved, and efficient job scheduling is achieved.
Patent Information
- Application Number
- CN202411739962.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-18
AI Technical Summary
The existing Hadoop scheduling framework has shortcomings in resource management and allocation, and it is unable to efficiently implement job scheduling, resulting in low job processing efficiency.
By forming a matching pair with Hadoop nodes, the fully connected neural network and attention mechanism are used to obtain the adaptability value of each match pair, select the matching pair with the highest adaptability value for resource allocation, and optimize the scheduling strategy through reinforcement learning.
It effectively reduces the average completion time and average waiting time of calculation jobs, improves the efficiency of job scheduling, reduces the amount and time of data transmission, and does not require manual adjustment of parameters.
Smart Images

Figure CN119645601A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method and device for job scheduling. Background Art
[0002] Hadoop is a distributed big data platform mainly used for the storage and processing of big data. The computing jobs are mainly in the form of jobs, so the scheduling of jobs, that is, resource allocation, is crucial. Hadoop usually uses its own scheduling framework to schedule jobs, but this method is relatively limited and many parameters need to be adjusted manually.
[0003] In the prior art, there is a job flow scheduling method using deep reinforcement learning, which can simultaneously consider the dependencies of jobs and the dynamic situation of cluster resources, and adjust the scheduling decision according to the dynamic situation. However, this method requires a lot of training and the data transmission time is also long, so the job processing efficiency is low. Therefore, there is an urgent need for a resource scheduling method to realize job scheduling conveniently and efficiently. Summary of the invention
[0004] Based on the above problems, the present application provides a method and device for job scheduling, so as to provide a resource scheduling method to conveniently and efficiently implement job scheduling.
[0005] The present application discloses a method for job scheduling, the method comprising:
[0006] The jobs waiting in the queue are matched with the nodes of Hadoop, and each matching pair is formed into a set; the length of the set is variable;
[0007] Inputting the matching pairs in the set into a fully connected neural network in batches, and obtaining the fitness value of each matching pair through forward propagation of the fully connected neural network;
[0008] Obtaining a matching pair with the highest fitness value as an assignment pair, and assigning jobs in the assignment pair to nodes in the assignment pair;
[0009] The jobs in the matching pairs except the assigned pair are returned to the queue, and the process of forming matching pairs is repeated until there are no waiting jobs in the queue.
[0010] Optionally, matching the jobs waiting in the queue with the nodes of Hadoop comprises:
[0011] Obtaining the demand parameters of the first job among the jobs, and obtaining the available resource parameters of the first node among the nodes; the parameters include quantity and type;
[0012] When the quantity of available resources is greater than or equal to the required quantity, and the type of available resources is the same as the required type, the first job and the first node form a matching pair.
[0013] Optionally, the step of batch-inputting the matching pairs in the set into a fully connected neural network includes:
[0014] The hidden layer of the fully connected neural network extracts features from the matching pairs and assigns dynamic weights according to the importance of the features through an attention mechanism.
[0015] Optionally, obtaining the fitness value of each matching pair through forward propagation of the fully connected neural network includes:
[0016] The fully connected neural network determines whether the job in the matching pair is local;
[0017] The adaptability value is obtained in combination with the judgment result; the adaptability value of the matching pair whose operation is not local is lower than the adaptability value of the matching pair whose operation is local.
[0018] Optionally, a reinforcement learning model is integrated into the fully connected neural network, the agents form a matching pair in each time step, the agents form a set in a matching step, and after the jobs in the assignment pair are assigned to the nodes in the assignment pair, the method further includes:
[0019] Based on the fitness value, reward the agent for its work in each time step;
[0020] The agent is trained to maximize the cumulative reward obtained by the agent in each matching step.
[0021] Based on the above-mentioned method for job scheduling, the present application also discloses a device for job scheduling, including: a collection unit, an input unit, an allocation unit, and a repetition unit;
[0022] The collection unit is used to form matching pairs between the jobs waiting in the queue and the nodes of Hadoop, and each matching pair is formed into a collection; the length of the collection is variable;
[0023] The input unit is used to input the matching pairs in the set into a fully connected neural network in batches, and obtain the fitness value of each matching pair through forward propagation of the fully connected neural network;
[0024] The allocation unit is used to obtain a matching pair with the highest adaptability value as an allocation pair, and allocate the jobs in the allocation pair to the nodes in the allocation pair;
[0025] The repeating unit is used to return the jobs in the matching pair except the assigned pair to the queue, and repeat the process of forming the matching pair until there are no waiting jobs in the queue.
[0026] Optionally, the collection unit includes:
[0027] A parameter subunit, used to obtain a demand parameter of a first job among the jobs, and obtain an available resource parameter of a first node among the nodes; the parameters include quantity and type;
[0028] The matching subunit is configured to form a matching pair between the first job and the first node when the quantity of available resources is greater than or equal to the required quantity and the type of available resources is the same as the required type.
[0029] Optionally, the input unit includes:
[0030] A weight subunit is used in the hidden layer of the fully connected neural network to extract features from the matching pairs, and to assign dynamic weights according to the importance of the features through an attention mechanism.
[0031] Optionally, the input unit includes:
[0032] A judgment subunit, used for the fully connected neural network to judge whether the job in the matching pair is local;
[0033] The adaptability subunit is used to obtain the adaptability value in combination with the judgment result; the adaptability value of the matching pair whose operation is not local is lower than the adaptability value of the matching pair whose operation is local.
[0034] Optionally, a reinforcement learning model is integrated into the fully connected neural network, the agents form a matching pair in each time step, the agents form a set in a matching step, and the device further comprises:
[0035] A reward unit, configured to reward the agent for its work in each time step based on the adaptability value;
[0036] A training unit is used to train the intelligent agent so as to maximize the cumulative reward obtained by the intelligent agent in each matching step.
[0037] The present application discloses a method and device for job scheduling. The jobs waiting in the queue are matched with the nodes of Hadoop to reduce the average completion time and average waiting time of the computing jobs. Each matching pair is formed into a set of variable length, and the matching pairs in the set are batch-input into a fully connected neural network, and the fitness value of each matching pair is obtained through its forward propagation. The matching pair with the highest fitness value is obtained as an allocation pair, and the jobs in the allocation pair are allocated to the nodes in the allocation pair. The jobs in the matching pairs other than the allocation pair are returned to the queue to reduce the data transmission volume and shorten the data transmission time. The process of forming matching pairs is repeated to autonomously optimize the resource allocation of jobs and nodes without manually adjusting parameters until there are no waiting jobs in the queue, thereby realizing job scheduling conveniently and efficiently. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0039] Figure 1 A flowchart of a method for job scheduling disclosed in an embodiment of the present application;
[0040] Figure 2 A flowchart of another method for job scheduling disclosed in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of the structure of a job scheduling device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0042] Before elaborating on the contents of this application, we first briefly introduce the professional terms involved to ensure consistency and accuracy of understanding.
[0043] As a distributed big data architecture, Hadoop has the characteristics of high fault tolerance, low cost and high scalability. It allows the use of multiple cheap single servers to build a distributed system, so it is favored by many. Although the big data distributed computing framework provided by Hadoop can efficiently handle large-scale operations, its own scheduling framework has shortcomings in resource management and allocation. The three resource scheduling methods of this framework have their own advantages and disadvantages. For example, the first-in-first-out strategy is easy to understand, but it cannot make full use of resources and is not friendly to short jobs. More importantly, these three scheduling methods do not take into account the locality of data. When the local machine lacks the required data, that is, the data required by the job is not stored in its assigned node, it takes extra time to transmit, thereby extending the computing time.
[0044] As a model architecture in the field of deep learning, the fully connected neural network can be traced back to the concept of bionics and belongs to the broad category of machine learning. Deep learning technology aims to enable machines to simulate human thinking patterns and realize autonomous analysis and feature recognition of things by analyzing the potential laws in sample data provided by humans. The main application areas of this technology include speech, image and text recognition.
[0045] The attention mechanism simulates the characteristics of the human visual system. Although our field of vision is broad, the focus of our attention is relatively narrow. The core function of this mechanism is to help people accurately lock in the most valuable or helpful information in a large amount of information. Its essential goal is to filter out the information that is crucial to the current task from the complex information flow and pay more attention to it. In the field of natural language processing, the attention mechanism has been widely used. Taking machine translation under the Encoder-Decoder framework as an example, the Encoder part usually adopts the RNN model to parse the content to be translated into an input sequence and further compile it into a semantic code C. Subsequently, the Decoder part converts it into the content of the target language based on this semantic code C. When the Attention mechanism is introduced, the allocation of the semantic code C becomes more flexible and accurate. The mechanism assigns different semantic codes C to each input information, which actually tells the system which input information is more important or relevant. In other words, the Attention mechanism clarifies the importance of different inputs by assigning different weights to them. Therefore, for other types of models, the main purpose of introducing the attention mechanism is to make key information more prominent and guide the model to pay more attention to information with higher value. In this way, the performance and effect of the model can be significantly improved.
[0046] The bin packing problem is a complex discrete combinatorial optimization problem. In short, combinatorial optimization is the process of searching for solutions that meet specific conditions and make the objective function achieve the optimal value (maximum or minimum) in a discrete, finite mathematical structure space. Such problems often have distinct characteristics, including the existence of many local extreme points, non-differentiability, discontinuity, multi-dimensionality, constraints, and high nonlinearity, and most of them belong to the category of NP-complete problems. The bin packing problem also has these characteristics. It is classified as an NP-HARD (Nondeterministic Polynomial-time hard) problem together with many other combinatorial optimization problems, such as the traveling salesman problem and the graph partitioning problem. In the classic bin packing problem, the goal is to pack a certain number of items into several boxes of the same capacity, requiring that the total volume of the items in each box does not exceed its capacity limit, and strive to use the least number of boxes. The core essence of the resource scheduling problem can be regarded as the bin packing problem. Traditional bin packing problems are mainly solved by heuristic methods, but such methods are easily limited to local optimal solutions and it is difficult to achieve ideal packing results.
[0047] This application is dedicated to solving the problem of job completion time in the Hadoop resource scheduling framework. A resource scheduling model that can effectively reduce the average completion time and average waiting time of computing jobs is proposed through the following comprehensive methods: first, an accurate mathematical modeling of the scheduling problem is performed; second, a suitable fully connected neural network is constructed and integrated with the attention mechanism to obtain better representation information and improve the accuracy of resource scheduling prediction; finally, a reinforcement learning model is used to provide feedback and optimize the scheduling strategy after the representation information is successfully extracted.
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] Embodiment 1: This application discloses a method for job scheduling.
[0050] For details, please refer to Figure 1 A method for job scheduling disclosed in this embodiment includes the following steps:
[0051] Step 101: The jobs waiting in the queue are matched with the nodes of Hadoop, and each matching pair is formed into a set.
[0052] In the method described in this embodiment, the demand parameters of the first job in the job are first obtained, and the available resource parameters of the first node in the node are obtained. These parameters can include information such as quantity and type. As an optional method, the resource types that need to be considered in resource scheduling on the Hadoop cluster include CPU, memory, hard disk, bandwidth, etc. For example, the demand parameter vector of job i can be expressed as r i =(r i,1 ,...,r i,d ) represents the set of resources that a job needs to occupy, where d represents the type of resource. The duration that job i occupies resources is T i , which means that if job i is scheduled to a node for computation, it will need to occupy resource r i The total duration is T i , the duration of resource occupation is related to the fitness value obtained in the subsequent steps. The available resource parameter vector of node j in the cluster can be expressed as a j =(a j,1 ,...,a j,d )express.
[0053] In the method described in this embodiment, when the number of available resources is greater than or equal to the required number, and the type of available resources is the same as the required type, the first job and the first node are matched. As an optional method, it can be expressed by the following formula:
[0054]
[0055] In the Hadoop scheduling framework, usually only two types of resources are considered, namely CPU and memory, so d can take the value of 2.
[0056] In the method described in this embodiment, only jobs and nodes that satisfy formula (1) can form a matching pair, that is, the node has the right to execute the job. All jobs and nodes are matched into pairs to form a set. As time goes by, new jobs may enter the queue, so this is a set of variable length.
[0057] Step 102: Input the matching pairs in the set into a fully connected neural network in batches, and obtain the fitness value of each matching pair through forward propagation of the fully connected neural network.
[0058] In the method described in this embodiment, a fully connected neural network is first constructed, which may be composed of an input layer, three hidden layers, and an output layer. As an optional method, each matching pair of a set of variable lengths is passed through the network in batches, and the fitness value between the node and the job is quickly calculated through the forward propagation of the network.
[0059] In the network, the input layer is responsible for receiving input data. Considering that the input data is a variable-length pair, in practical applications, new jobs will arrive at the server at any time, and the number of jobs will change with the ongoing scheduling. In the method described in this embodiment, the input dimension of the network can be 6, corresponding to the available CPU and memory of the node in Hadoop, the CPU and memory requirements of the job, the duration of the job, and whether the data of the job is local to the node.
[0060] As an optional method, the locality of data will affect the execution time of the job. Whether the data of the job is local to the node is determined based on the job's requirement parameters and the matching nodes. The fully connected neural network determines whether the job in the matching pair is local, and obtains the adaptability value based on the judgment result. The adaptability value of the matching pair where the job is not local is lower than the adaptability value of the matching pair where the job is local. For example, when the data of the job is local, it can be assigned a value of 1, otherwise it can be assigned a value of 0.
[0061] Each of the three hidden layers in the network consists of a certain number of neurons. The number of these neurons can be adjusted according to the complexity of the problem and the size of the data. The main function of the hidden layer is to extract the features of the input data and map these features to the output layer through nonlinear transformation.
[0062] The output layer in the network is responsible for generating the final output of the network. The number of nodes in the output layer depends on the specific job scheduling target (for example, it may be the system performance index after scheduling, the job completion time, etc.). As an optional method, the fully connected neural network constructed in this embodiment can be specifically as follows:
[0063] Table 1 Neural network design table
[0064] Layer Type Input Shape Activation Function Input Layer (None,6) none Hidden layer 1 (None,3) tanh Hidden Layer 2 (None,9) tanh Hidden layer 3 (None,6) tanh Output Layer (None,1) none
[0065] In the table, (None,6) indicates that the input data accepted by the input layer has 6 features, and None indicates that any number of samples can be processed. tanh is the hyperbolic tangent function, a commonly used activation function, whose output value is between -1 and 1.
[0066] In the method described in this embodiment, in order to improve the quality of representation information and the accuracy of resource scheduling prediction, the hidden layer of the fully connected neural network extracts features from matching pairs and assigns dynamic weights according to the importance of the features through the attention mechanism. This is intended to strengthen the mapping of significant features while suppressing insignificant features, thereby enhancing the effect of representation extraction. In this way, the network can extract representations more effectively, ensuring that more accurate adaptability data between jobs and nodes can be output at the output layer.
[0067] As an optional method, in the first hidden layer, the 6 input features are represented and extracted and converted into 3 new features. In this process, the attention mechanism plays a vital role. It dynamically assigns weights to the 3 new features according to the importance of the features. Important features are given higher weights, while relatively unimportant features are given lower weights to highlight key information. Subsequently, the weighted features are passed to the next hidden layer and continue to undergo a similar weight assignment and representation extraction process. This process progresses layer by layer in the network until it finally reaches the output layer, and the network outputs the fitness values of the jobs and nodes.
[0068] In the method described in this embodiment, in the reinforcement learning framework to be introduced in step 103, the agent will continuously optimize the scheduling strategy during the interaction with the environment. In this process, the attention mechanism will dynamically adjust the weight distribution as needed to further optimize the representation extraction, thereby ensuring that the fully connected neural network can continue to provide high-quality prediction and decision support.
[0069] Step 103: Obtain a matching pair with the highest adaptability value as an allocation pair, and allocate the jobs in the allocation pair to the nodes in the allocation pair.
[0070] In the method described in this embodiment, after the representation extraction of the fully connected neural network, a reinforcement learning model needs to be constructed. Using deep reinforcement learning to continuously and autonomously learn scheduling strategies can maximize the number of scheduled jobs and minimize the completion time of jobs.
[0071] As an optional method, the state space of the reinforcement learning in this embodiment is a set of variable length. Before each scheduling, the agent can obtain a suitable set based on the available resources of each node in the computing cluster and the resource requirements of each job. At a certain moment, there are N pending jobs and M nodes in the cluster, and the agent can schedule any subset of jobs to any subset of nodes. The size of the action space of the reinforcement learning in this embodiment is (M+1)×N (1 means that the agent decides not to schedule this job to any node). The huge action space makes the learning of the agent extremely difficult. By the agent performing multiple scheduling actions in sequence at each matching step, the action space can be linearly related to the length of the set, that is, the size of the action space is M×N. After obtaining the adaptability of all pairs in the list, the one with the highest adaptability is scheduled, and the job is assigned to this node for calculation and resource allocation.
[0072] Step 104: Return the jobs in the matching pairs except the assigned pair to the queue, and repeat the process of forming matching pairs until there are no waiting jobs in the queue.
[0073] In the method described in this embodiment, time is not accumulated at each matching step, and the agent continuously performs scheduling until the set is empty, and finally performs an empty action to indicate the end of the matching step and give the agent a reward. Subsequently, the agent makes a new scheduling decision in the next matching step.
[0074] In the method described in this embodiment, the agents in the reinforcement learning model form a matching pair in each time step and form a set in a matching step. In order to enable the agent to learn more effectively and optimize the scheduling strategy, it is necessary to design a reasonable reward signal to guide the learning process of the agent. Based on the adaptability value, the agent is rewarded for its work in each time step, so as to train the agent and maximize the cumulative reward obtained by the agent in each matching step. As an optional method, minimizing the completion time of the job is taken as the goal, and a reward is given to the agent in each time step until all jobs are scheduled and completed. The agent will try to maximize the cumulative reward, thereby achieving the optimization goal of minimizing the completion time of the job.
[0075] As a training example to simulate the actual situation, in each matching step, a certain number of jobs arrive at the server at different times, and the agent makes scheduling decisions in turn. When all jobs are scheduled, this matching step ends. In a matching step, the environment state, action, and reward perceived by the agent form a trajectory, which is represented as [S1, a1, r1, ..., S L , a L , r L ], where L is the number of schedules made by the agent.
[0076] In order to train the scheduling strategy, a large amount of training data is required. The training data can come from the historical data of the computing job. A large number of job sequences are generated based on this data, and the model is trained on each sequence for multiple iterations. In each iteration, N simulations are performed to obtain N trajectories. The benchmark is calculated using the N trajectories of one iteration. The benchmark value of the decision is the average of the cumulative rewards in these N different trajectories. For the cumulative rewards of trajectories of different lengths, 0 is filled after the shorter trajectory.
[0077] Subsequently, you can verify whether the model training is complete by looking at the total execution time and total delayed execution time of the job. The total execution time is the time from the submission of the first job to the completion of the calculation of the last job, which can be expressed as follows:
[0078]
[0079] Where Makespan is the total execution time, n is the number of jobs, T start and T endThe start and end times respectively.
[0080] The total delayed execution time of the job can be expressed as follows:
[0081]
[0082] Where Slowdown is the total delayed execution time, T submit Represents the time when the job was submitted.
[0083] In the method described in this embodiment, if the total execution time and the total delayed execution time of the job are smaller, it proves that the model effect is better and the training is closer to completion.
[0084] As an optional method, the strategy of the agent to do work is defined as the probability distribution π(a|s), which represents the probability of the agent performing action a in state s. J(θ) is the expectation of the cumulative reward, which can be expressed as follows:
[0085]
[0086] In the formula, θ is the strategy parameter vector, that is, the probability distribution of taking a certain action under a given state, E is the expected value, τ is the trajectory experienced by the agent in a certain matching step, r is the demand parameter vector of the task, and p is θ (τ) is the probability of τ being generated, expressed as follows:
[0087]
[0088] Where a is the available resource parameter vector of the node, t is a matching step, and T is the total matching step.
[0089] r(τ) is the total reward generated along τ, which is expressed as follows:
[0090]
[0091] Formulas (4), (5), and (6) can be understood as the goal of reinforcement learning being the expectation of the total reward along a trajectory under the distribution of the trajectory. As an optional method, in order to perform gradient descent, it is necessary to calculate the gradient of J(θ). In practice, J(θ) is approximately equal to the average value of the Monte Carlo method on N trajectories. Since the variance of the policy gradient is large, a baseline method can be used to reduce the variance. In this embodiment, the mean is used as the baseline. The policy gradient can be expressed as follows:
[0092]
[0093] In the formula, is the policy gradient, i is the i-th job, γ is the discount factor, t' is a moment after t, and b t is the mean reward at time t.
[0094] Compared with the scheduling strategy of the Hadoop scheduling framework, the method described in this embodiment combines deep learning, reinforcement learning and attention mechanism, supports autonomous learning of suitable scheduling strategies, can improve the efficiency of scheduling, and reduce the total execution time of the job and the total delayed execution time of the job. First, deep learning and attention mechanism will characterize the resources required for each job. After multiple hidden layers, better representation data can be obtained, the mapping of significant features can be enhanced, and insignificant features can be suppressed. The effect of enhanced representation extraction can be achieved, so that the neural network can better extract the representation, thereby achieving the purpose of outputting more accurate adaptability values between jobs and nodes in the output layer. Secondly, in reinforcement learning, the intelligent agent constantly interacts with the environment to obtain different results. By rewarding and correcting the scheduling results, the intelligent agent learns to optimize the scheduling strategy and better completes the scheduling. And experiments show that the total execution time of the job can be reduced by 5%-10%, and the total delayed execution time of the job can be reduced by 2%-4%.
[0095] Embodiment 2: This application discloses another method for job scheduling, please refer to Figure 2 , the method described in this embodiment is aimed at.
[0096] Step 201: Obtain the jobs waiting in the queue, the job requirement parameters, and the available resource parameters of the node.
[0097] Step 202: The jobs and nodes are formed into matching pairs one by one, and multiple matching pairs are formed into a set.
[0098] Step 203: Obtain the fitness value of each matching pair in the set.
[0099] Step 204: Obtain the matching pair with the highest fitness value as the allocation pair, and allocate the job in the pair to the node in the pair.
[0100] Step 205: Split the remaining matching pairs and return the resulting jobs to the queue. Repeat step 201.
[0101] Based on the method for scheduling a job disclosed in the above embodiment, this embodiment correspondingly discloses a device for scheduling a job. Figure 3 , the device for job scheduling includes: a collection unit 301, an input unit 302, an allocation unit 303, and a repetition unit 304;
[0102] The collection unit 301 is used to form matching pairs between the jobs waiting in the queue and the nodes of Hadoop, and each matching pair is formed into a collection; the length of the collection is variable;
[0103] The input unit 302 is used to input the matching pairs in the set into a fully connected neural network in batches, and obtain the fitness value of each matching pair through forward propagation of the fully connected neural network;
[0104] The allocation unit 303 is used to obtain a matching pair with the highest adaptability value as an allocation pair, and allocate the jobs in the allocation pair to the nodes in the allocation pair;
[0105] The repeating unit 304 is used to return the jobs in the matching pair except the assigned pair to the queue, and repeat the process of forming matching pairs until there are no waiting jobs in the queue.
[0106] Optionally, the collection unit 301 includes:
[0107] A parameter subunit, used to obtain a demand parameter of a first job among the jobs, and obtain an available resource parameter of a first node among the nodes; the parameters include quantity and type;
[0108] The matching subunit is configured to form a matching pair between the first job and the first node when the quantity of available resources is greater than or equal to the required quantity and the type of available resources is the same as the required type.
[0109] Optionally, the input unit 302 includes:
[0110] A weight subunit is used in the hidden layer of the fully connected neural network to extract features from the matching pairs, and to assign dynamic weights according to the importance of the features through an attention mechanism.
[0111] Optionally, the input unit 302 includes:
[0112] A judgment subunit, used for the fully connected neural network to judge whether the job in the matching pair is local;
[0113] The adaptability subunit is used to obtain the adaptability value in combination with the judgment result; the adaptability value of the matching pair whose operation is not local is lower than the adaptability value of the matching pair whose operation is local.
[0114] Optionally, a reinforcement learning model is integrated into the fully connected neural network, the agents form a matching pair in each time step, the agents form a set in a matching step, and the device further comprises:
[0115] A reward unit, configured to reward the agent for its work in each time step based on the adaptability value;
[0116] A training unit is used to train the intelligent agent so as to maximize the cumulative reward obtained by the intelligent agent in each matching step.
[0117] The embodiments in this specification are described in a progressive manner. As for the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the methods.
[0118] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0119] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0120] The features described in the embodiments of this specification can be replaced or combined with each other, so that professional and technical personnel in this field can implement or use the present application.
[0121] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for job scheduling, characterized in that: include: The jobs waiting in the queue are matched with the nodes of Hadoop, and each matching pair is formed into a set; the length of the set is variable; Inputting the matching pairs in the set into a fully connected neural network in batches, and obtaining the fitness value of each matching pair through forward propagation of the fully connected neural network; Obtaining a matching pair with the highest fitness value as an assignment pair, and assigning jobs in the assignment pair to nodes in the assignment pair; The jobs in the matching pairs except the assigned pair are returned to the queue, and the process of forming matching pairs is repeated until there are no waiting jobs in the queue.
2. The method according to claim 1, characterized in that The matching pairs of the jobs waiting in the queue and the nodes of Hadoop are formed, including: Obtaining the demand parameters of the first job among the jobs, and obtaining the available resource parameters of the first node among the nodes; the parameters include quantity and type; When the quantity of available resources is greater than or equal to the required quantity, and the type of available resources is the same as the required type, the first job and the first node form a matching pair.
3. The method according to claim 1, characterized in that: The step of batch-inputting the matching pairs in the set into a fully connected neural network comprises: The hidden layer of the fully connected neural network extracts features from the matching pairs and assigns dynamic weights according to the importance of the features through an attention mechanism.
4. The method according to claim 1, characterized in that The obtaining of the fitness value of each matching pair by forward propagation of the fully connected neural network includes: The fully connected neural network determines whether the job in the matching pair is local; The adaptability value is obtained in combination with the judgment result; the adaptability value of the matching pair whose operation is not local is lower than the adaptability value of the matching pair whose operation is local.
5. The method according to claim 1, characterized in that The fully connected neural network incorporates a reinforcement learning model, the agents form a matching pair in each time step, the agents form a set in a matching step, and after the jobs in the assignment pair are assigned to the nodes in the assignment pair, the method further includes: Based on the fitness value, reward the agent for its work in each time step; The agent is trained to maximize the cumulative reward obtained by the agent in each matching step.
6. A device for job scheduling, characterized in that: include: Collection unit, input unit, allocation unit, repetition unit; The collection unit is used to form matching pairs between the jobs waiting in the queue and the nodes of Hadoop, and each matching pair is formed into a collection; the length of the collection is variable; The input unit is used to input the matching pairs in the set into a fully connected neural network in batches, and obtain the fitness value of each matching pair through forward propagation of the fully connected neural network; The allocation unit is used to obtain a matching pair with the highest adaptability value as an allocation pair, and allocate the jobs in the allocation pair to the nodes in the allocation pair; The repeating unit is used to return the jobs in the matching pair except the assigned pair to the queue, and repeat the process of forming the matching pair until there are no waiting jobs in the queue.
7. The device according to claim 6, characterized in that The assembly unit comprises: A parameter subunit, used to obtain a demand parameter of a first job among the jobs, and obtain an available resource parameter of a first node among the nodes; the parameters include quantity and type; The matching subunit is configured to form a matching pair between the first job and the first node when the quantity of available resources is greater than or equal to the quantity of required resources and the type of available resources is the same as the type of required resources.
8. The device according to claim 6, characterized in that The input unit comprises: A weight subunit is used in the hidden layer of the fully connected neural network to extract features from the matching pairs, and to assign dynamic weights according to the importance of the features through an attention mechanism.
9. The device according to claim 6, characterized in that The input unit comprises: A judgment subunit, used for the fully connected neural network to judge whether the job in the matching pair is local; The adaptability subunit is used to obtain the adaptability value in combination with the judgment result; the adaptability value of the matching pair whose operation is not local is lower than the adaptability value of the matching pair whose operation is local.
10. The device according to claim 6, characterized in that The fully connected neural network is integrated with a reinforcement learning model, the agents form a matching pair in each time step, the agents form a set in a matching step, and the device further comprises: A reward unit, configured to reward the agent for its work in each time step based on the adaptability value; A training unit is used to train the intelligent agent so as to maximize the cumulative reward obtained by the intelligent agent in each matching step.