CN116048818B - Resource allocation method and device - Google Patents

Resource allocation method and device Download PDF

Info

Publication number
CN116048818B
CN116048818B CN202310325288.9A CN202310325288A CN116048818B CN 116048818 B CN116048818 B CN 116048818B CN 202310325288 A CN202310325288 A CN 202310325288A CN 116048818 B CN116048818 B CN 116048818B
Authority
CN
China
Prior art keywords
code
resource
predicted
resources
operation instruction
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
CN202310325288.9A
Other languages
Chinese (zh)
Other versions
CN116048818A (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.)
Beijing Baihai Technology Co ltd
Original Assignee
Beijing Baihai 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 Beijing Baihai Technology Co ltd filed Critical Beijing Baihai Technology Co ltd
Priority to CN202310325288.9A priority Critical patent/CN116048818B/en
Publication of CN116048818A publication Critical patent/CN116048818A/en
Application granted granted Critical
Publication of CN116048818B publication Critical patent/CN116048818B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a resource allocation method and a device, wherein the method is applied to a server and comprises the following steps: receiving an operation instruction executed by a user in a code editing page; determining whether the operation instruction is a click instruction for executing a button in the code editing page; if the operation instruction is a click instruction of an execution button in the code editing page, determining a code edited by a user in a code editing area of the code editing page, a programming language of the configured code and an operating system of an application; matching according to programming language and an operating system and a resource allocation table, and determining predicted resources occupied by code execution; the prediction resources are allocated to the code to execute the code. According to the method and the device, the operation instruction is determined at which stage of code editing according to the operation instruction of the user, so that corresponding resources are correspondingly allocated, the technical problem of resource waste in the prior art is solved, and the technical effects of saving resources and reducing cost are achieved.

Description

Resource allocation method and device
Technical Field
The present disclosure relates to the field of code editing technologies, and in particular, to a resource allocation method and apparatus.
Background
In the prior art, after development, debugging and training of codes are all completed in one platform, the codes are packaged into data packets, and the data packets are placed in another platform to run. Furthermore, development engineers need to grasp the operation modes of the two platforms, which is inefficient and costly. Or, in the prior art, there is a mode of coupling the development, debugging, training and running of the code into one platform, but no matter what operation the user performs on the development, debugging, training and running of the code, the same resources are allocated to the user for use, so that resource waste is caused.
Disclosure of Invention
Accordingly, the present application aims to provide at least a resource allocation method and apparatus, which determines which stage of code editing the operation instruction is in according to the operation instruction of the user, so as to allocate corresponding resources correspondingly, thereby solving the technical problem of resource waste caused by no allocation of resources based on the operation instruction of the user in the prior art, and achieving the technical effects of saving resources and reducing cost.
The application mainly comprises the following aspects:
in a first aspect, an embodiment of the present application provides a method for allocating resources, where the method is applied to a server, and the method includes: receiving an operation instruction executed by a user in a code editing page; determining whether the operation instruction is a click instruction of an execution button in the code editing page; if the operation instruction is a click instruction of an execution button in the code editing page, determining a code edited by a user in a code editing area of the code editing page, and a configured programming language of the code and an operating system of an application; according to the programming language and the comparison between the operating system and the resource allocation table, determining the predicted resources occupied by the code when executing; the predicted resources are allocated to the code to execute the code.
Optionally, the method comprises: if the operation instruction is not a click instruction of an execution button in the code editing page, determining whether the current idle resource of the server is larger than a first preset resource or not; if the current idle resource of the server is larger than the first preset resource, the first preset resource is allocated in the current idle resource so as to execute the operation instruction.
Optionally, before said allocating said prediction resources to said code for executing said code, said method comprises: determining whether a current idle resource of the server is greater than the predicted resource; if the current idle resource of the server is larger than the predicted resource, determining an execution mode of the code according to the predicted resource; and if the current idle resource of the server is smaller than or equal to the predicted resource, monitoring the current idle resource of the server.
Optionally, determining the execution mode of the code according to the prediction resource includes: determining whether the predicted resource is greater than a second preset resource; if the predicted resource is smaller than or equal to a second preset resource, the code execution mode is single-machine operation; and if the predicted resource is larger than the second preset resource, the code is executed in a distributed mode.
Optionally, after the determining whether the operation instruction is a click instruction of an execution button in the code editing page, the method further includes: if the operation instruction is a click instruction of an execution button in the code editing page, determining configuration resources occupied by the code configured by a user when executing; the configuration resources are allocated to the code to execute the code.
Optionally, allocating the configuration resource to the code to execute the code includes: determining whether the configuration resource is greater than the predicted resource; if the configuration resource is larger than the predicted resource, replacing the predicted resource with the configuration resource; and if the configuration resource is smaller than or equal to the prediction resource, allocating the configuration resource to the code to execute the code.
Optionally, the resources include: CPU core number, GPU core number and memory.
In a second aspect, embodiments of the present application further provide a resource allocation apparatus, where the apparatus includes: the receiving module is used for receiving an operation instruction executed by a user in the code editing page; the first determining module is used for determining whether the operation instruction is a clicking instruction of an execution button in the code editing page; the second determining module is used for determining codes edited by a user in a code editing area of the code editing page and configured programming languages of the codes and an operating system of an application if the operating instruction is a click instruction of an execution button in the code editing page; the third determining module is used for determining the prediction resources occupied by the code execution according to the programming language and the comparison between the operating system and the resource allocation table; and the allocation module is used for allocating the prediction resources to the codes so as to execute the codes.
In a third aspect, embodiments of the present application further provide an electronic device, including: a processor, a memory and a bus, the memory storing machine readable instructions executable by the processor, the processor and the memory in communication via the bus when the electronic device is running, the machine readable instructions when executed by the processor performing the steps of the resource allocation method as described in the first aspect or any of the possible implementation manners of the first aspect.
In a fourth aspect, the embodiments of the present application further provide a computer readable storage medium, on which a computer program is stored, which when executed by a processor performs the steps of the resource allocation method described in the first aspect or any of the possible implementation manners of the first aspect.
The embodiment of the application provides a resource allocation method and device, wherein the method is applied to a server and comprises the following steps: receiving an operation instruction executed by a user in a code editing page; determining whether the operation instruction is a click instruction of an execution button in the code editing page; if the operation instruction is a click instruction of an execution button in the code editing page, determining a code edited by a user in a code editing area of the code editing page, and a configured programming language of the code and an operating system of an application; according to the programming language and the comparison between the operating system and the resource allocation table, determining the predicted resources occupied by the code when executing; the predicted resources are allocated to the code to execute the code. By determining which stage of code editing the operation instruction is in according to the operation instruction of the user, corresponding resources are correspondingly allocated, the technical problem of resource waste caused by the fact that resources are not allocated based on the operation instruction of the user in the prior art is solved, and the technical effects of fully utilizing the resources and reducing the cost are achieved. For users, development of code (editing code) and execution code (debugging, training and running code) do not operate on two platforms separately, improving efficiency. And the user cannot perceive the resource allocation, so that the use feeling of the user is improved.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 shows a flowchart of a resource allocation method according to an embodiment of the present application.
Fig. 2 shows a flowchart of another resource allocation method provided in an embodiment of the present application.
Fig. 3 shows a functional block diagram of a resource allocation device according to an embodiment of the present application.
Fig. 4 shows a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the accompanying drawings in the present application are only for the purpose of illustration and description, and are not intended to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this application, illustrates operations implemented according to some embodiments of the present application. It should be appreciated that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to the flow diagrams and one or more operations may be removed from the flow diagrams as directed by those skilled in the art.
In addition, the described embodiments are only some, but not all, of the embodiments of the present application. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
In the prior art, development tools of codes, such as Jupyter notbook (Jupyter for short), visual Studio Code (VSCode for short), and PyCharm for short, couple the development, debugging, training and running of codes together. When a user develops, only a small part of resources are actually needed, and only when the user debugs, trains and runs, particularly when the user trains, a lot of resources are needed, so that the resource waste is serious.
Or, in the prior art, after development, debugging and training are completed by one platform, the code is packaged into an image package, and then the code is run through another platform. Thus, although the running, development, debugging and training are separated, the user is actually required to master the operation modes of the two platforms, so that the efficiency is low and the cost is high. And the development stage of the code on a platform needs little resources, and the debugging and training on the platform also needs a large amount of resources, which still causes resource waste.
Based on the above, the embodiment of the application provides a resource allocation method and device, which determine which stage of code editing the operation instruction is in according to the operation instruction of the user, so as to correspondingly allocate corresponding resources, solve the technical problem of resource waste caused by no allocation of resources based on the operation instruction of the user in the prior art, and achieve the technical effects of saving resources and reducing cost. The method comprises the following steps:
referring to fig. 1, fig. 1 is a flowchart of a resource allocation method according to an embodiment of the present application. As shown in fig. 1, the method for allocating resources provided in the embodiments of the present application is applied to a server, which may be a cluster server. The method comprises the following steps:
s101: and receiving an operation instruction executed by a user in the code editing page.
That is, an operation instruction by the user in the code editing page is received.
The code editing page contains a code list and an add code button. The code list displays all the codes saved by the user, and the new code adding button is used for adding a code item in the code list.
Receiving a click instruction of a user on a newly added code button, wherein a code list correspondingly displays the label of the newly added code item and a code name configuration frame; and taking the information input by the user in the code name configuration box as the code name of the newly added code item. And receiving a click instruction of a user on a newly added code item in the code list, and displaying a code editing area corresponding to the newly added code item on the code editing page.
After receiving the click command of the user on the newly added code item in the code list, the code editing page also displays a data source reference button, a programming language configuration item, an operating system configuration item, an editing completion button and an execution button. And receiving a click command of a user on a data source reference button, displaying a plurality of data sources, and selecting the data source required by the code item from the plurality of data sources by the user so as to finish the reference of the data source. And receiving clicking instructions of users on the programming language configuration items, displaying a plurality of programming languages, and selecting the programming language used by the code item from the plurality of programming languages by the users. The programming language includes: java, python, etc. And receiving a click instruction of a user on the operating system configuration item, displaying a plurality of operating systems, and selecting the operating system of the code item application from the operating systems by the user. The operating system includes: linux, UNIX, windows, etc.
After the user completes the configuration of the data source, programming language, and operating system, the user may edit the code in the code editing area. And taking the codes in the code editing area as codes corresponding to the newly added code items. Further, after the user completes editing the code in the code editing area of the code editing page, the server receives a click command of the edit completion button of the code editing page from the user, and the server receives the code edited by the user in the code editing area of the code editing page.
The user causes the code edited in the code editing area to be executed by clicking an execution button of the code editing page. Wherein, the corresponding operation of the execution button is to run the code, and the training, debugging and running all need to run the code.
S102: it is determined whether the operation instruction is a click instruction for an execution button in the code editing page.
That is, it is determined whether or not the operation instruction by the user is a click instruction of the execution button in the code editing page.
After the user clicks the execute button, the server executes the code in the code editing area. If errors are reported in the execution process, the user debugs the codes in the code editing area so as to realize the debugging of the codes. If the user clicks the execution button multiple times, the data sources referenced by the code are modified before clicking the execution button each time, that is, the code references different data sources are respectively executed multiple times, so as to train the code in real time. If the user clicks the execution button again after debugging and training to verify that the code will not be reported wrong and the desired data can be successfully obtained to realize that the code can be correctly operated.
Further, no matter which operation is performed to train, debug, and run the code by clicking the execution button, the user allocates the resource corresponding to the code by clicking the execution button. The resources include: CPU core number, GPU core number and memory.
S103: determining codes edited by a user in a code editing area of the code editing page, programming languages of the configured codes and an operating system of an application.
And if the operation instruction is a click instruction of an execution button in the code editing page, determining codes edited by a user in a code editing area of the code editing page, and configured programming languages of the codes and an operating system of an application.
If the operation instruction is not a click instruction of an execution button in the code editing page, determining whether the current idle resource of the server is larger than a first preset resource or not; if the current idle resource of the server is larger than the first preset resource, the first preset resource is allocated in the current idle resource so as to execute the operation instruction; if the current idle resource of the server is smaller than or equal to the first preset resource, the current idle resource of the server is monitored, and whether the current idle resource of the server is larger than the first preset resource is determined again.
The first preset resource may be set to have a CPU core number of 1, a gpu core number of 0, and a memory number of 2G. If the operation instruction executed by the user is not a click instruction of the execution button, the user may edit the code in the code editing area, or configure the programming language and the operating system of the application, so that large resources are not required to execute the operations. Furthermore, no matter what kind of operation is executed in the code editing page when the user enters, as long as the clicking operation of the execution button is not needed, the first preset resource is allocated in the current idle resource of the server to execute the operations, and redundant resources are not occupied.
S104: and comparing the programming language, the operating system and the resource allocation table to determine the predicted resources occupied by the code when executing.
That is, the programming language of the code and the predicted resources corresponding to the operating system are determined by consulting the resource allocation table. The resource allocation table defines the predicted resources corresponding to the code for each code language and each operating system.
Referring to table 1, table 1 is a resource allocation table provided in the embodiments of the present application.
Figure SMS_1
As shown in table 1, if the programming language of the current code is Java and the operating system of the application is Linux, determining that the predicted resource required for executing the current code is a according to the resource allocation table 1 CPU of core, GPU of 0 core and b 1 G memory.
The resource allocation table is summarized by performing a large number of tests in advance. Illustratively, for programming language Java, the operating system of the application is Linux code: the method comprises the steps of respectively executing the preset number of programming languages as Java, the applied operating system as the code of Linux, determining the resources occupied by each code in the preset number of codes when executing, arranging the resources occupied by each code in an ascending order, taking the resources positioned at the preset number of bits after the arrangement as the programming language as Java, and the applied operating system as the predicted resources of the code of Linux.
The resource allocation table may also be updated after each click of the execute button by the user. That is, if the user clicks the execution button for the current code, the programming language of the current code is Java, the operating system of the application is Linux, and predicted resources are allocated to the current code according to the resource allocation table, but the actual resources occupied by the current code are smaller than the allocated predicted resources, the actual resources occupied by the current code and the resources occupied by each code in the preset number of codes when executing are arranged in ascending order, the resources located in the preset number of bits after the arrangement are updated to be the predicted resources of the code whose programming language is Java, and the operating system of the application is Linux.
S105: the prediction resources are allocated to the code to execute the code.
For example, if the programming language of the current code is Java and the operating system of the application is Linux, determining that the predicted resource required for executing the current code is a according to the resource allocation table 1 CPU of core, GPU of 0 core and b 1 G memory. Then allocate a from the current idle resources of the server 1 CPU of core, GPU of 0 core and b 1 And G, a memory used for executing the codes.
Before the allocating the prediction resources to the code to execute the code, the method includes: determining whether a current idle resource of the server is greater than the predicted resource; if the current idle resource of the server is larger than the predicted resource, determining an execution mode of the code according to the predicted resource; and if the current idle resource of the server is smaller than or equal to the predicted resource, monitoring the current idle resource of the server.
That is, if the current idle resource of the server is less than or equal to the predicted resource, the current idle resource of the server is monitored and it is re-determined whether the current idle resource of the server is greater than the predicted resource.
Referring to fig. 2, fig. 2 is a flowchart illustrating steps for determining an execution mode of a code according to a predicted resource according to an embodiment of the present application. As shown in fig. 2, determining the execution mode of the code according to the prediction resource includes:
s201: it is determined whether the predicted resource is greater than a second preset resource.
S202: the code is executed in a single machine.
If the predicted resource is smaller than or equal to the second preset resource, the code execution mode is single-machine operation.
S203: the code is executed in a distributed mode.
If the predicted resource is greater than the second preset resource, the code is executed in a distributed mode.
That is, if the predicted resource is less than or equal to the second preset resource, executing the code in a single machine operation mode; and if the predicted resource is larger than the second preset resource, executing the code in a distributed running mode.
After the determining whether the operation instruction is a click instruction of an execution button in the code editing page, the method further includes: if the operation instruction is a click instruction of an execution button in the code editing page, determining configuration resources occupied by the code configured by a user when executing; the configuration resources are allocated to the code to execute the code.
That is, the code editing page also includes resource configuration items including a CPU core number configuration item, a GPU core number configuration item, and a memory configuration item. Receiving CPU cores configured by a CPU core configuration item, GPU cores configured by a GPU core configuration item and a memory configured by a memory configuration item from a user; and taking the CPU core number, the GPU core number and the memory configured by the user as configuration resources.
Allocating the configuration resources to the code to execute the code, comprising: determining whether the configuration resource is greater than the predicted resource; if the configuration resource is larger than the predicted resource, replacing the predicted resource with the configuration resource; and if the configuration resource is smaller than or equal to the prediction resource, allocating the configuration resource to the code to execute the code.
That is, if the configuration resource is larger than the predicted resource, the predicted resource is still allocated for executing the code, so as to save the resource; if the configuration resources are less than or equal to the predicted resources, the configuration resources are allocated to the code to execute the code, and although the configuration resources are less, the code can still be executed, and the code may be executed for a longer time.
The code editing page also includes a priority configuration item. Receiving a priority value configured by a user on a priority configuration item, wherein the smaller the priority value is, the higher the priority is represented; determining whether the priority value corresponding to the code in the code of the current resource to be allocated is smaller than the priority value configured by the user; if the priority value corresponding to the code in the code queue of the current resource to be allocated is smaller than the priority value configured by the user, inserting the code corresponding to the priority value configured by the user into the code queue of the current resource to be allocated according to the priority value configured by the user; and if no code corresponding priority value in the code queue of the current resource to be allocated is smaller than the priority value configured by the user, arranging the code corresponding to the priority value configured by the user to the first bit of the code queue.
Fig. 3 is a functional block diagram of a resource allocation device according to an embodiment of the present application, as shown in fig. 3. The resource allocation device 10 includes: a receiving module 101, a first determining module 102, a second determining module 103, a third determining module 104 and an allocating module 105.
A receiving module 101, configured to receive an operation instruction executed by a user in a code editing page; a first determining module 102, configured to determine whether the operation instruction is a click instruction for an execution button in the code editing page; a second determining module 103, configured to determine a code edited by a user in a code editing area of the code editing page, and a configured programming language of the code and an operating system of an application if the operation instruction is a click instruction of an execution button in the code editing page; a third determining module 104, configured to determine a predicted resource occupied by the code when executing according to the programming language and the comparison between the operating system and the resource allocation table; an allocation module 105, configured to allocate the prediction resource to the code, so as to execute the code.
Based on the same application concept, referring to fig. 4, which is a schematic structural diagram of an electronic device provided in an embodiment of the present application, the electronic device 20 includes: a processor 201, a memory 202 and a bus 203, said memory 202 storing machine readable instructions executable by said processor 201, said processor 201 and said memory 202 communicating via said bus 203 when said electronic device 20 is running, said machine readable instructions being executed by said processor 201 to perform the steps of the resource allocation method according to any of the above embodiments.
In particular, the machine readable instructions, when executed by the processor 201, may perform the following: receiving an operation instruction executed by a user in a code editing page; determining whether the operation instruction is a click instruction of an execution button in the code editing page; if the operation instruction is a click instruction of an execution button in the code editing page, determining a code edited by a user in a code editing area of the code editing page, and a configured programming language of the code and an operating system of an application; according to the programming language and the comparison between the operating system and the resource allocation table, determining the predicted resources occupied by the code when executing; the predicted resources are allocated to the code to execute the code.
Based on the same application concept, the embodiment of the present application further provides a computer readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the resource allocation method provided in the foregoing embodiment are performed.
Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, and the like, and when the computer program on the storage medium is run, the above-mentioned resource allocation method can be executed, and by determining which stage of code editing the operation instruction is in according to the operation instruction of the user, corresponding resources are allocated correspondingly, so that the technical problem of resource waste caused by no allocation of resources based on the operation instruction of the user in the prior art is solved, and the technical effects of saving resources and reducing cost are achieved.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solutions of the present application may be embodied in essence or a part contributing to the prior art or a part of the technical solutions, or in the form of a software product, which is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes or substitutions are covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (9)

1. A method for allocating resources, the method being applied to a server, the method comprising:
receiving an operation instruction executed by a user in a code editing page;
determining whether the operation instruction is a click instruction of an execution button in the code editing page;
if the operation instruction is a click instruction of an execution button in the code editing page, determining a code edited by a user in a code editing area of the code editing page, and a configured programming language of the code and an operating system of an application;
according to the programming language and the comparison between the operating system and the resource allocation table, determining the predicted resources occupied by the code when executing;
allocating the predicted resources to the code to execute the code;
the method comprises the following steps: if the operation instruction is not a click instruction of an execution button in the code editing page, determining whether the current idle resource of the server is larger than a first preset resource or not;
if the current idle resource of the server is larger than the first preset resource, the first preset resource is allocated in the current idle resource so as to execute the operation instruction.
2. The method of claim 1, wherein prior to said allocating said predicted resources to said code to execute said code, said method comprises:
determining whether a current idle resource of the server is greater than the predicted resource;
if the current idle resource of the server is larger than the predicted resource, determining an execution mode of the code according to the predicted resource;
and if the current idle resource of the server is smaller than or equal to the predicted resource, monitoring the current idle resource of the server.
3. The method of claim 2, wherein determining the execution mode of the code according to the prediction resource comprises:
determining whether the predicted resource is greater than a second preset resource;
if the predicted resource is smaller than or equal to a second preset resource, the code execution mode is single-machine operation;
and if the predicted resource is larger than the second preset resource, the code is executed in a distributed mode.
4. The method of claim 1, wherein after the determining whether the operation instruction is a click instruction to an execution button in the code editing page, the method further comprises:
if the operation instruction is a click instruction of an execution button in the code editing page, determining configuration resources occupied by the code configured by a user when executing;
the configuration resources are allocated to the code to execute the code.
5. The method of claim 4, wherein the allocating the configuration resources to the code to execute the code comprises:
determining whether the configuration resource is greater than the predicted resource;
if the configuration resource is larger than the predicted resource, replacing the predicted resource with the configuration resource;
and if the configuration resource is smaller than or equal to the prediction resource, allocating the configuration resource to the code to execute the code.
6. The method of claim 1, wherein the resources comprise: CPU core number, GPU core number and memory.
7. A resource allocation apparatus, the apparatus comprising:
the receiving module is used for receiving an operation instruction executed by a user in the code editing page;
the first determining module is used for determining whether the operation instruction is a clicking instruction of an execution button in the code editing page;
the second determining module is used for determining codes edited by a user in a code editing area of the code editing page and configured programming languages of the codes and an operating system of an application if the operating instruction is a click instruction of an execution button in the code editing page;
the third determining module is used for determining the prediction resources occupied by the code execution according to the programming language and the comparison between the operating system and the resource allocation table;
an allocation module for allocating the predicted resources to the code to execute the code;
a fourth determining module, configured to determine whether a current idle resource of the server is greater than a first preset resource if the operation instruction is not a click instruction of an execution button in the code editing page;
and the first preset resource allocation module is used for allocating a first preset resource from the current idle resource of the server if the current idle resource of the server is larger than the first preset resource so as to execute the operation instruction.
8. An electronic device, comprising: a processor, a memory and a bus, said memory storing machine readable instructions executable by said processor, said processor and said memory communicating via said bus when the electronic device is running, said machine readable instructions when executed by said processor performing the steps of the resource allocation method according to any of claims 1 to 6.
9. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of the resource allocation method according to any of claims 1 to 6.
CN202310325288.9A 2023-03-30 2023-03-30 Resource allocation method and device Active CN116048818B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310325288.9A CN116048818B (en) 2023-03-30 2023-03-30 Resource allocation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310325288.9A CN116048818B (en) 2023-03-30 2023-03-30 Resource allocation method and device

Publications (2)

Publication Number Publication Date
CN116048818A CN116048818A (en) 2023-05-02
CN116048818B true CN116048818B (en) 2023-07-04

Family

ID=86129892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310325288.9A Active CN116048818B (en) 2023-03-30 2023-03-30 Resource allocation method and device

Country Status (1)

Country Link
CN (1) CN116048818B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977260B (en) * 2017-11-23 2020-08-28 鼎富智能科技有限公司 Task submitting method and device
US11481201B2 (en) * 2020-03-05 2022-10-25 Intuit Inc. Integrated development environment for developing and compiling query language schemas for application program interfaces
US11347488B2 (en) * 2020-05-18 2022-05-31 Fortinet, Inc. Compiling domain-specific language code to generate executable code targeting an appropriate type of processor of a network device
CN112558953A (en) * 2020-12-23 2021-03-26 广州密码营地教育科技有限公司 Programming implementation method, device and equipment based on graphical editor

Also Published As

Publication number Publication date
CN116048818A (en) 2023-05-02

Similar Documents

Publication Publication Date Title
CN100390740C (en) Method and system for allocating entitled processor cycles for preempted virtual processors
CN110908697B (en) Resource packaging method, device, server and storage medium
CN104252391A (en) Method and device used for managing multiple operations in distributed computation system
CN110059456B (en) Code protection method, code protection device, storage medium and electronic equipment
CN110908707B (en) Resource packaging method, device, server and storage medium
CN109828859B (en) Mobile terminal memory analysis method and device, storage medium and electronic equipment
CN114089975B (en) Expansion method and device of computing software, nonvolatile storage medium and processor
CN110825428A (en) State machine configuration method, device, equipment and readable storage medium
CN114818565A (en) Simulation environment management platform, method, equipment and medium based on python
US7610429B2 (en) Method and system for determining device criticality in a computer configuration
CN105389190A (en) Operating system starting method, apparatus and system
CN104731626A (en) Application installation method and device
TW202018500A (en) Saving and restoring machine state between multiple executions of an instruction
CN111427548B (en) Plug-in development method and system based on process
CN116048818B (en) Resource allocation method and device
CN111880803B (en) Software construction method and device applied to multiple platforms
CN109901831A (en) The multi-platform compatibility operation method and compatibility operation device of software
US8819494B2 (en) Automatically changing parts in response to tests
US9934035B2 (en) Device and method for tracing updated predicate values
CN112948173A (en) Data recovery method, device, equipment and medium
CN105138666A (en) Data processing method and terminal
US8799616B2 (en) Method and system for preferred CPU binding on virtual partitions
CN115396534A (en) Service message processing method and device
CN112698918A (en) Virtual machine file generation method and device based on construction environment
CN117667407A (en) Method, device, equipment and medium for acquiring configuration data of load balancing equipment

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