CN109981310B - Resource management method, device and storage medium - Google Patents

Resource management method, device and storage medium Download PDF

Info

Publication number
CN109981310B
CN109981310B CN201711445115.1A CN201711445115A CN109981310B CN 109981310 B CN109981310 B CN 109981310B CN 201711445115 A CN201711445115 A CN 201711445115A CN 109981310 B CN109981310 B CN 109981310B
Authority
CN
China
Prior art keywords
resource
computing node
target computing
version number
target
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.)
Active
Application number
CN201711445115.1A
Other languages
Chinese (zh)
Other versions
CN109981310A (en
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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201711445115.1A priority Critical patent/CN109981310B/en
Publication of CN109981310A publication Critical patent/CN109981310A/en
Application granted granted Critical
Publication of CN109981310B publication Critical patent/CN109981310B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/085Retrieval of network configuration; Tracking network configuration history
    • H04L41/0859Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions

Abstract

The invention discloses a resource management method, a resource management device and a storage medium, and belongs to the field of cluster video analysis. The method comprises the following steps: when a resource acquisition request sent by a task scheduling device is received, a target computing node capable of executing a target task is determined based on the number of target resources carried by the resource acquisition request, the number of idle resources of the target computing node and the corresponding resource version number in the stored corresponding relationship are updated, a resource acquisition response carrying a node identifier of the target computing node and the updated resource version number is sent to the task scheduling device, and when a resource report request sent by the target computing node is received and the resource version number carried in the resource report request is different from the updated resource version number, the number of idle resources of the target computing node in the corresponding relationship is abandoned to be updated, so that the problem of resource management errors is avoided, and the efficiency of resource management is improved.

Description

Resource management method, device and storage medium
Technical Field
The present invention relates to the field of cluster video analysis, and in particular, to a resource management method, device, and storage medium.
Background
With the development of network communication technology and video storage technology, cluster analysis of videos or pictures is more and more important. In order to achieve load balancing and improve the scheduling capability of cluster analysis of videos or pictures, a resource management system is usually adopted to achieve resource management and task scheduling in the video or picture analysis process.
Currently, a resource management system may generally include a resource management device, at least one task scheduling device, and at least one compute node. The resource management device is responsible for resource collection and resource distribution, the task scheduling device is responsible for resource requests and task distribution, and the computing node is responsible for reporting resources and executing tasks. That is, each computing node reports its current idle resource amount to the resource management device every preset time, and when any task scheduling device receives a task, it can send a resource acquisition request to the resource management device, where the resource acquisition request carries a target resource amount, and the target resource amount refers to a resource amount required for executing the task. When the resource management device receives the resource acquisition request, a target computing node capable of executing the task can be determined from the at least one computing node based on the recorded free resource quantity, and the recorded free resource quantity of the target computing node is updated. And then the resource management device sends the node identification of the target computing node to the task scheduling device. Therefore, the task scheduling device can issue the task and the target resource quantity to the target computing node, the target computing node executes the task, meanwhile, the target computing node can update the self idle resource quantity based on the target resource quantity, and report the self current idle resource quantity to the resource management device again.
However, in the actual implementation process, due to poor network speed, network anomaly, service breakdown, or the like, a situation that the resource request is successful but the task is not timely issued or the task is failed to be issued may occur, so that the target computing node may not timely or cannot receive the task, and when the target computing node reports the number of idle resources again after a preset time, the resource management device updates the recorded number of idle resources to the number of idle resources reported by the target computing node, thereby causing a problem of resource management error.
Disclosure of Invention
In order to solve the problem of resource management errors in the related art, embodiments of the present invention provide a resource management method, a resource management device, and a storage medium. The technical scheme is as follows:
in a first aspect, a resource management method is provided, and is applied to a resource management device, where the method includes:
when a resource acquisition request sent by a task scheduling device is received, determining a target computing node capable of executing a target task based on the target resource quantity carried in the resource acquisition request and the corresponding relation among the stored computing node identification, the idle resource quantity and the resource version number, wherein the target resource quantity is the resource quantity required by the target task;
updating the number of idle resources and the corresponding resource version number of the target computing node in the corresponding relation based on the number of the target resources, and sending a resource acquisition response carrying the node identifier of the target computing node and the updated resource version number to the task scheduling device so that the task scheduling device issues the target task to the target computing node for execution;
after the resource acquisition response is sent, when a resource reporting request sent by the target computing node is received and the resource version number carried in the resource reporting request is different from the updated resource version number, the update of the number of the idle resources of the target computing node in the corresponding relation is abandoned.
Optionally, after the foregoing updating the number of idle resources of the target computing node in the correspondence, the method further includes:
starting timing;
and when the timing duration reaches a preset duration and the resource version numbers reported by the target computing node are different from the updated resource version number in the timing process, updating the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation into the number of the idle resources carried in the resource reporting request and the corresponding resource version number.
Optionally, after the foregoing updating the number of idle resources of the target computing node in the correspondence, the method further includes:
starting timing;
and when the timing duration reaches a preset duration and the resource version number reported by the target computing node is different from the updated resource version number in the timing process, updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource reporting request, and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node, so that the target computing node updates the recorded resource version number into the received resource version number.
Optionally, after the foregoing updating the number of idle resources of the target computing node in the correspondence, the method further includes:
sending a prompt message to the target computing node, wherein the prompt message is used for prompting that the number of idle resources reported by the target computing node and the corresponding resource version number are inconsistent with the number of idle resources of the target computing node and the corresponding resource version number in the corresponding relationship;
receiving a resource updating request sent by the target computing node, wherein the resource updating request carries the number of idle resources recorded by the target computing node, and the resource updating request is sent when the target computing node starts timing when receiving the prompt message and the timing duration reaches a preset duration and the prompt message with consistent resources is not received in the timing process;
and updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource updating request, and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node, so that the target computing node updates the recorded resource version number into the received resource version number.
Optionally, the method further comprises:
when a resource reporting request sent by the target computing node is received and the currently received resource reporting request carries the number of idle resources, the corresponding resource version number and a request parameter, the number of the idle resources and the corresponding resource version number of the target computing node in the corresponding relation are updated to the number of the idle resources and the corresponding resource version number carried in the currently received resource reporting request, and the request parameter is used for indicating that the currently received resource reporting request is a resource reporting request which is sent by the target computing node for the first time after the target computing node is restarted.
In a second aspect, an apparatus for resource management is provided, the apparatus comprising:
the system comprises a determining module and a task scheduling device, wherein the determining module is used for determining a target computing node capable of executing a target task based on the target resource quantity carried in a resource obtaining request and the corresponding relation among a stored computing node identifier, an idle resource quantity and a resource version number when the resource obtaining request sent by the task scheduling device is received, and the target resource quantity refers to the resource quantity required by the target task;
a first sending module, configured to update the number of idle resources of the target computing node and the corresponding resource version number in the corresponding relationship based on the number of the target resources, and send a resource acquisition response carrying a node identifier of the target computing node and the updated resource version number to the task scheduling device, so that the task scheduling device issues the target task to the target computing node for execution;
and the first updating module is used for giving up updating the number of the idle resources of the target computing node in the corresponding relationship when a resource reporting request sent by the target computing node is received and the resource version number carried in the resource reporting request is different from the updated resource version number after the resource obtaining response is sent.
Optionally, the apparatus further comprises:
the timing module is used for starting timing;
and the second updating module is used for updating the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation into the number of the idle resources carried in the resource reporting request and the corresponding resource version number when the timing duration reaches a preset duration and the resource version numbers reported by the target computing node are different from the updated resource version number in the timing process.
Optionally, the apparatus further comprises:
the second timing module is used for starting timing;
and the third updating module is used for updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource reporting request and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node when the timing duration reaches a preset duration and the resource version number reported by the target computing node is different from the updated resource version number in the timing process, so that the target computing node updates the recorded resource version number into the received resource version number.
Optionally, the apparatus further comprises:
a second sending module, configured to send a prompt message to the target computing node, where the prompt message is used to prompt that the number of idle resources and the corresponding resource version number reported by the target computing node are inconsistent with the number of idle resources and the corresponding resource version number of the target computing node in the correspondence;
a receiving module, configured to receive a resource update request sent by the target computing node, where the resource update request carries the number of idle resources recorded by the target computing node, and the resource update request starts timing when the target computing node receives the notification information, and is sent when a timing duration reaches a preset duration and the notification information with consistent resources is not received in a timing process;
and the fourth updating module is used for updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource updating request, and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node, so that the target computing node updates the recorded resource version number into the received resource version number.
Optionally, the apparatus further comprises:
a fifth updating module, configured to update the number of idle resources and the corresponding resource version number of the target computing node in the correspondence to the number of idle resources and the corresponding resource version number carried in the currently received resource reporting request when receiving the resource reporting request sent by the target computing node and the currently received resource reporting request carries the number of idle resources, the corresponding resource version number, and a request parameter, where the request parameter is used to indicate that the currently received resource reporting request is a resource reporting request that is first sent by the target computing node after being restarted.
In a third aspect, a resource management system is provided, which includes a resource management device, at least one task scheduling device and at least one computing node;
for any task scheduling device, the task scheduling device is configured to send a resource acquisition request to the resource management device, where the resource acquisition request carries a target resource quantity, and the target resource quantity refers to a resource quantity required for executing a target task;
the resource management device is used for receiving the resource acquisition request, determining a target computing node capable of executing the target task based on the target resource quantity and the corresponding relation among the stored computing node identification, the free resource quantity and the resource version number, updating the free resource quantity and the corresponding resource version number of the target computing node in the corresponding relation based on the target resource quantity, and sending a resource acquisition response carrying the node identification of the target computing node and the updated resource version number to the task scheduling device;
the task scheduling device is further configured to receive the resource acquisition response, issue the target task to the target computing node for execution based on the node identifier of the target computing node, and send the number of the target resources and the updated resource version number to the target computing node when the target task is issued;
and after sending the resource acquisition response, when receiving a resource reporting request sent by the target computing node and the resource version number carried in the resource reporting request is different from the updated resource version number, the resource management device is further configured to give up updating the number of idle resources of the target computing node in the corresponding relationship.
Optionally, the target computing node is configured to update the resource version number recorded by the target computing node according to the resource version number sent by the task scheduling device when receiving the target task issued by the task scheduling device.
Optionally, the target computing node is further configured to, before updating the resource version number recorded by the target computing node according to the resource version number sent by the task scheduling device, determine whether a relationship between the resource version number sent by the task scheduling device and the resource version number recorded by the target computing node conforms to a preset policy, and if so, update the resource version number recorded by the target computing node to the resource version number sent by the task scheduling device; and if not, not updating the resource version number recorded by the user.
In a fourth aspect, a terminal is provided, the terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of the first aspect when executing the program code.
In a fifth aspect, a computer-readable storage medium is provided, having stored thereon instructions, which when executed by a processor, implement the steps of the method of the first aspect.
The technical scheme provided by the embodiment of the invention has the following beneficial effects: by setting the resource version number corresponding to the number of the idle resources of the computing node, when a resource reporting request sent by a target computing node is received and the resource version number carried in the resource reporting request is different from the resource version number corresponding to the target computing node in the updated corresponding relationship, the number of the idle resources of the target computing node in the corresponding relationship is abandoned to be updated, so that the problem that resource management is wrong after the number of the idle resources of the target computing node in the corresponding relationship is updated when the resource version number carried in the resource reporting request received by a resource management device is different from the resource version number corresponding to the target computing node in the corresponding relationship is avoided, and the efficiency of resource management is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a resource management system according to an embodiment of the present invention;
FIG. 2 is a flowchart of a resource management method according to an embodiment of the present invention;
FIG. 3 is a flowchart of another resource management method provided by an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a resource management apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another resource management apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
For ease of understanding, before explaining the embodiments of the present invention in detail, a system architecture of the embodiments of the present invention will be described.
Fig. 1 is a schematic structural diagram of a resource management system according to an embodiment of the present invention. Referring to fig. 1, the resource management system includes a resource management device 101, at least one task scheduling device 102, and at least one computing node 103, where the resource management device 101 is responsible for resource collection and resource allocation, the task scheduling device 102 is responsible for resource request and task allocation, and the computing node 103 is responsible for reporting resources and executing tasks.
For any task scheduling device 102, the task scheduling device 102 is configured to send a resource acquisition request to the resource management device 101, where the resource acquisition request carries a target resource quantity, and the target resource quantity refers to a resource quantity required when a target task is executed;
the resource management device 101 is configured to receive the resource acquisition request, determine a target computing node 103 capable of executing a target task based on the target resource quantity and the stored correspondence between the computing node identifier, the free resource quantity, and the resource version number, update the free resource quantity and the corresponding resource version number of the target computing node 103 in the correspondence based on the target resource quantity, and send a resource acquisition response carrying the node identifier of the target computing node 103 and the updated resource version number to the task scheduling device 102;
the task scheduling device 102 is further configured to receive a resource obtaining response, issue the target task to the target computing node 103 for execution based on the node identifier of the target computing node 103, and send the number of the target resources and the updated resource version number to the target computing node 103 when issuing the target task;
the resource management device 101 is further configured to, after sending the resource acquisition response, when receiving the resource reporting request sent by the target computing node 103 and a resource version number carried in the resource reporting request is different from the updated resource version number, abandon updating the number of idle resources of the target computing node 103 in the corresponding relationship.
Optionally, the target computing node 103 is configured to update the resource version number recorded by the target computing node itself according to the resource version number sent by the task scheduling device 102 when receiving the target task issued by the task scheduling device 102.
Optionally, the target computing node 103 is further configured to, before updating the resource version number recorded by the target computing node itself according to the resource version number sent by the task scheduling apparatus 102, determine whether a relationship between the resource version number sent by the task scheduling apparatus 102 and the resource version number recorded by the target computing node itself meets a preset policy, and if so, update the resource version number recorded by the target computing node itself to the resource version number sent by the task scheduling apparatus 102; and if not, not updating the resource version number recorded by the user.
It should be noted that, in practical applications, the resource management system may include at least one task scheduling device and at least one computing node, and fig. 1 only illustrates one task scheduling device and one computing node as an example, and does not limit the embodiment of the present invention.
The resource management method provided by the embodiment of the invention will be explained in detail with reference to the accompanying drawings. Fig. 2 is a flowchart of a resource management method according to an embodiment of the present invention, applied to a resource management device, and referring to fig. 2, the method includes the following steps:
step 201: when a resource acquisition request sent by a task scheduling device is received, a target computing node capable of executing a target task is determined based on the target resource quantity carried in the resource acquisition request and the corresponding relation among the stored computing node identification, the free resource quantity and the resource version number, wherein the target resource quantity is the resource quantity required by the target task.
Step 202: and updating the number of idle resources of the target computing node and the corresponding resource version number in the corresponding relation based on the number of the target resources, and sending a resource acquisition response carrying the node identifier of the target computing node and the updated resource version number to the task scheduling device so that the task scheduling device issues the target task to the target computing node for execution.
Step 203: after the resource acquisition response is sent, when a resource reporting request sent by the target computing node is received and the resource version number carried in the resource reporting request is different from the updated resource version number, the update of the number of the idle resources of the target computing node in the corresponding relationship is abandoned.
Optionally, after discarding updating the number of free resources of the target computing node in the corresponding relationship, the method further includes:
starting timing;
and when the timing duration reaches a preset duration and the resource version numbers reported by the target computing node are different from the updated resource version number in the timing process, updating the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relationship into the number of the idle resources carried in the resource reporting request and the corresponding resource version number.
Optionally, after discarding updating the number of free resources of the target computing node in the corresponding relationship, the method further includes:
starting timing;
and when the timing duration reaches a preset duration and the resource version number reported by the target computing node is different from the updated resource version number in the timing process, updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource reporting request, and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node, so that the target computing node updates the recorded resource version number into the received resource version number.
Optionally, after discarding updating the number of free resources of the target computing node in the corresponding relationship, the method further includes:
sending prompt information to the target computing node, wherein the prompt information is used for prompting that the number of the idle resources reported by the target computing node and the corresponding resource version number are inconsistent with the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation;
receiving a resource updating request sent by a target computing node, wherein the resource updating request carries the number of idle resources recorded by the target computing node, and the resource updating request is sent when the target computing node receives the prompt message and starts timing, and when the timing duration reaches a preset duration and does not receive the prompt message with consistent resources in the timing process;
and updating the number of the idle resources of the target computing node in the corresponding relation into the number of the idle resources carried in the resource updating request, and sending the resource version number corresponding to the target computing node in the corresponding relation to the target computing node so that the target computing node updates the recorded resource version number into the received resource version number.
Optionally, the method further comprises:
when a resource reporting request sent by a target computing node is received and the currently received resource reporting request carries the number of idle resources, the corresponding resource version number and a request parameter, the number of the idle resources and the corresponding resource version number of the target computing node in the corresponding relation are updated to the number of the idle resources and the corresponding resource version number carried in the currently received resource reporting request, and the request parameter is used for indicating that the currently received resource reporting request is the resource reporting request sent by the target computing node for the first time after the target computing node is restarted.
In summary, in the embodiments of the present invention, a resource version number corresponding to the number of idle resources of a computing node is set, and when a resource reporting request sent by a target computing node is received and a resource version number carried in the resource reporting request is different from a resource version number corresponding to the number of idle resources of the target computing node in an updated corresponding relationship, the resource management device abandons updating the number of idle resources of the target computing node in the corresponding relationship, so as to avoid the problem that the resource management device mistakenly thinks that the number of idle resources in the target computing node is greater than the actual number of idle resources after updating the number of idle resources of the target computing node in the corresponding relationship when the resource version number carried in the resource reporting request received by the resource management device is different from the resource version number corresponding to the number of idle resources of the target computing node in the corresponding relationship, which results in resource management errors, the efficiency of resource management is improved.
Fig. 3 is a flowchart of a resource management method according to an embodiment of the present invention, and the embodiment of the present invention will be described with reference to fig. 3 for describing the above-mentioned embodiment shown in fig. 2. Referring to fig. 3, the method comprises the steps of:
step 301: when the task scheduling device receives the target task, the target resource quantity is determined, and a resource acquisition request is sent to the resource management device, wherein the resource acquisition request carries the target resource quantity, and the target resource quantity refers to the resource quantity required by the target task.
The task scheduler may be any one of the task schedulers in the resource management system shown above. The task scheduling device stores a preset corresponding relation between the task parameters and the resource quantity, and when the task scheduling device receives the target task, the corresponding resource quantity can be obtained from the corresponding relation between the task parameters and the resource quantity based on the task parameters of the target task, and the obtained resource quantity is determined as the target resource quantity. And then, sending a resource acquisition request carrying the number of the target resources to the resource management device.
For example, the correspondence relationship between the preset task parameters and the number of resources stored in the task scheduling device may be as shown in table 1 below, assuming that the target task is to store a piece of video, the resolution of the video is X, and assuming that the range to which the resolution of the video belongs is determined from the correspondence relationship shown in table 1 is X2< X ≦ X3. At this time, the resource quantity "3 GPU" corresponding to the resolution range X2< X ≦ X3 in Table 1 may be determined as the target resource quantity.
TABLE 1
Range of resolution Amount of resources
X1<X≤X2 1GPU
X2<X≤X3 2GPU
X3<X≤X4 3GPU
…… ……
It should be noted that, in the embodiment of the present invention, only the correspondence between the resolution range and the number of resources shown in table 1 is taken as an example to describe the correspondence between the stored task parameter and the number of resources, and table 1 does not limit the embodiment of the present invention.
Step 302: when the resource management device receives a resource acquisition request sent by the task scheduling device, a target computing node capable of executing a target task is determined based on the target resource quantity carried in the resource acquisition request and the corresponding relation among the stored computing node identification, the free resource quantity and the resource version number.
When the resource management device receives a resource acquisition request, all the computing nodes capable of executing the target task can be determined from the corresponding relations, and one computing node is selected from the determined computing nodes as a target computing node, wherein the computing nodes capable of executing the target task refer to all the computing nodes with the quantity of the idle resources not less than the quantity of the target resources.
For example, the correspondence among the computing node identifiers, the number of free resources, and the resource version number stored in the resource management device may be as shown in table 2 below, and assuming that the target resource number is "3 GPU", at this time, it may be determined from table 1 that there are two computing nodes whose number of free resources is greater than or equal to "3 GPU", which are "computing node 2" and "computing node 3", respectively, and assuming that "computing node 2" is selected as the target computing node.
TABLE 2
Computing node identification Amount of resources Resource version number
Computing node 1 2GPU 0
Computing node 2 3GPU 0
Computing node 3 6GPU 0
…… …… ……
It should be noted that, in the embodiment of the present invention, only the correspondence between the computing node identifier, the number of free resources, and the resource version number shown in table 2 is used for description, and table 2 does not limit the embodiment of the present invention.
In addition, when the resource management device receives the resource acquisition request and determines that a plurality of computing nodes capable of executing the target task are obtained from the stored corresponding relation according to the number of the target resources, in order to ensure the maximum idle resource utilization rate of the computing nodes, the resource management device may determine the difference between the number of the idle resources of the plurality of computing nodes and the number of the target resources, and then select the computing node with the minimum difference as the target computing node, so that when the target computing node executes the target task and the number of the remaining idle resources is not enough to execute other tasks, the resource waste is reduced as much as possible, and the resources are utilized to the maximum extent.
In practical application, when the resource management device determines from the stored corresponding relationship that there are a plurality of computing nodes capable of executing the target task, the computing node with the largest difference between the number of idle resources and the number of target resources may also be selected, and the selected computing node is determined as the target computing node, so that the target computing node still has enough remaining idle resources when executing the target task, and it is ensured that the target computing node does not affect the target computing node to execute other tasks when executing the target task. Of course, the target computing node may be determined in other ways, and the invention is not limited thereto.
Step 303: the resource management device updates the number of idle resources of the target computing node and the corresponding resource version number in the corresponding relation based on the number of the target resources, and sends a resource acquisition response carrying the node identification of the target computing node and the updated resource version number to the task scheduling device.
It should be noted that, when the resource management device updates the number of free resources of the target computing node in the corresponding relationship and the corresponding resource version number based on the number of the target resources, the resource management device may directly subtract the number of the target resources from the number of the free resources of the target computing node in the corresponding relationship, and use the obtained remaining number of resources as the updated number of the free resources of the target computing node in the corresponding relationship, so as to update the number of the free resources of the target computing node in the corresponding relationship.
The update of the resource version number corresponding to the target computing node in the corresponding relationship may be updated according to a preset policy, the preset policy may be preset, and the preset policy may be a linear policy, for example, a result obtained by adding 1 to the current resource version number is used as the updated resource version number, or a result obtained by subtracting 1 from the current resource version number is used as the updated resource version number, or other numbers may be added or subtracted; the preset policy may also be other updating policies, for example, a result obtained by squaring the current resource version number is used as the updated resource version number, and the present invention is not limited thereto.
Further, after the resource management device updates the resource version number corresponding to the target computing node in the corresponding relationship, the resource management device needs to carry the node identifier of the target computing node and the resource version number corresponding to the target computing node in a resource acquisition response, send the resource acquisition response to the task scheduling device, and respond to the resource acquisition request sent by the task scheduling device, indicating that the resource has been successfully applied to the resource.
Step 304: and when the task scheduling device receives the resource acquisition response sent by the resource management device, the target task is issued to the target computing node to be executed, and the target resource quantity and the updated resource version number are sent to the target computing node.
When the task scheduling device receives the resource acquisition response sent by the resource management device, the node identification of the target computing node and the updated resource version number carried in the resource acquisition response are acquired, the target task is issued to the target computing node according to the acquired node identification of the target computing node, and the target resource quantity and the updated resource version number are sent to the target computing node.
In addition, the target computing node periodically sends a resource reporting request to the resource management device, and when the target computing node receives the target task, the target computing node updates the number of the idle resources in the same manner as in step 303, and judges whether the relationship between the resource version number sent by the task scheduling device and the resource version number recorded by the target computing node conforms to a preset policy, if so, the resource version number recorded by the target computing node is updated to the resource version number sent by the task scheduling device; and if not, not updating the resource version number recorded by the user. Therefore, the number of the idle resources and the corresponding resource version number recorded by the resource management device are updated, and then a resource reporting request is sent to the resource management device, wherein the resource reporting request carries the number of the idle resources and the corresponding resource version number recorded by the target computing node.
Step 305: after the resource management device sends the resource acquisition response, when a resource reporting request sent by the target computing node is received and the resource version number carried in the resource reporting request is different from the updated resource version number, the resource management device abandons updating the number of the idle resources of the target computing node in the corresponding relationship.
When the resource version number carried in the resource reporting request is the same as the updated resource version number, the resource version number of the target computing node is consistent, and in order to prevent the situation that the target computing node releases the resource after executing the task, the resource management device may update the number of the idle resources of the target computing node in the corresponding relationship to the number of the idle resources carried in the resource reporting request.
It should be noted that, the target computing node may not successfully receive the target task due to the crash of the task scheduling device after requesting the resource, the network abnormality between the task scheduling device and the target computing node, the logic abnormality of the task scheduling device, and the like, so that the resource version number carried in the resource reporting request sent by the target computing node is different from the resource version number corresponding to the target computing node in the updated corresponding relationship in the resource management device. At this time, if the number of free resources of the target computing node in the corresponding relationship of the resource management device is updated, a problem of resource management error may be caused. Therefore, at this time, it is necessary to give up updating the number of free resources of the target compute node in the corresponding relationship.
In practical application, when the number of idle resources and the corresponding resource version number reported by the target computing node are inconsistent with the number of idle resources and the corresponding resource version number of the target computing node in the corresponding relationship for a long time, a problem occurs in the process of resource management.
There are three possible implementations of the process performed after the resource management device abandons updating the number of free resources of the target computing node in the corresponding relationship.
A first possible implementation: and the resource management device starts timing, and updates the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation into the number of the idle resources carried in the resource reporting request and the corresponding resource version number when the timing duration reaches a preset duration and the resource version numbers reported by the target computing node are different from the updated resource version number in the timing process.
It should be noted that, in the first possible implementation manner, only the resource management device needs to forcibly update the number of the idle resources of the target computing node and the corresponding resource version number in the stored corresponding relationship, so that the number of the idle resources and the corresponding resource version number reported by the target computing node are consistent with the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relationship of the resource management device, thereby avoiding an error in the resource management process, and the implementation process is relatively simple, and at the same time, time and resources can be saved.
A second possible implementation: and the resource management device starts timing, updates the number of the idle resources of the target computing node in the corresponding relation to the number of the idle resources carried in the resource reporting request when the timing duration reaches a preset duration and the resource version numbers reported by the target computing node are different from the updated resource version number in the timing process, and sends the updated resource version number to the target computing node so that the target computing node updates the recorded resource version number to the received resource version number.
It should be noted that, in the second possible implementation manner, the resource management device forcibly updates the number of idle resources of the target computing node in the stored corresponding relationship, so that the number of idle resources reported by the target computing node is consistent with the number of idle resources of the target computing node in the corresponding relationship of the resource management device, and sends the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node. And when the target computing node receives the resource version number sent by the resource management device, the resource version number recorded by the target computing node is updated to the received resource version number sent by the resource management device, so that the number of the idle resources recorded in the target computing node and the number of the idle resources of the corresponding resource version number in the corresponding relation between the target computing node and the resource management device are consistent with the corresponding resource version number, errors in the resource management process are avoided, and time and resources can be saved.
In addition, the second possible implementation manner is to confirm again that the number of the free resources and the corresponding resource version number of the target computing node are inconsistent with the number of the free resources and the corresponding resource version number of the target computing node in the corresponding relationship through interaction between the resource management device and the target computing node, so that the confirmation result is more accurate. When the number of the idle resources reported by the target computing node and the corresponding resource version number are inconsistent with the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation, and the inconsistent timing duration reaches the preset duration, forced updating is realized, errors in the resource management process are avoided, and the resource management efficiency is improved.
A third possible implementation: and the resource management device sends prompt information to the target computing node, wherein the prompt information is used for prompting that the number of the idle resources reported by the target computing node and the corresponding resource version number are inconsistent with the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation. And then, receiving a resource updating request sent by the target computing node, wherein the resource updating request carries the number of idle resources recorded by the target computing node, the resource updating request is sent when the target computing node receives the prompt message, the resource updating request is sent when the timing duration reaches a preset duration and the prompt message with consistent resources is not received in the timing process, the number of the idle resources of the target computing node in the corresponding relation is updated to the number of the idle resources carried in the resource updating request, and a resource version number corresponding to the target computing node in the corresponding relation is sent to the target computing node, so that the target computing node updates the recorded resource version number to the received resource version number.
It should be noted that, when receiving a resource update request sent by a target computing node, the resource management apparatus indicates that a duration in which the number of idle resources and the corresponding resource version number reported by the target computing node are inconsistent with the number of idle resources and the corresponding resource version number of the target computing node in the corresponding relationship has reached a preset duration, directly updates the number of idle resources of the target computing node in the corresponding relationship to the number of idle resources carried in the resource update request, and sends the resource version number corresponding to the number of idle resources of the target computing node in the corresponding relationship to the target computing node. And when the target computing node receives the resource version number sent by the resource management device, the resource version number corresponding to the recorded free resource number is updated to the received resource version number so as to keep the free resource number and the corresponding resource version number recorded by the target computing node consistent with the free resource number and the corresponding resource version number of the target computing node in the corresponding relation.
Moreover, the third possible implementation manner only needs to update the number of the idle resources of the target computing node in the corresponding relationship stored in the resource management device and the resource version number corresponding to the number of the idle resources stored in the target computing node, and confirms again that the number of the idle resources of the target computing node and the corresponding resource version number are not consistent with the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relationship through interaction between the resource management device and the target computing node, so that the confirmation result is more accurate. The forced updating is realized when the time length of the inconsistency between the number of the idle resources reported by the target computing node and the corresponding resource version number with the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation reaches the preset time length, errors in the resource management process are avoided, and the resource management efficiency is improved.
In addition, in practical application, when the target computing node and the resource management device are down, when the target computing node and the resource management device are recovered, a situation that the number of idle resources and the corresponding resource version number reported by the target computing node may not be consistent with the number of idle resources and the corresponding resource version number of the target computing node in the corresponding relationship may occur, or the number of idle resources and the corresponding resource version number of the target computing node may not be recorded in the corresponding relationship stored in the resource management device may occur.
The specific implementation process may be as follows: when a resource reporting request sent by a target computing node is received and the currently received resource reporting request carries the number of idle resources, the corresponding resource version number and a request parameter, the number of the idle resources and the corresponding resource version number of the target computing node in the corresponding relation are updated to the number of the idle resources and the corresponding resource version number carried in the currently received resource reporting request, and the request parameter is used for indicating that the currently received resource reporting request is the resource reporting request sent by the target computing node for the first time after the target computing node is restarted.
It should be noted that, because the request parameter is used to indicate the resource reporting request that is sent to the resource management device by the target computing node for the first time after the target computing node is restarted, when the resource management device receives the resource reporting request that is sent by the target computing node after the target computing node is restarted, it is not necessary to compare whether the number of the idle resources of the received target computing node and the corresponding resource version number are consistent with the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relationship, and the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relationship can be directly updated, thereby saving time and simplifying operation. Therefore, the resource reporting request sent by the target computing node for the first time after the restart carries the request parameter, and if the resource reporting request sent by the target computing node is not the resource reporting request sent for the first time after the restart, the request parameter does not need to be carried in the resource reporting request sent to the resource management device.
In summary, setting the resource version number corresponding to the computing node to indicate that the resources of the target computing node before and after updating are different, when the resource management device receives the resource reporting request sent by the target computing node and the resource version number carried in the resource reporting request is different from the resource version number corresponding to the target computing node in the updated corresponding relationship, abandoning updating the number of idle resources of the target computing node in the corresponding relationship, so as to prevent the resource management device from mistakenly considering that the number of idle resources in the target computing node is more than the actual number of idle resources after updating the number of idle resources of the target computing node in the corresponding relationship and the corresponding resource version number because the resource version number reported by the target computing node is different from the resource version number corresponding to the target computing node in the corresponding relationship of the resource management device, leading to resource management errors. In practical application, however, if the resource version number reported by the target computing node is inconsistent with the resource version number corresponding to the target computing node in the corresponding relationship of the resource management device for a long time, a resource management error is also caused, so in the embodiment of the invention, a timing mode is adopted, when the timing duration reaches a preset duration and the resource version number reported by the target computing node in the timing process is different from the resource version number corresponding to the target computing node in the updated corresponding relationship, the corresponding relationship is directly updated or the corresponding relationship and the record in the target computing node are updated, and a forced updating mode is adopted to ensure the consistency of the number of idle resources and the corresponding resource version number of the target computing node in the corresponding relationship of the resource management device and the actual number of idle resources and the corresponding resource version number in the target computing node, the efficiency of resource management is improved.
Fig. 4 is a schematic structural diagram of a resource management device according to an embodiment of the present invention. Referring to fig. 4, the apparatus includes: a determination module 401, a first sending module 402, a first updating module 403.
A determining module 401, configured to, when receiving a resource acquisition request sent by a task scheduling device, determine a target computing node capable of executing a target task based on a target resource quantity carried in the resource acquisition request and a correspondence between a stored computing node identifier, an idle resource quantity, and a resource version number, where the target resource quantity is a quantity of resources required for executing the target task;
a first sending module 402, configured to update the number of idle resources of the target computing node and the corresponding resource version number in the corresponding relationship based on the number of the target resources, and send a resource acquisition response carrying a node identifier of the target computing node and the updated resource version number to the task scheduling device, so that the task scheduling device issues the target task to the target computing node for execution;
a first updating module 403, configured to, after sending the resource obtaining response, when receiving a resource reporting request sent by a target computing node and a resource version number carried in the resource reporting request is different from an updated resource version number, abandon to update the number of idle resources of the target computing node in the corresponding relationship.
Optionally, the apparatus further comprises:
the first timing module is used for starting timing;
and the second updating module is used for updating the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation into the number of the idle resources carried in the resource reporting request and the corresponding resource version number when the timing duration reaches the preset duration and the resource version numbers reported by the target computing node are different from the updated resource version number in the timing process.
Optionally, the apparatus further comprises:
the second timing module is used for starting timing;
and the third updating module is used for updating the number of the idle resources of the target computing node in the corresponding relation to the number of the idle resources carried in the resource reporting request when the timing duration reaches the preset duration and the resource version numbers reported by the target computing node are different from the updated resource version numbers in the timing process, and sending the updated resource version numbers to the target computing node so that the target computing node updates the recorded resource version numbers to the received resource version numbers.
Optionally, the apparatus further comprises:
a second sending module, configured to send a prompt message to the target computing node, where the prompt message is used to prompt that the number of idle resources and the corresponding resource version number reported by the target computing node are inconsistent with the number of idle resources and the corresponding resource version number of the target computing node in the correspondence;
the receiving module is used for receiving a resource updating request sent by a target computing node, wherein the resource updating request carries the number of idle resources recorded by the target computing node, and the resource updating request is sent when the target computing node receives the prompt message and starts timing when the timing duration reaches a preset duration and does not receive the prompt message with consistent resources in the timing process;
and the fourth updating module is used for updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource updating request and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node so that the target computing node updates the recorded resource version number into the received resource version number.
Optionally, the apparatus further comprises:
and a fifth updating module, configured to update the number of idle resources and the corresponding resource version number of the target computing node in the corresponding relationship to the number of idle resources and the corresponding resource version number carried in the currently received resource reporting request when receiving the resource reporting request sent by the target computing node and the currently received resource reporting request carries the number of idle resources, the corresponding resource version number, and a request parameter, where the request parameter is used to indicate that the currently received resource reporting request is a resource reporting request that is first sent by the target computing node after being restarted.
In summary, in the embodiments of the present invention, the resource version number corresponding to the number of idle resources of a computing node is set to indicate that resources of a target computing node before update are different from resources of a target computing node after update, when a resource management device receives a resource reporting request sent by the target computing node, and a resource version number carried in the resource reporting request is different from a resource version number corresponding to the target computing node in an updated corresponding relationship, the resource management device abandons updating the number of idle resources of the target computing node in the corresponding relationship, so as to avoid a problem of resource management error after updating the number of idle resources of the target computing node in the corresponding relationship when the resource version number carried in the resource reporting request received by the resource management device is different from the resource version number corresponding to the target computing node in the corresponding relationship, and improve efficiency of resource management.
It should be noted that: in the resource management device provided in the foregoing embodiment, when performing resource management, only the division of the functional modules is illustrated, and in practical applications, the function allocation may be completed by different functional modules according to needs, that is, the internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the resource management apparatus and the resource management method provided in the foregoing embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
Fig. 5 is a schematic diagram of a resource management apparatus according to an embodiment of the present invention. The apparatus 500 may be a terminal. Referring to fig. 5, the terminal 500 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion video Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion video Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. Terminal 500 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and the like.
In general, the terminal 500 includes: a processor 501 and a memory 502.
The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 501 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 501 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, processor 501 may also include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
Memory 502 may include one or more computer-readable storage media, which may be non-transitory. Memory 502 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 502 is used to store at least one instruction for execution by processor 501 to implement the resource management methods provided by method embodiments of the present invention.
In some embodiments, the terminal 500 may further optionally include: a peripheral interface 503 and at least one peripheral. The processor 501, memory 502 and peripheral interface 503 may be connected by a bus or signal lines. Each peripheral may be connected to the peripheral interface 503 by a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 504, touch screen display 505, camera 506, audio circuitry 507, positioning components 508, and power supply 509.
The peripheral interface 503 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 501 and the memory 502. In some embodiments, the processor 501, memory 502, and peripheral interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 501, the memory 502, and the peripheral interface 503 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
The Radio Frequency circuit 504 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 504 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 504 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 504 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 504 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 505 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 505 is a touch display screen, the display screen 505 also has the ability to capture touch signals on or over the surface of the display screen 505. The touch signal may be input to the processor 501 as a control signal for processing. At this point, the display screen 505 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 505 may be one, providing the front panel of the terminal 500; in other embodiments, the display screens 505 may be at least two, respectively disposed on different surfaces of the terminal 500 or in a folded design; in still other embodiments, the display 505 may be a flexible display disposed on a curved surface or on a folded surface of the terminal 500. Even more, the display screen 505 can be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display screen 505 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 506 is used to capture images or video. Optionally, camera assembly 506 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 506 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
Audio circuitry 507 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 501 for processing, or inputting the electric signals to the radio frequency circuit 504 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 500. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 501 or the radio frequency circuit 504 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuitry 507 may also include a headphone jack.
The positioning component 508 is used for positioning the current geographic Location of the terminal 500 for navigation or LBS (Location Based Service). The Positioning component 508 may be a Positioning component based on the Global Positioning System (GPS) in the united states, the beidou System in china, or the galileo System in russia.
Power supply 509 is used to power the various components in terminal 500. The power source 509 may be alternating current, direct current, disposable or rechargeable. When power supply 509 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 500 also includes one or more sensors 510. The one or more sensors 510 include, but are not limited to: acceleration sensor 511, gyro sensor 512, pressure sensor 513, fingerprint sensor 514, optical sensor 515, and proximity sensor 516.
The acceleration sensor 511 may detect the magnitude of acceleration on three coordinate axes of the coordinate system established with the terminal 500. For example, the acceleration sensor 511 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 501 may control the touch screen 505 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 511. The acceleration sensor 511 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 512 may detect a body direction and a rotation angle of the terminal 500, and the gyro sensor 512 may cooperate with the acceleration sensor 511 to acquire a 3D motion of the user on the terminal 500. The processor 501 may implement the following functions according to the data collected by the gyro sensor 512: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensor 513 may be disposed on a side bezel of the terminal 500 and/or an underlying layer of the touch display screen 505. When the pressure sensor 513 is disposed on the side frame of the terminal 500, a user's holding signal of the terminal 500 may be detected, and the processor 501 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 513. When the pressure sensor 513 is disposed at the lower layer of the touch display screen 505, the processor 501 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 505. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 514 is used for collecting a fingerprint of the user, and the processor 501 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 514, or the fingerprint sensor 514 identifies the identity of the user according to the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, the processor 501 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 514 may be provided on the front, back, or side of the terminal 500. When a physical button or a vendor Logo is provided on the terminal 500, the fingerprint sensor 514 may be integrated with the physical button or the vendor Logo.
The optical sensor 515 is used to collect the ambient light intensity. In one embodiment, the processor 501 may control the display brightness of the touch display screen 505 based on the ambient light intensity collected by the optical sensor 515. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 505 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 505 is turned down. In another embodiment, processor 501 may also dynamically adjust the shooting parameters of camera head assembly 506 based on the ambient light intensity collected by optical sensor 515.
A proximity sensor 516, also referred to as a distance sensor, is typically disposed on the front panel of the terminal 500. The proximity sensor 516 is used to collect the distance between the user and the front surface of the terminal 500. In one embodiment, when the proximity sensor 516 detects that the distance between the user and the front surface of the terminal 500 gradually decreases, the processor 501 controls the touch display screen 505 to switch from the bright screen state to the dark screen state; when the proximity sensor 516 detects that the distance between the user and the front surface of the terminal 500 becomes gradually larger, the processor 501 controls the touch display screen 505 to switch from the screen-rest state to the screen-on state.
Those skilled in the art will appreciate that the configuration shown in fig. 5 is not intended to be limiting of terminal 500 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used. It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (15)

1. A resource management method is applied to a resource management device, and is characterized by comprising the following steps:
when a resource acquisition request sent by a task scheduling device is received, determining a target computing node capable of executing a target task based on the target resource quantity carried in the resource acquisition request and the corresponding relation among the stored computing node identification, the idle resource quantity and the resource version number, wherein the target resource quantity is the resource quantity required by the target task;
updating the number of idle resources and the corresponding resource version number of the target computing node in the corresponding relation based on the number of the target resources, and sending a resource acquisition response carrying the node identifier of the target computing node and the updated resource version number to the task scheduling device so that the task scheduling device issues the target task to the target computing node for execution;
after the resource acquisition response is sent, when a resource reporting request sent by the target computing node is received and the resource version number carried in the resource reporting request is different from the updated resource version number, the update of the number of the idle resources of the target computing node in the corresponding relation is abandoned according to the number of the idle resources carried in the resource reporting request.
2. The method of claim 1, wherein the abandoning further comprises, after updating the number of idle resources of the target computing node in the correspondence according to the number of idle resources carried in the resource reporting request:
starting timing;
and when the timing duration reaches a preset duration and the resource version numbers reported by the target computing node are different from the updated resource version number in the timing process, updating the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation into the number of the idle resources carried in the resource reporting request and the corresponding resource version number.
3. The method of claim 1, wherein the abandoning further comprises, after updating the number of idle resources of the target computing node in the correspondence according to the number of idle resources carried in the resource reporting request:
starting timing;
and when the timing duration reaches a preset duration and the resource version number reported by the target computing node is different from the updated resource version number in the timing process, updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource reporting request, and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node, so that the target computing node updates the recorded resource version number into the received resource version number.
4. The method of claim 1, wherein the abandoning further comprises, after updating the number of idle resources of the target computing node in the correspondence according to the number of idle resources carried in the resource reporting request:
sending a prompt message to the target computing node, wherein the prompt message is used for prompting that the number of idle resources reported by the target computing node and the corresponding resource version number are inconsistent with the number of idle resources of the target computing node and the corresponding resource version number in the corresponding relationship;
receiving a resource updating request sent by the target computing node, wherein the resource updating request carries the number of idle resources recorded by the target computing node, and the resource updating request is sent when the target computing node starts timing when receiving the prompt message and the timing duration reaches a preset duration and the prompt message with consistent resources is not received in the timing process;
and updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource updating request, and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node, so that the target computing node updates the recorded resource version number into the received resource version number.
5. The method of claim 1, wherein the method further comprises:
when a resource reporting request sent by the target computing node is received and the currently received resource reporting request carries the number of idle resources, the corresponding resource version number and a request parameter, the number of the idle resources and the corresponding resource version number of the target computing node in the corresponding relation are updated to the number of the idle resources and the corresponding resource version number carried in the currently received resource reporting request, and the request parameter is used for indicating that the currently received resource reporting request is a resource reporting request which is sent by the target computing node for the first time after the target computing node is restarted.
6. An apparatus for resource management, the apparatus comprising:
the system comprises a determining module and a task scheduling device, wherein the determining module is used for determining a target computing node capable of executing a target task based on the target resource quantity carried in a resource obtaining request and the corresponding relation among a stored computing node identifier, an idle resource quantity and a resource version number when the resource obtaining request sent by the task scheduling device is received, and the target resource quantity refers to the resource quantity required by the target task;
a first sending module, configured to update the number of idle resources of the target computing node and the corresponding resource version number in the corresponding relationship based on the number of the target resources, and send a resource acquisition response carrying a node identifier of the target computing node and the updated resource version number to the task scheduling device, so that the task scheduling device issues the target task to the target computing node for execution;
and after sending the resource acquisition response, when receiving a resource reporting request sent by the target computing node and the resource version number carried in the resource reporting request is different from the updated resource version number, the first updating module is configured to give up updating the number of the idle resources of the target computing node in the corresponding relationship according to the number of the idle resources carried in the resource reporting request.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the first timing module is used for starting timing;
and the second updating module is used for updating the number of the idle resources of the target computing node and the corresponding resource version number in the corresponding relation into the number of the idle resources carried in the resource reporting request and the corresponding resource version number when the timing duration reaches a preset duration and the resource version numbers reported by the target computing node are different from the updated resource version number in the timing process.
8. The apparatus of claim 6, wherein the apparatus further comprises:
the second timing module is used for starting timing;
and the third updating module is used for updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource reporting request and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node when the timing duration reaches a preset duration and the resource version number reported by the target computing node is different from the updated resource version number in the timing process, so that the target computing node updates the recorded resource version number into the received resource version number.
9. The apparatus of claim 6, wherein the apparatus further comprises:
a second sending module, configured to send a prompt message to the target computing node, where the prompt message is used to prompt that the number of idle resources and the corresponding resource version number reported by the target computing node are inconsistent with the number of idle resources and the corresponding resource version number of the target computing node in the correspondence;
a receiving module, configured to receive a resource update request sent by the target computing node, where the resource update request carries the number of idle resources recorded by the target computing node, and the resource update request starts timing when the target computing node receives the notification information, and is sent when a timing duration reaches a preset duration and the notification information with consistent resources is not received in a timing process;
and the fourth updating module is used for updating the number of the idle resources of the target computing node in the corresponding relationship into the number of the idle resources carried in the resource updating request, and sending the resource version number corresponding to the target computing node in the corresponding relationship to the target computing node, so that the target computing node updates the recorded resource version number into the received resource version number.
10. The apparatus of claim 6, wherein the apparatus further comprises:
a fifth updating module, configured to update the number of idle resources and the corresponding resource version number of the target computing node in the correspondence to the number of idle resources and the corresponding resource version number carried in the currently received resource reporting request when receiving the resource reporting request sent by the target computing node and the currently received resource reporting request carries the number of idle resources, the corresponding resource version number, and a request parameter, where the request parameter is used to indicate that the currently received resource reporting request is a resource reporting request that is first sent by the target computing node after being restarted.
11. A resource management system, characterized in that the resource management system comprises a resource management device, at least one task scheduling device and at least one compute node;
for any task scheduling device, the task scheduling device is configured to send a resource acquisition request to the resource management device, where the resource acquisition request carries a target resource quantity, and the target resource quantity refers to a resource quantity required for executing a target task;
the resource management device is used for receiving the resource acquisition request, determining a target computing node capable of executing the target task based on the target resource quantity and the corresponding relation among the stored computing node identification, the free resource quantity and the resource version number, updating the free resource quantity and the corresponding resource version number of the target computing node in the corresponding relation based on the target resource quantity, and sending a resource acquisition response carrying the node identification of the target computing node and the updated resource version number to the task scheduling device;
the task scheduling device is further configured to receive the resource acquisition response, issue the target task to the target computing node for execution based on the node identifier of the target computing node, and send the number of the target resources and the updated resource version number to the target computing node when the target task is issued;
and after sending the resource acquisition response, when receiving a resource reporting request sent by the target computing node and the resource version number carried in the resource reporting request is different from the updated resource version number, the resource management device is further configured to give up updating the number of idle resources of the target computing node in the corresponding relationship according to the number of idle resources carried in the resource reporting request.
12. The resource management system of claim 11, wherein the target computing node is configured to update the resource version number recorded by the target computing node according to the resource version number sent by the task scheduling device when receiving the target task issued by the task scheduling device.
13. The resource management system of claim 12, wherein the target computing node is further configured to determine whether a relationship between the resource version number sent by the task scheduling device and the resource version number recorded by the target computing node complies with a preset policy before updating the resource version number recorded by the target computing node according to the resource version number sent by the task scheduling device, and if so, update the resource version number recorded by the target computing node to the resource version number sent by the task scheduling device; and if not, not updating the resource version number recorded by the user.
14. A terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor is configured to perform the steps of any of the methods of claims 1-5.
15. A computer-readable storage medium having stored therein instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1-5.
CN201711445115.1A 2017-12-27 2017-12-27 Resource management method, device and storage medium Active CN109981310B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711445115.1A CN109981310B (en) 2017-12-27 2017-12-27 Resource management method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711445115.1A CN109981310B (en) 2017-12-27 2017-12-27 Resource management method, device and storage medium

Publications (2)

Publication Number Publication Date
CN109981310A CN109981310A (en) 2019-07-05
CN109981310B true CN109981310B (en) 2022-02-11

Family

ID=67071660

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711445115.1A Active CN109981310B (en) 2017-12-27 2017-12-27 Resource management method, device and storage medium

Country Status (1)

Country Link
CN (1) CN109981310B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103049334A (en) * 2012-12-14 2013-04-17 华为技术有限公司 Task processing method and virtual machine
CN103810045A (en) * 2012-11-09 2014-05-21 阿里巴巴集团控股有限公司 Resource allocation method, resource manager, resource server and system
CN105005506A (en) * 2015-07-17 2015-10-28 中国人民解放军国防科学技术大学 Virtual cloud fault-tolerant resource supply method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005089241A2 (en) * 2004-03-13 2005-09-29 Cluster Resources, Inc. System and method for providing object triggers
US10318487B2 (en) * 2014-08-20 2019-06-11 International Business Machines Corporation Sharing resources among remote repositories utilizing a lock file in a shared file system or a node graph in a peer-to-peer system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103810045A (en) * 2012-11-09 2014-05-21 阿里巴巴集团控股有限公司 Resource allocation method, resource manager, resource server and system
CN103049334A (en) * 2012-12-14 2013-04-17 华为技术有限公司 Task processing method and virtual machine
CN105005506A (en) * 2015-07-17 2015-10-28 中国人民解放军国防科学技术大学 Virtual cloud fault-tolerant resource supply method

Also Published As

Publication number Publication date
CN109981310A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
CN111225042B (en) Data transmission method and device, computer equipment and storage medium
CN110278464B (en) Method and device for displaying list
CN110659127A (en) Method, device and system for processing task
CN108897659B (en) Method, device and storage medium for modifying log level
CN108848492B (en) Method, device, terminal and storage medium for starting user identity identification card
CN111400002B (en) Application process and processor core binding method and terminal
CN109783176B (en) Page switching method and device
CN109697113B (en) Method, device and equipment for requesting retry and readable storage medium
CN108401194B (en) Time stamp determination method, apparatus and computer-readable storage medium
CN110673944A (en) Method and device for executing task
CN112181915B (en) Method, device, terminal and storage medium for executing service
CN110381155B (en) Task management method, device, storage medium and terminal
CN112612539A (en) Data model unloading method and device, electronic equipment and storage medium
CN110086814B (en) Data acquisition method and device and storage medium
CN109688064B (en) Data transmission method and device, electronic equipment and storage medium
CN111881423A (en) Method, device and system for limiting function use authorization
CN111258683A (en) Detection method, detection device, computer equipment and storage medium
CN111914985A (en) Configuration method and device of deep learning network model and storage medium
CN113099378B (en) Positioning method, device, equipment and storage medium
CN112597417B (en) Page updating method and device, electronic equipment and storage medium
CN111294470B (en) Call processing method, device, equipment and storage medium
CN110971692B (en) Method and device for opening service and computer storage medium
CN109981310B (en) Resource management method, device and storage medium
CN112015612B (en) Method and device for acquiring stuck information
CN108632459B (en) Communication information notification method and device and computer readable 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
GR01 Patent grant
GR01 Patent grant