CN116775247A - Task allocation method, device, computer equipment and storage medium - Google Patents

Task allocation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116775247A
CN116775247A CN202310760325.9A CN202310760325A CN116775247A CN 116775247 A CN116775247 A CN 116775247A CN 202310760325 A CN202310760325 A CN 202310760325A CN 116775247 A CN116775247 A CN 116775247A
Authority
CN
China
Prior art keywords
task
allocated
equipment
resource occupation
occupation amount
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310760325.9A
Other languages
Chinese (zh)
Inventor
张扬阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310760325.9A priority Critical patent/CN116775247A/en
Publication of CN116775247A publication Critical patent/CN116775247A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application relates to a task allocation method, a task allocation device, computer equipment and a storage medium, relates to the technical field of computers, and can be applied to the technical field of finance or other technical fields. The method comprises the following steps: acquiring task information of a task to be allocated; determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment; and distributing the task to be distributed to the target equipment. The task information comprises the task resource occupation amount and the task resource occupation amount of the task to be allocated, and the task time period and the task resource occupation amount of the allocated task are considered, so that a plurality of tasks are allocated on the same target equipment in time intervals, the resource utilization rate of the equipment is improved, expansion and contraction capacity processing is not required to be carried out on the equipment, and the complexity of task allocation is simplified.

Description

Task allocation method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a task allocation method, a task allocation device, a computer device, and a storage medium.
Background
With the development of computers, people's life pace is accelerated, and various tasks to be allocated (such as second activity killing tasks) appear, in the prior art, usually one task to be allocated corresponds to one target device, before the task to be allocated starts, the task resource occupation amount of the task to be allocated needs to be estimated, and then the total resource amount of the target device is subjected to expansion and contraction processing manually based on the task resource occupation amount of the task to be allocated.
Although the normal running of the task to be allocated can be ensured, the expansion and contraction processing is required to be carried out on the target equipment of the task to be allocated before the task to be allocated is executed each time, namely, when the estimated task resource occupation amount of the task to be allocated is higher than the total resource amount of the target equipment, the expansion and contraction processing is required to be carried out on the target equipment, otherwise, the expansion and contraction processing is carried out on the equipment frequently, and the complexity of task allocation is increased. In addition, a target device can only execute one task to be allocated, and the problem of device resource waste exists.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a task allocation method, apparatus, computer device, and storage medium that can simplify task allocation complexity and reduce device resource waste.
In a first aspect, the present application provides a task allocation method. The method comprises the following steps:
task information of a task to be allocated is obtained, wherein the task information comprises: task resource occupation amount and task time period;
determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and distributing the task to be distributed to the target equipment.
In one embodiment, determining a target device of the task to be allocated from the candidate devices according to task information of the task to be allocated, task information of the allocated task of the candidate devices, and total resource amount of the candidate devices, includes:
judging whether first equipment exists in each candidate equipment, wherein the task period of the first equipment which is allocated with the task has the same synchronous task as the task period of the task to be allocated;
if the first equipment exists, determining whether the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated according to the task resource occupation amount of the contemporaneous task of the first equipment and the total resource amount of the first equipment;
And if so, taking the first equipment as target equipment for the task to be distributed.
In one embodiment, determining whether the remaining resource occupation amount corresponding to the task period of the first device meets the task resource occupation amount of the task to be allocated according to the task resource occupation amount of the contemporaneous task of the first device and the total resource amount of the first device includes:
determining a difference between the total resource amount of the first device and the task resource occupation amount of the contemporaneous task of the first device;
if the difference value is greater than or equal to the task resource occupation amount of the task to be allocated, determining that the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated.
In one embodiment, after determining whether the remaining resource occupation amount corresponding to the task period of the first device meets the task resource occupation amount of the task to be allocated, the method further includes:
if the task time period is not satisfied, determining the residual resource occupation amount of the task to be allocated according to the residual resource occupation amount of the first equipment corresponding to the task time period and the task resource occupation amount of the task to be allocated;
determining a third device from the second devices according to the residual resource occupation amount of the task to be allocated and the total resource amount of the second devices; the sum of the total resource amounts of the third equipment is larger than or equal to the residual resource occupation amount of the task to be allocated;
And determining target equipment of the task to be allocated according to the size relation between the task resource occupation amount of the task to be allocated and the residual resource occupation amount of the task to be allocated and the third equipment.
In one embodiment, determining the third device from the second devices according to the remaining resource occupation amount of the task to be allocated and the total resource amount of the second devices includes:
setting priority for each second device according to the total resource amount of each second device; wherein, the quantity of the total resource quantity is proportional to the priority;
and determining a third device from the second devices according to the priority and the total resource quantity of the second devices and the residual resource occupation quantity of the task to be allocated.
In one embodiment, determining, according to the size relationship between the task resource occupation amount of the task to be allocated and the remaining resource occupation amount of the task to be allocated and the third device, the target device of the task to be allocated includes:
if the occupied amount of the task resources of the task to be allocated is larger than the occupied amount of the residual resources of the task to be allocated, the first equipment and the third equipment are used as target equipment of the task to be allocated;
and if the task resource occupation amount of the task to be allocated is equal to the residual resource occupation amount of the task to be allocated, taking the third device as the target device of the task to be allocated.
In one embodiment, determining whether a first device exists in each candidate device, where after a contemporaneous task having a task period identical to a task period of a task to be allocated exists in the allocated task of the first device, the method further includes:
and if the first equipment does not exist, determining target equipment of the task to be allocated from the candidate equipment according to the task resource occupation amount of the task to be allocated and the total resource amount of the candidate equipment.
In a second aspect, the application further provides a task distribution device. The device comprises:
the information acquisition module is used for acquiring task information of a task to be allocated, wherein the task information comprises: task resource occupation amount and task time period;
the equipment determining module is used for determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and the task allocation module is used for allocating the task to be allocated to the target equipment.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
Task information of a task to be allocated is obtained, wherein the task information comprises: task resource occupation amount and task time period;
determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and distributing the task to be distributed to the target equipment.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
task information of a task to be allocated is obtained, wherein the task information comprises: task resource occupation amount and task time period;
determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and distributing the task to be distributed to the target equipment.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
Task information of a task to be allocated is obtained, wherein the task information comprises: task resource occupation amount and task time period;
determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and distributing the task to be distributed to the target equipment.
According to the task allocation method, the device, the computer equipment and the storage medium, the target equipment of the task to be allocated is determined from the candidate equipment according to the acquired task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment, and the task information of the allocated task in the candidate equipment and the total resource quantity of the candidate equipment are considered when the task allocation is carried out.
Drawings
Fig. 1 is an application environment diagram of a task allocation method provided in this embodiment;
fig. 2 is a flow chart of a first task allocation method provided in the present embodiment;
fig. 3 is a schematic flow chart of determining a target device according to the present embodiment;
fig. 4 is a flow chart of a second task allocation method according to the present embodiment;
fig. 5 is a block diagram of a first task allocation device according to the present embodiment;
fig. 6 is an internal structure diagram of a computer device according to the present embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The task allocation method provided by the embodiment of the application can be applied to an application environment shown in figure 1. The application environment includes a server 101 and a candidate device 102, where the server 101 communicates with the candidate device 102 through a network. The server 101 may receive task information of a task to be allocated input by a user, determine a target device of the task to be allocated from among the candidate devices according to the task information of the task to be allocated, the task information of the allocated task of each candidate device 102, and the total resource amount of each candidate device 102, and allocate the task to be allocated to the target device through a network connection. Here, the server 101 may be implemented as a stand-alone server, and preferably the server 101 may be a database server. Candidate device 102 may be implemented as a stand-alone server or as a cluster of servers.
In one embodiment, as shown in fig. 2, a task allocation method is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
s201, task information of tasks to be distributed is obtained.
The task to be allocated may be a task to be held in a future period, and alternatively, the task to be allocated may be a second-killing activity task.
The task information may be a task resource occupation amount and a task period which characterize the task to be allocated. The task resource occupancy may be an amount of resources required by the task to be allocated, alternatively the task resource occupancy may be throughput (tps). The task period may be a period in which a task to be allocated is executed.
Optionally, the task information of the task to be allocated may be obtained by directly obtaining task information corresponding to the task to be allocated input by the user, or may be obtained by obtaining a real task resource occupation amount corresponding to a historical execution task period and a task period required to be executed by the task to be allocated when the task to be allocated is historically executed by the user, and predicting the task resource occupation amount required to be executed by the task to be allocated according to the real task resource occupation amount corresponding to the historical execution task period and the task period required to be executed by the task to be allocated when the task to be allocated is historically executed.
Specifically, the real task resource occupation amount and the task time period of historical execution corresponding to the historical execution of the task to be allocated, which are input by the user, and the task time period of the task to be allocated, which are required to be executed this time, may be input into a pre-trained prediction model, and the prediction model may analyze the real task resource occupation amount and the task time period of the historical execution, and predict and obtain the task resource occupation amount required by the task to be allocated for the execution this time in the task time period of the task to be allocated. The method can also select a task period of historical execution of the task to be allocated, which is similar to the task period of the task to be allocated, obtain the corresponding real task resource occupation amount of the historical execution corresponding to the similar task period, calculate the average value of the real task resource occupation amounts, and take the average value as the task resource occupation amount of the task to be allocated when the task to be allocated is executed this time.
S202, determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment.
Wherein the assigned task may be a task that has been assigned to the target device. The task type of the assigned task may be the same as or different from the task type of the task to be assigned.
The candidate device may be a device for performing a task, or alternatively, the candidate device may be a single device (e.g., a server), or may be a device group (e.g., a server group) formed by a plurality of devices. Preferably, the candidate device may be a server group formed by an application server and a distributed cache server, where the distributed cache server is mainly used for storing task information of a task to be allocated and data generated when the task to be allocated is executed, and the application server is mainly used for executing the task to be allocated.
The total resource amount may be a total resource amount that the candidate device can provide for the task to be allocated, and when the total resource amount is throughput, the total resource amount may be a maximum amount of task data that the candidate device can execute in a unit time. The target device may be a device that performs the task to be assigned.
One optional implementation manner may be that according to a task period of a task to be allocated, whether an allocated task exists in candidate devices in the task period is determined, if not, at least one candidate device with a total resource amount meeting the task resource occupation amount is selected from the candidate devices as a target device according to the task resource occupation amount of the task to be allocated and the total resource amount of the candidate devices; if so, selecting candidate equipment capable of meeting the task resource occupation amount of the task to be allocated from candidate equipment corresponding to the task to be allocated preferentially as target equipment, and if all the resource amounts which can be provided by the selected candidate equipment can not meet the task resource occupation amount of the task to be allocated, selecting the selected candidate equipment as target equipment, and selecting some candidate equipment from the candidate equipment without the task to be allocated and adding the candidate equipment to the target equipment, so that the determined resource amounts which can be provided by all the target equipment are larger than or equal to the task resource occupation amount of the task to be allocated.
Another alternative implementation manner may be to determine, according to a task period of a task to be allocated and task periods and task resource occupation amounts of allocated tasks of each candidate device, a remaining resource occupation amount of each candidate device in the task period of the task to be allocated, for example, for each candidate device, if the candidate device has an allocated task in the task period of the task to be allocated, the corresponding remaining resource occupation amount is a difference between a total resource amount of the candidate device and a task resource occupation amount of the allocated task corresponding to the task period of the task to be allocated, and if the candidate device does not have an allocated task in the task period of the task to be allocated, the corresponding remaining resource occupation amount is the total resource amount of the candidate device. And then sequencing the residual resource occupation amount of each candidate device according to the sequence from small to large, and sequentially adding each candidate device to the target device according to the sequencing result until the total residual resource occupation amount corresponding to the target device is greater than or equal to the task resource occupation amount of the task to be allocated.
And S203, distributing the task to be distributed to the target equipment.
Optionally, uploading task information corresponding to the task to be allocated to the target device, waiting for the arrival of the task period, and executing the task to be allocated by the target device.
According to the task allocation method, the target equipment of the task to be allocated is determined from the candidate equipment according to the acquired task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment, and the task information of the allocated task in the candidate equipment and the total resource quantity of the candidate equipment are considered when the task allocation is carried out.
FIG. 3 is a flow diagram of determining a target device in one embodiment. In order to ensure smooth progress of the task to be allocated, in this embodiment, on the basis of the foregoing embodiment, a plurality of judgment logics are introduced to determine target devices, so as to ensure that the determined target devices corresponding to the task to be allocated and candidate devices corresponding to the allocated task can both perform the task smoothly, and specifically, this embodiment provides an alternative manner for determining the target devices, including the following steps:
S301, task information of tasks to be distributed is obtained.
S302, judging whether a first device exists in the candidate devices, if so, executing a step S304, and if not, executing a step S303.
Wherein, the task period of the first device is the same as the task period of the task to be distributed.
Optionally, determining whether an allocated task exists in the candidate device in a task period according to the task period of the task to be allocated, if so, proving that a first device exists in the candidate device, namely, the candidate device corresponding to the allocated task is the first device; if not, proving that the first device does not exist in the candidate devices.
S303, if the first equipment does not exist, determining target equipment of the task to be allocated from the candidate equipment according to the task resource occupation amount of the task to be allocated and the total resource amount of the candidate equipment.
Wherein the second device may be a candidate device for which no contemporaneous task exists.
Optionally, if the first device does not exist, using the candidate device with the total resource quantity meeting the task resource occupation quantity of the task to be allocated as the target device of the task to be allocated according to the total resource quantity of each candidate device; and the total resource quantity of each candidate device can be sequenced from small to large, the total resource quantity of each second device is sequentially overlapped until the resource quantity corresponding to the overlapped result meets the task resource occupation quantity of the task to be allocated, and each second device corresponding to the overlapped result is used as the target device of the task to be allocated.
S304, if the first equipment exists, determining whether the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated according to the task resource occupation amount of the synchronous task of the first equipment and the total resource amount of the first equipment.
Optionally, determining a difference between the total resource amount of the first device and the task resource occupation amount of the contemporaneous task of the first device; if the difference value is greater than or equal to the task resource occupation amount of the task to be allocated, determining that the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated.
Specifically, a difference between the total resource amount of the first device and the task resource occupation amount of the contemporaneous task of the first device is calculated, if the difference is smaller than the task resource occupation amount of the task to be allocated, it is proved that the residual resource occupation amount corresponding to the task time period of the first device does not satisfy the task resource occupation amount of the task to be allocated, and step S306 should be continuously executed; if the difference is greater than or equal to the task resource occupation amount of the task to be allocated, it is proved that the residual resource occupation amount corresponding to the task period of the first device meets the task resource occupation amount of the task to be allocated, and step S305 should be continuously executed.
And S305, if the task is satisfied, the first device is used as a target device for the task to be distributed.
Alternatively, since the remaining resource occupation amount corresponding to the first device can satisfy the task resource occupation amount corresponding to the task to be allocated, the first device may be directly used as the target device of the task to be allocated.
And S306, if the residual resource occupation amount is not satisfied, determining the residual resource occupation amount of the task to be allocated according to the residual resource occupation amount of the first equipment corresponding to the task time period and the task resource occupation amount of the task to be allocated.
Alternatively, since the remaining resource occupation amount corresponding to the first device cannot satisfy the task resource occupation amount corresponding to the task to be allocated, the difference between the remaining resource occupation amount corresponding to the task period by the first device and the task resource occupation amount of the task to be allocated should be calculated, and the difference is taken as the remaining resource occupation amount of the task to be allocated.
S307, determining a third device from the second devices according to the residual resource occupation amount of the task to be allocated and the total resource amount of the second devices.
And the sum of the total resource amounts of the third equipment is larger than or equal to the residual resource occupation amount of the task to be allocated.
Optionally, the second device with the total resource amount larger than the remaining resource occupation amount of the task to be allocated may be directly selected as the third device from the second devices. The priority level of each second device can be set according to the total resource amount of each second device; and determining a third device from the second devices according to the priority and the total resource quantity of the second devices and the residual resource occupation quantity of the task to be allocated. Wherein the amount of total resources is proportional to the priority. Specifically, the priorities are sequentially set according to the total resource quantity of the second devices from small to large, namely, the higher the total resource quantity is, the higher the priorities are, the second devices with the higher priorities are sequentially selected according to the priorities of the second devices, the sum value of the total resource quantity of the selected second devices is calculated until the sum value can meet the residual resource occupation quantity of the task to be allocated, and the second devices corresponding to the sum value are all used as third devices.
S308, determining target equipment of the task to be allocated according to the size relation between the task resource occupation amount of the task to be allocated and the residual resource occupation amount of the task to be allocated and the third equipment.
Optionally, if the task resource occupation amount of the task to be allocated is greater than the remaining resource occupation amount of the task to be allocated, using the first device and the third device as target devices of the task to be allocated; and if the task resource occupation amount of the task to be allocated is equal to the residual resource occupation amount of the task to be allocated, taking the third device as the target device of the task to be allocated.
Specifically, the size relation between the task resource occupation amount of the task to be allocated and the residual resource occupation amount of the task to be allocated is judged, if the task resource occupation amount of the task to be allocated is equal to the residual resource occupation amount of the task to be allocated, the first equipment is proved to have no residual resource occupation amount, so the task resource occupation amount of the task to be allocated can only be matched with each second equipment, and the third equipment is determined from each second equipment, therefore, the third equipment should be used as the target equipment of the task to be allocated. If the task resource occupation amount of the task to be allocated is larger than the residual resource occupation amount of the task to be allocated, the fact that part of the task resource occupation amount is allocated to the first equipment and the residual resource occupation amount is allocated to the third equipment is proved, and therefore the first equipment and the third equipment are used as target equipment of the task to be allocated.
According to the method for determining the target device, whether the first device (i.e. the candidate device without the contemporaneous task) exists is preferentially judged, when the first device does not exist, the fact that the contemporaneous task which is carried out with the task to be distributed in the same task period does not exist is proved, and the second device (i.e. the candidate device without the contemporaneous task) can be selected as the target device; when the first equipment exists, judging whether the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated or not, if so, proving that the residual resource occupation amount of the first equipment is enough to support normal operation of the task to be allocated, and directly taking the first equipment as target equipment; if the task to be allocated does not meet the requirement, calculating the residual resource occupation amount of the task to be allocated, determining target equipment of the task to be allocated according to the size relation between the task resource occupation amount of the task to be allocated and the residual resource occupation amount of the task to be allocated and the third equipment, and further utilizing the residual resource occupation amount of the candidate equipment to reduce resource waste in the candidate equipment under the condition that the task to be allocated and the synchronous task can be normally carried out.
In one embodiment, this embodiment gives an alternative way of task allocation, and the method is applied to a server for illustration. As shown in fig. 4, the method comprises the steps of:
S401, task information of tasks to be distributed is acquired.
S402, judging whether a first device exists in the candidate devices.
Wherein, the task period of the first device is the same as the task period of the task to be distributed.
S403, if the first equipment does not exist, determining target equipment of the task to be allocated from the candidate equipment according to the task resource occupation amount of the task to be allocated and the total resource amount of the candidate equipment.
S404, if the first device exists, determining a difference value between the total resource amount of the first device and the task resource occupation amount of the contemporaneous task of the first device.
S405, judging whether the difference value is smaller than the task resource occupation amount of the task to be allocated.
S406, if not, determining that the residual resource occupation amount corresponding to the task period of the first device meets the task resource occupation amount of the task to be allocated, and taking the first device as the target device of the task to be allocated.
And S407, if so, determining the residual resource occupation amount of the task to be allocated according to the residual resource occupation amount of the first equipment corresponding to the task time period and the task resource occupation amount of the task to be allocated.
And S408, setting priority for each second device according to the total resource amount of each second device.
Wherein the amount of total resources is proportional to the priority.
S409, determining a third device from the second devices according to the priority and the total resource quantity of the second devices and the residual resource occupation quantity of the task to be allocated.
And the sum of the total resource amounts of the third equipment is larger than or equal to the residual resource occupation amount of the task to be allocated.
S410, judging whether the task resource occupation amount of the task to be allocated is larger than the residual resource occupation amount of the task to be allocated.
S411, if yes, the first device and the third device are used as target devices of tasks to be distributed.
And S412, if not, taking the third device as a target device for the task to be distributed.
And S413, distributing the task to be distributed to the target equipment.
For example, assume that five tasks to be allocated exist, namely, activity a, activity B, activity C, activity D and activity E, wherein task resources corresponding to activity a occupy 10000tps, and task time periods are 2023-02-2700:00:00 to 2023-02-27:23:59:59; the task resource occupation amount corresponding to the activity B is 10000tps, and the task time period is 2023-02-28:00:00 to 2023-02-28:23:59:59; the task resource occupation amount corresponding to the activity C is 15000tps, and the task time period is 2023-02-28:00:00 to 2023-02-28:23:59:59; the task resource occupation amount corresponding to the activity D is 10000tps, and the task time period is 2023-02-28:00:00 to 2023-02-28:23:59:59; activity E corresponds to a task resource occupancy of 5000tps and a task period of 2023-02-28:00:00 to 2023-02-28:23:59:59. Meanwhile, four candidate devices, namely candidate device 1, candidate device 2, candidate device 3 and candidate device 4, are provided, the total resource amount corresponding to each candidate device is 10000tps, and no allocated task exists in each candidate device.
Next, taking the case of sequentially allocating the activities a to E among the candidate devices 1 to 4 as an example, for the activity a, since there is no activity in each candidate device at the current time that has the same task period as the activity a, and the total resource amount of one candidate device can satisfy the task resource occupation amount of the activity a, the activity a can be allocated to the candidate device 1; for activity B, since there is no activity in each candidate device at the current time that has the same task period as activity B, and the total resource amount of one candidate device can meet the task resource occupation amount of activity B, activity B may also be allocated to candidate device 1; for activity C, at this time, since there is activity B in candidate device 1 in the same task period as activity C, and the remaining resource amount of candidate device 1 cannot satisfy the task resource occupation amount of activity C (i.e., the difference between the total resource amount 10000tps of candidate device 1 and the task resource occupation amount 10000tps of activity B is 0), activity C should be allocated to candidate device 2 and candidate device 3, wherein candidate device 2 allocates task resource occupation amount 10000tps, and candidate device 3 allocates task resource occupation amount 5000tps; for activity D, at this time, since the total resource amounts of candidate device 1 and candidate device 2 are not the remaining resource occupation amounts, the task resource occupation amounts of the task to be allocated should be received from candidate device 3, specifically, since there is activity C in the same task period as activity D in candidate device 3 and there is a remaining resource occupation amount in candidate device 3, candidate device 3 may be regarded as a target device, and at the same time, since the remaining resource occupation amount (5000 tps) of candidate device 3 can only satisfy the task resource occupation amount of part of activity D, activity D should also be allocated to candidate device 4, that is, finally activity D is allocated to candidate device 3 and candidate device 4, wherein candidate device 3 allocates task resource occupation amount 5000tps, and candidate device 4 allocates task resource occupation amount 5000tps; for the activity E, at this time, since the total resource amounts of the candidate device 1, the candidate device 2, and the candidate device 3 do not have the remaining resource occupation amount, the task resource occupation amount of the task to be allocated should be received from the candidate device 4, specifically, since the activity D having the same task period as the activity E exists in the candidate device 4, and the remaining resource occupation amount (5000 tps) of the candidate device 4 can satisfy the task resource occupation amount of the activity E, the activity E may also be allocated to the candidate device 4.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a task allocation device for realizing the task allocation method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the task allocation device provided below may refer to the limitation of the task allocation method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 5, there is provided a task assigning apparatus 1 including: an information acquisition module 10, a device determination module 11, and a task allocation module 12, wherein:
the information acquisition module 10 is configured to acquire task information of a task to be allocated, where the task information includes: task resource occupation amount and task time period;
a device determining module 11, configured to determine a target device of a task to be allocated from the candidate devices according to task information of the task to be allocated, task information of the allocated task of the candidate devices, and total resource amount of the candidate devices;
the task allocation module 12 is configured to allocate a task to be allocated to a target device.
In one embodiment, the device determination module 11 in fig. 5 includes:
the device judging unit is used for judging whether first devices exist in each candidate device, wherein the task time period of the assigned tasks of the first devices is the same as the task time period of the tasks to be assigned;
the occupation determining unit is used for determining whether the residual resource occupation amount corresponding to the task period of the first equipment meets the task resource occupation amount of the task to be allocated according to the task resource occupation amount of the contemporaneous task of the first equipment and the total resource amount of the first equipment if the first equipment exists;
And the target equipment determining unit is used for taking the first equipment as target equipment for the task to be distributed if the first equipment is satisfied.
The residual occupation determining unit is used for determining the residual resource occupation of the task to be allocated according to the residual resource occupation of the first equipment corresponding to the task time period and the task resource occupation of the task to be allocated if the residual occupation is not satisfied;
a third device determining unit, configured to determine a third device from the second devices according to the remaining resource occupation amount of the task to be allocated and the total resource amount of the second devices; the sum of the total resource amounts of the third equipment is larger than or equal to the residual resource occupation amount of the task to be allocated;
and the residual comparison unit is used for determining target equipment of the task to be allocated according to the size relation between the task resource occupation amount of the task to be allocated and the residual resource occupation amount of the task to be allocated and the third equipment.
In one embodiment, the occupancy determination unit comprises:
a difference determining subunit, configured to determine a difference between a total resource amount of the first device and a task resource occupation amount of a contemporaneous task of the first device;
and the residual resource allocation subunit is used for determining that the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated if the difference value is larger than or equal to the task resource occupation amount of the task to be allocated.
In one embodiment, the third device determining unit includes:
a priority determining subunit, configured to set a priority for each second device according to the total resource amount of each second device; wherein, the quantity of the total resource quantity is proportional to the priority;
and the third equipment determining subunit is used for determining the third equipment from the second equipment according to the priority and the total resource quantity of the second equipment and the residual resource occupation quantity of the task to be allocated.
In one embodiment, the remaining comparison unit comprises:
the surplus is larger than the unit, is used for if the task resource occupation amount of the task to be allocated is larger than the surplus resource occupation amount of the task to be allocated, regard first apparatus and third apparatus as the goal apparatus of the task to be allocated;
and the surplus equality unit is used for taking the third device as the target device of the task to be allocated if the task resource occupation amount of the task to be allocated is equal to the surplus resource occupation amount of the task to be allocated.
In one embodiment, the device determining module 11 in fig. 5 is further configured to determine, if the first device does not exist, a target device of the task to be allocated from the candidate devices according to the task resource occupation amount of the task to be allocated and the total resource amount of the candidate devices.
The various modules in the task allocation device described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a task allocation method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 6 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
task information of a task to be allocated is obtained, wherein the task information comprises: task resource occupation amount and task time period;
determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and distributing the task to be distributed to the target equipment.
In one embodiment, the processor when executing the computer program further performs the steps of:
judging whether first equipment exists in each candidate equipment, wherein the task period of the first equipment which is allocated with the task has the same synchronous task as the task period of the task to be allocated;
If the first equipment exists, determining whether the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated according to the task resource occupation amount of the contemporaneous task of the first equipment and the total resource amount of the first equipment;
and if so, taking the first equipment as target equipment for the task to be distributed.
In one embodiment, the processor when executing the computer program further performs the steps of:
determining a difference between the total resource amount of the first device and the task resource occupation amount of the contemporaneous task of the first device;
if the difference value is greater than or equal to the task resource occupation amount of the task to be allocated, determining that the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated.
In one embodiment, the processor when executing the computer program further performs the steps of:
if the task time period is not satisfied, determining the residual resource occupation amount of the task to be allocated according to the residual resource occupation amount of the first equipment corresponding to the task time period and the task resource occupation amount of the task to be allocated;
determining a third device from the second devices according to the residual resource occupation amount of the task to be allocated and the total resource amount of the second devices; the sum of the total resource amounts of the third equipment is larger than or equal to the residual resource occupation amount of the task to be allocated;
And determining target equipment of the task to be allocated according to the size relation between the task resource occupation amount of the task to be allocated and the residual resource occupation amount of the task to be allocated and the third equipment.
In one embodiment, the processor when executing the computer program further performs the steps of:
setting priority for each second device according to the total resource amount of each second device; wherein, the quantity of the total resource quantity is proportional to the priority;
and determining a third device from the second devices according to the priority and the total resource quantity of the second devices and the residual resource occupation quantity of the task to be allocated.
In one embodiment, the processor when executing the computer program further performs the steps of:
if the occupied amount of the task resources of the task to be allocated is larger than the occupied amount of the residual resources of the task to be allocated, the first equipment and the third equipment are used as target equipment of the task to be allocated;
and if the task resource occupation amount of the task to be allocated is equal to the residual resource occupation amount of the task to be allocated, taking the third device as the target device of the task to be allocated.
In one embodiment, the processor when executing the computer program further performs the steps of:
and if the first equipment does not exist, determining target equipment of the task to be allocated from the candidate equipment according to the task resource occupation amount of the task to be allocated and the total resource amount of the candidate equipment.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
task information of a task to be allocated is obtained, wherein the task information comprises: task resource occupation amount and task time period;
determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and distributing the task to be distributed to the target equipment.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
task information of a task to be allocated is obtained, wherein the task information comprises: task resource occupation amount and task time period;
determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and distributing the task to be distributed to the target equipment.
The data (including, but not limited to, data for analysis, data stored, data displayed, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (11)

1. A method of task allocation, the method comprising:
acquiring task information of a task to be allocated, wherein the task information comprises: task resource occupation amount and task time period;
determining target equipment of the task to be allocated from each candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of each candidate equipment and the total resource quantity of each candidate equipment;
And distributing the task to be distributed to the target equipment.
2. The method according to claim 1, wherein the determining the target device of the task to be allocated from among the candidate devices according to the task information of the task to be allocated, the task information of the allocated task of the candidate devices, and the total resource amount of the candidate devices, comprises:
judging whether first equipment exists in each candidate equipment, wherein the task period of the first equipment which is allocated with the task is the same as the synchronous task of the task period of the task to be allocated;
if the first equipment exists, determining whether the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated according to the task resource occupation amount of the synchronous task of the first equipment and the total resource amount of the first equipment;
and if so, taking the first equipment as target equipment of the task to be allocated.
3. The method according to claim 2, wherein the determining whether the remaining resource occupation amount corresponding to the task period by the first device satisfies the task resource occupation amount of the task to be allocated according to the task resource occupation amount of the contemporaneous task of the first device and the total resource amount of the first device includes:
Determining a difference between the total resource amount of the first device and the task resource occupation amount of the contemporaneous task of the first device;
and if the difference value is larger than or equal to the task resource occupation amount of the task to be allocated, determining that the residual resource occupation amount corresponding to the task time period of the first equipment meets the task resource occupation amount of the task to be allocated.
4. The method of claim 2, wherein the determining, by the first device, after whether the remaining resource occupancy corresponding to the task period satisfies the task resource occupancy of the task to be allocated, further comprises:
if the task time period is not satisfied, determining the residual resource occupation amount of the task to be allocated according to the residual resource occupation amount of the first equipment corresponding to the task time period and the task resource occupation amount of the task to be allocated;
determining a third device from the second devices according to the residual resource occupation amount of the task to be allocated and the total resource amount of the second devices; the sum of the total resource amounts of the third equipment is larger than or equal to the residual resource occupation amount of the task to be allocated;
and determining target equipment of the task to be allocated according to the size relation between the task resource occupation amount of the task to be allocated and the residual resource occupation amount of the task to be allocated and the third equipment.
5. The method of claim 4, wherein the determining a third device from the second devices based on the remaining resource occupancy of the task to be allocated and the total resource occupancy of the second devices comprises:
setting priority for each second device according to the total resource amount of each second device; wherein, the quantity of the total resource quantity is proportional to the priority;
and determining a third device from the second devices according to the priority and the total resource quantity of the second devices and the residual resource occupation quantity of the task to be allocated.
6. The method of claim 4, wherein the determining the target device for the task to be allocated according to the size relationship between the task resource occupation amount of the task to be allocated and the remaining resource occupation amount of the task to be allocated, and the third device, comprises:
if the task resource occupation amount of the task to be allocated is larger than the residual resource occupation amount of the task to be allocated, the first device and the third device are used as target devices of the task to be allocated;
and if the task resource occupation amount of the task to be allocated is equal to the residual resource occupation amount of the task to be allocated, taking the third device as the target device of the task to be allocated.
7. The method according to claim 2, wherein the determining whether the first device exists in each candidate device, after the task period of the first device exists in the task to be allocated and the same contemporaneous task as the task period of the task to be allocated, further includes:
and if the first equipment does not exist, determining target equipment of the task to be allocated from the candidate equipment according to the task resource occupation amount of the task to be allocated and the total resource amount of each candidate equipment.
8. A task allocation device, the device comprising:
the information acquisition module is used for acquiring task information of a task to be allocated, wherein the task information comprises: task resource occupation amount and task time period;
the equipment determining module is used for determining target equipment of the task to be allocated from the candidate equipment according to the task information of the task to be allocated, the task information of the allocated task of the candidate equipment and the total resource quantity of the candidate equipment;
and the task allocation module is used for allocating the task to be allocated to the target equipment.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202310760325.9A 2023-06-26 2023-06-26 Task allocation method, device, computer equipment and storage medium Pending CN116775247A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310760325.9A CN116775247A (en) 2023-06-26 2023-06-26 Task allocation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310760325.9A CN116775247A (en) 2023-06-26 2023-06-26 Task allocation method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116775247A true CN116775247A (en) 2023-09-19

Family

ID=88007734

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310760325.9A Pending CN116775247A (en) 2023-06-26 2023-06-26 Task allocation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116775247A (en)

Similar Documents

Publication Publication Date Title
CN111104222B (en) Task processing method, device, computer equipment and storage medium
CN113867973A (en) Resource allocation method and device
CN116775247A (en) Task allocation method, device, computer equipment and storage medium
CN116010093A (en) Data processing method, apparatus, computer device and readable storage medium
CN115981843A (en) Task scheduling method and device in cloud-edge cooperative power system and computer equipment
CN111475277A (en) Resource allocation method, system, equipment and machine readable storage medium
CN115080253A (en) GPU task allocation method and device, electronic equipment and storage medium
CN114844791A (en) Cloud service automatic management and distribution method and system based on big data and storage medium
CN114253481A (en) Data storage method and device, computer equipment and storage medium
CN117851071A (en) Application resource allocation method and device, computer equipment and storage medium
CN117290741B (en) Vehicle clustering method, device, computer equipment and storage medium
CN116186417B (en) Recommendation method, recommendation device, computer equipment and storage medium
CN112148469B (en) Method and device for managing resources and computer storage medium
CN117314036A (en) Work order distribution method, apparatus, device, storage medium and program product
CN111798076A (en) Resident area recommendation method and device, electronic equipment and storage medium
CN117522003A (en) Method and device for controlling handover of intelligent telephone traffic system and computer equipment
CN116860435A (en) Nuclear function priority determining method, device, computer equipment and storage medium
CN116416064A (en) Method, device and computer equipment for providing auxiliary information in resource conversion service
CN113900799A (en) Computing resource allocation method and device, electronic equipment and storage medium
CN117389715A (en) Resource allocation method, resource allocation device, computer device, and storage medium
CN118034885A (en) Task processing method, device, computer equipment and storage medium
CN117172735A (en) Resource information prediction method, device, computer equipment and storage medium
CN117724680A (en) Demand evaluation method, device, computer equipment and storage medium
CN117149404A (en) Method, device, computer equipment and storage medium for allocating detection task resources
CN116185866A (en) Script editing method, script editing device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination