Disclosure of Invention
First, the technical problem to be solved
In view of the above-mentioned shortcomings and disadvantages of the prior art, the present invention provides a resource allocation method based on a virtual simulation test platform, which can reasonably allocate limited resources and achieve the purpose of profit maximization.
(II) technical scheme
In order to achieve the above purpose, the main technical scheme adopted by the invention comprises the following steps:
in a first aspect, an embodiment of the present invention provides a resource allocation method based on a virtual simulation test platform, including:
step S1, a server receives request information sent by any one of the requesters, wherein the request information comprises: the identity of the requesting party and the task information to be executed;
step S2, the server acquires the user authority level of the requester according to the identity when determining that the identity of the requester is legal;
step S3, the server determines the resource grade corresponding to the task information according to the task information, and checks whether the resource grade corresponds to the user authority grade;
and step S4, accessing the resources in the server according to the task information when the resource level is matched with the user authority level, and executing the task information in the first task request.
Optionally, accessing the resource in the server in the step S4 and executing the task information in the first task request includes:
according to the test parameters in the task information, giving a feasibility value to the task information;
judging whether the feasibility value is larger than a preset threshold value, if so, judging whether the task information belongs to a task for which the simulation test is completed;
if the task information does not belong to the task queue, the task information is added into the task queue to be executed, and execution is waited.
Optionally, the method further comprises:
and if the task information in the request information belongs to the task for which the simulation test is completed, transmitting the result information of the completed simulation test or the related information of task execution to the requester.
Optionally, after step S1, before step S2, the method further includes:
the server determines whether the identity of the requesting party is legal or not according to the identity mark;
correspondingly, when the identity is legal, the user permission level is obtained according to the identity.
Optionally, after step S3, before step S4, the method further includes:
and if the resource level is not matched with the user authority level, returning a response of low user authority level to the requester.
Optionally, after the step of determining whether the value of the feasibility degree is greater than a preset threshold, the method further includes:
and if the feasibility is smaller than or equal to the preset threshold, returning a response for modifying the test parameters to the requester, wherein the response comprises upper and lower limit information of the test parameters.
Optionally, the task information to be performed includes one or more of the following:
information for performing a swing test simulation analysis;
information for verifying the simulation result of the swing test;
and the information is used for inquiring the simulation of the swing test.
Optionally, the determining, by the server in step S3, a resource level corresponding to the task information according to the task information includes:
and the server receives task information selected by the user based on each task option displayed on the interface, and checks the resource grade corresponding to the task information from a preset resource matching strategy according to the identification of the task information.
In a second aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and capable of running on the processor, where the computer program when executed by the processor implements the resource allocation method based on the virtual simulation test platform according to any one of the first aspect above.
In a third aspect, an embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program, when executed by a processor, implements a resource allocation method based on a virtual simulation test platform according to any one of the first aspect above.
(III) beneficial effects
The beneficial effects of the invention are as follows: the method of the invention can avoid the occupation of limited resources by repeated and low-efficiency tasks, and comprises four judgment criteria: judging whether the identity of the user is legal or not; judging whether the user has permission to access the resource; judging whether the feasibility of the request task is positive; and judging whether the requested task is the first task or not. By the method, repeated tasks and invalid tasks submitted by the user can be effectively filtered and accessed, the occupancy rate of cloud service resources in the swing test is reduced, and the value of cloud service output results is improved.
Detailed Description
The invention will be better explained by the following detailed description of the embodiments with reference to the drawings.
In order that the above-described aspects may be better understood, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Example 1
As shown in fig. 1, fig. 1 shows a flow chart of a resource allocation method based on a virtual simulation test platform according to an embodiment of the present invention, where the method of the embodiment may include the following steps:
s1, a server receives request information sent by any one of the requesters, wherein the request information comprises: the identity of the requesting party and the task information to be executed.
For example, the identity of the embodiment may be account information logged in by the user in the server, or the identity may be account information pre-recorded by the user in the server, or the like.
Further, the task information to be performed includes one or more of the following:
information for performing a swing test simulation analysis;
information for verifying the simulation result of the swing test;
and the information is used for inquiring the simulation of the swing test.
S2, the server acquires the user authority level of the requester according to the identity mark when the identity of the requester is determined to be legal.
For example, the server determines whether the identity of the requesting party is legal according to the identity; correspondingly, when the identity is legal, the user permission level is obtained according to the identity.
And S3, the server determines the resource grade corresponding to the task information according to the task information, and checks whether the resource grade corresponds to the user authority grade.
In a specific application, if the resource level and the user authority level are not matched, a response with low user authority level is returned to the requester.
And S4, accessing the resources in the server according to the task information when the resource level is matched with the user authority level, and executing the task information in the first task request.
For example, step S4 may include:
s41, assigning a feasibility value to the task information according to the test parameters in the task information;
s42, judging whether the feasibility value is larger than a preset threshold value, and if so, judging whether the task information belongs to the task for which the simulation test is completed.
In a specific application, if the feasibility is smaller than or equal to the preset threshold, a response for modifying the test parameter is returned to the requester, wherein the response comprises upper and lower limit information of the test parameter.
And S43, if the task information does not belong to the task information, adding the task information into a task queue to be executed, and waiting for execution.
Of course, if the task information in the request information belongs to the task for which the simulation test is completed, the result information of the completed simulation test or the related information of task execution is sent to the requester.
The method of the embodiment can avoid repeated and low-efficiency tasks from occupying too much limited resources, can effectively filter repeated tasks and invalid tasks submitted by the access user, reduce the occupancy rate of cloud service resources in the swing test, and improve the value of cloud service output results.
Example two
As shown in connection with fig. 1 and 2, the method of the present embodiment may include the following steps:
step 01: the system accepts request information including task information sent by a service requester.
The task information may specifically refer to a ringing test simulation analysis/verification/query task.
Step 02: judging whether the user identity is legal, if so, executing step 03, otherwise, executing step 07.
The legal identity is specifically a positively registered user of the swing test cloud service system which does not enter a system blacklist due to violation of user rules.
Step 03: recording the user universal ID and obtaining the user authority level.
When registering a user, the system gives the user a universal ID, associates and stores the user name, the user authority and the user authority level, and judges the user authority level through ID retrieval after the system reads the user name every time the user accesses.
Step 04: the resource level of the requested task is obtained.
For example, the server may receive task information selected by the user based on each task option displayed on the interface, and view, according to the identifier of the task information, a resource level corresponding to the task information from a preset resource matching policy.
For example, after the user successfully logs in, a selection interface is displayed, and the task item to be executed is checked out from all task options of the interface options, wherein the item type and the number include but are not limited to the following: p01, swing test information query, p0101, history information query, p0102 and public information query; p02, simulation analysis of a swinging test, p0201, rationality evaluation of parameters, p0202, simulation analysis of parameters, p0203 and analogy judgment of a mother ship.
It should be noted that, in this embodiment, based on the task options displayed by the selection interface, the task selection has the following characteristics:
p01 is the task primary classification, and p0101 task is the secondary classification;
the secondary classification is a check mode, and a user can check at least one secondary task at the same time, and meanwhile, the corresponding primary task is automatically checked;
when the primary task is checked, all secondary tasks corresponding to the primary task are checked by default;
judging that only when at least one task is checked, the next operation can be executed;
and determining task information and corresponding resource levels by judging the numbers of the primary task and the secondary task items.
Step 05: and judging whether the user has authority to access the resource according to the requested resource level, if so, executing the step 06, otherwise, executing the step 07.
Step 06: the user obtains access to the resource and the program performs step 08.
Step 07: and the system ends the task request and feeds back the result to the user.
The feedback is specifically divided into four types of information, and the feedback can be divided into four types according to the sequence of the judging flow: the current user identity is illegal, and the request fails; the current user has insufficient access rights, and the account is requested to be upgraded; the current request task is not executable, and the task parameters are requested to be modified; the current task is already in the queue and the application is not repeated.
Step 08: and searching the test database, and endowing the request task with feasibility.
The feasibility is 0 when not assigned, and is + -1 after assigned, wherein 1 represents executable and-1 represents non-executable.
The assignment method specifically refers to:
the value-1 is assigned when:
when the input swing test parameters exceed the value range; or (b)
When the input swing test parameters do not meet the design specification of the target ship; or (b)
When the input sway test parameters are similar to the non-executable tasks in the database.
A value of 1 is assigned when:
when the system determines that assignment-1 fails.
Step 09: and judging whether the feasibility is positive, if so, executing the step 10, otherwise, executing the step 7.
Step 10: and searching the current task queue, judging whether the requested task is the first task, if so, executing the step 11, and otherwise, executing the step 7.
Step 11: and adding the request task into the current task queue.
By the method, repeated tasks and invalid tasks submitted by the user can be effectively filtered and accessed, the occupancy rate of cloud service resources in the swing test is reduced, and the value of cloud service output results is improved.
Example III
As shown in fig. 3, in this embodiment, a schematic structural diagram of a server is provided, and the server shown in fig. 3 may include: at least one processor 31, at least one memory 32, at least one network interface 34, and/or other user interface 33. The various components in the server are coupled together by a bus system 35. It will be appreciated that the bus system 35 is used to enable connected communications between these components. The bus system 35 includes a power bus, a control bus, and a status signal bus in addition to the data bus. But for clarity of illustration the various buses are labeled in fig. 3 as bus system 35.
The server of the present embodiment may perform the method shown in fig. 1 and 2, wherein the user interface 33 may comprise a display, a keyboard or a pointing device (e.g. a mouse or a touch pad, etc.).
It will be appreciated that the memory 32 in this embodiment may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may be a Read-only memory (ROM), a programmable Read-only memory (ProgrammableROM, PROM), an erasable programmable Read-only memory (ErasablePROM, EPROM), an electrically erasable programmable Read-only memory (ElectricallyEPROM, EEPROM), or a flash memory, among others. The volatile memory may be a random access memory (RandomAccessMemory, RAM) that acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic random access memory (DynamicRAM, DRAM), synchronous dynamic random access memory (SynchronousDRAM, SDRAM), double data rate synchronous dynamic random access memory (ddr SDRAM), enhanced Synchronous Dynamic Random Access Memory (ESDRAM), synchronous link dynamic random access memory (SynchlinkDRAM, SLDRAM), and direct memory bus random access memory (DirectRambusRAM, DRRAM). The memory 32 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some embodiments, memory 32 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 321 and application programs 322.
The operating system 321 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, for implementing various basic services and processing hardware-based tasks. The application programs 322 include various application programs such as a media player (MediaPlayer), a Browser (Browser), and the like for implementing various application services. A program implementing the method of the embodiment of the present invention may be included in the application program 322.
In an embodiment of the present invention, the processor 31 is configured to execute the method steps provided in the first aspect by calling a program or an instruction stored in the memory 32, specifically, a program or an instruction stored in the application 322.
The method disclosed in the above embodiment of the present invention may be applied to the processor 31 or implemented by the processor 31. The processor 31 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 31 or by instructions in the form of software. The processor 31 described above may be a general purpose processor, a digital signal processor (DigitalSignalProcessor, DSP), an application specific integrated circuit (ApplicationSpecificIntegratedCircuit, ASIC), an off-the-shelf programmable gate array (FieldProgrammableGateArray, FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software elements in a decoding processor. The software elements may be located in a random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 32 and the processor 31 reads information in the memory 32 and in combination with its hardware performs the steps of the method described above.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the processing units may be implemented within one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital signal processing devices (dsppdevices), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units designed to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units that perform the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the terms first, second, third, etc. are for convenience of description only and do not denote any order. These terms may be understood as part of the component name.
Furthermore, it should be noted that in the description of the present specification, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to a specific feature, structure, material, or characteristic described in connection with the embodiment or example being included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art upon learning the basic inventive concepts. Therefore, the appended claims should be construed to include preferred embodiments and all such variations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, the present invention should also include such modifications and variations provided that they come within the scope of the following claims and their equivalents.