WO2020124524A1 - 一种资源平台独享资源的方法、装置及电子设备 - Google Patents

一种资源平台独享资源的方法、装置及电子设备 Download PDF

Info

Publication number
WO2020124524A1
WO2020124524A1 PCT/CN2018/122560 CN2018122560W WO2020124524A1 WO 2020124524 A1 WO2020124524 A1 WO 2020124524A1 CN 2018122560 W CN2018122560 W CN 2018122560W WO 2020124524 A1 WO2020124524 A1 WO 2020124524A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
processor
processing
task processing
queue
Prior art date
Application number
PCT/CN2018/122560
Other languages
English (en)
French (fr)
Other versions
WO2020124524A8 (zh
Inventor
王博
Original Assignee
深圳鲲云信息科技有限公司
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 深圳鲲云信息科技有限公司 filed Critical 深圳鲲云信息科技有限公司
Priority to PCT/CN2018/122560 priority Critical patent/WO2020124524A1/zh
Priority to CN201880098613.XA priority patent/CN112840320A/zh
Publication of WO2020124524A1 publication Critical patent/WO2020124524A1/zh
Publication of WO2020124524A8 publication Critical patent/WO2020124524A8/zh

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/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • This application relates to the technical field of cloud technology, and in particular to a method, device, and electronic device for exclusive use of resources by a resource platform.
  • GPU resources generally take up all the video memory when training deep learning algorithms or other algorithms.
  • the training time is generally longer, ranging from a few hours to more than a few days.
  • the GPU cannot be used by other programs. If other programs happen to use the already occupied GPU, the program will report an error.
  • training an algorithm on the GPU is a process of monopolizing GPU resources for a long time.
  • the existing resource platform has the problems of low task processing efficiency and low task processing success rate.
  • Embodiments of the present application provide a method, device, and related product for exclusive use of resources by a resource platform.
  • Task processing is performed by multiple task processing functions and corresponding task processors, and execution tasks are independent of each other, improving task processing efficiency and task processing Success rate.
  • an embodiment of the present application provides a method for exclusive use of resources by a resource platform
  • the resource platform includes: a task manager, a task queue, multiple task processors, and task processing corresponding to the number of task processors Function and result database, the method includes the following steps:
  • an embodiment of the present application provides an apparatus for exclusive use of resources by a resource platform, including:
  • a task obtaining module configured to obtain task request information submitted by multiple users through the task manager
  • a task storage module configured to insert a corresponding task parameter and task ID into a task queue according to each task request information
  • the task processing module is used to extract the head task parameters of the task queue from the task queue through multiple task processing functions, and call the task processor corresponding to the task processing function to process the task, and obtain the task processing results respectively ;
  • the result storage module is used to store the processing result of each task and the corresponding task ID in the result database.
  • an embodiment of the present application provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, when the processor executes the computer program
  • a computer program stored on the memory and executable on the processor, when the processor executes the computer program
  • embodiments of the present application provide a computer-readable storage medium that stores a computer program on the computer-readable storage medium, and when the computer program is executed by a processor, implements the method provided in the embodiments of the present invention Steps.
  • task request information submitted by multiple users is obtained through the task manager; according to each task request information, a corresponding task parameter and task ID are formed into a tuple into the task queue; Task processing functions extract the head task parameters of the task queue from the task queue, and call the task processor corresponding to the task processing function to process the tasks, and obtain the task processing results separately; process each of the tasks
  • the result and the corresponding task ID are stored in the result database; in this way, when processing multiple task requests, the user’s task request is processed through the task processing function and the task processor corresponding to the task processing function, and each task is It is processed independently and does not require multiple tasks to occupy the same task processing function and task processor. Improve the efficiency of task processing and the success rate of task processing.
  • Figure 1 is a network architecture diagram of a resource platform's exclusive resources
  • FIG. 2 is a schematic flowchart of a method for exclusive use of resources by a resource platform provided by this application;
  • FIG. 3 is a schematic diagram of a resource platform exclusive resource device provided by this application.
  • FIG. 4 is a schematic structural diagram of an electronic device provided by the present application.
  • FIG. 1 is a network architecture diagram of a resource platform exclusive resource, wherein the network architecture diagram includes: user 1, task manager 2, task queue 3, task processing function 4, task processor 5, Results database 6, where the user may be one or more; the task manager 2 may be an application; the task queue 3 may be a storage database of tasks to be processed; the task processing function 4 may be task processing The code of the algorithm, the task processing function 4 can call the task processor 5, and the task processing function 4 corresponds to the number of the task processors 5 in one-to-one correspondence.
  • the number of the above-mentioned task processors 5 may be one or more, which can be set according to the requirements of the resource platform.
  • the result database 6 is used to store task processing results and task IDs.
  • the result database 6 may be a key-value database or a relational database.
  • the user submits a task to the task manager 2, the task manager 2 inserts the task parameters and task ID of the task submitted by the user into the task queue 3, extracts the task parameters from the task queue 3 through the task processing function 4, and passes the task processing function 4 Invoke the corresponding task processor 5 to process the task, and store the task processing result in the result database 6.
  • the task processing result corresponding to the user can be queried from the result database 6 by inputting the task ID in the task manager 2.
  • FIG. 2 provides a schematic flowchart of a method for exclusive use of resources by a resource platform.
  • the resource platform includes: a task manager 2, a task queue 3, a plurality of task processors 5, and a number corresponding to the number of task processors
  • the task processing function 4 and the result database 6 are shown in Figure 2.
  • the method includes the following steps:
  • Step S201 Obtain task request information submitted by multiple users through the task manager.
  • the above task manager is used to receive task requests provided by multiple users, and can also be used by users to query task processing results.
  • the above task manager may also be called Appliction (application).
  • the task manager provides a task submission interface through which users can submit tasks.
  • the task submission interface is an interface that supports concurrent requests, that is, multiple users can submit tasks through the task submission interface at the same time.
  • the task manager also provides a result query interface through which users can query task processing results.
  • the result query interface is also an interface that supports concurrent requests, and multiple users can query task processing results at the same time.
  • the above task request information may include: task submission time, task description, and task parameters. When a user submits a task, the task manager can directly obtain task request information of the task.
  • Step S202 According to each task request information, a corresponding task parameter and task ID are formed into a tuple and inserted into the task queue.
  • the above task ID may be an ID card representing the task, for example, a task serial number, etc.; the task serial number may be composed of the time and serial number submitted through the task.
  • the task ID may be called task_id (task number), and the task ID may be generated according to a combination of the time when the task is submitted and the task serial number when the task request submitted by the user is received, or may be automatically generated by the system.
  • the above task parameters may be function parameters required during task execution.
  • the task queue may be a database for storing tasks to be executed; the data structure type of the database is a queue, and the task queue may store task parameters and task IDs of multiple tasks.
  • a task ID corresponding to the task is generated, and the task parameters and the task ID of the task are formed into a tuple and stored in the task queue. If multiple task request information is received, the multiple task request information is sorted in chronological order of reception, and the tuple of each task is stored in the task queue on the principle of first-come-first-served. This ensures that the tasks submitted first will be processed first.
  • the ordering method of the task can also be selected according to actual needs.
  • Step S203 Extract the head task parameters of the task queue from the task queue through multiple task processing functions, and call the task processor corresponding to the task processing function to process the tasks, and obtain the task processing results respectively.
  • the above task processing function may be code of a task execution algorithm.
  • the task processing function can be configured with a corresponding task processor, and the task processing function can call the corresponding task processor to process the task; in a resource platform, the task processing function is the same as the number of the task processors, In the task, each task processing function only corresponds to a task processor and executes only one task. Only after the task is processed can the next task be executed.
  • the head task parameter of the above task queue is the task parameter of the first task stored in the front of the task queue.
  • the above task processor may be a processor for processing tasks, such as GPU (Graphics Processing Unit, graphics processor), FPGA (Field-Programmable Gate Array, field programmable gate array) and so on.
  • the task processor can be selected according to the task type and task purpose of the resource platform.
  • multiple task processing functions and multiple task processors can be used to form multiple task groups, and the first task of the task queue can be extracted from the task queue for processing, and Obtain the corresponding task processing results.
  • the resource platform has 5 task processors, corresponding to 5 corresponding task processing functions, then these 5 task processors and 5
  • the task processing functions correspond to one to five task groups, and the five task groups sequentially extract the task parameters of the top task from the task queue, process the task, and obtain the task processing result correspondingly.
  • the task processing time is also different, so the time for the five task groups to complete the task is in order, and the task group that completed the task first can again extract the task parameters of the top task from the task queue And process the task.
  • 5 task groups can alternately extract the task parameters of the task from the task queue and process the extracted tasks.
  • the task groups can all stop working. Or, determine whether the task group obtains the task parameters, and if not, wait for a preset time threshold and then retrieve the task from the task queue for processing to obtain the task processing result.
  • the preset time threshold may be 1s, 2s, or 10s Wait. If yes, continue to extract tasks from the task queue and process them, and obtain the task processing results.
  • Step S204 Store each of the task processing results and the corresponding task ID in the result database.
  • the above task processing result may include data, graphics, text, etc. obtained after the task processing.
  • the task processing result is stored in the result database together with the corresponding task ID to facilitate the user to query the task processing result.
  • task request information submitted by multiple users is obtained through the task manager; according to each task request information, a corresponding task parameter and task ID are formed into a tuple into the task queue; Task processing functions extract the head task parameters of the task queue from the task queue, and call the task processor corresponding to the task processing function to process the tasks, and obtain the task processing results respectively; process each of the tasks
  • the result and the corresponding task ID are stored in the result database; in this way, when processing multiple task requests, the user’s task request is processed through the task processing function and the task processor corresponding to the task processing function, and each task is It is processed independently and does not require multiple tasks to occupy the same task processing function and task processor. Improve the efficiency of task processing and the success rate of task processing.
  • the method before receiving the task request information submitted by multiple users, the method includes:
  • the task manager is started in advance to receive the task request submitted by the user, and the task processing function and the task processor are pre-composed into a task group in preparation for processing the task, and the task queue and the result database are created in advance to store the user submission Tasks to be processed and used to store the task processing results after the task processing, wherein the above-mentioned tasks to be processed may be one or more, and the task processing results may also be one or more.
  • preparations can be made in advance for the resource platform to process tasks, which further improves the efficiency of task processing.
  • the steps of starting a task processing function and a task processor corresponding to the task processing function include:
  • the task processing function is started by the number of the first task processor, and the number of the first task processor is recorded in the task processing file.
  • the first task processor is the first matching task processor.
  • the first task processor may be randomly selected; the task processing file may be a temporary file, used when configuring an available task processor for the task processing function This ensures that there is a one-to-one correspondence between task processors and task processing functions, and will not cause two tasks to use the same task processor at the same time and cause task failure, thereby improving the success rate of task processing.
  • the method includes:
  • the step of storing the processing result of each task and the corresponding task ID in the result database includes:
  • Each task processing result is bound to the corresponding task ID and stored in the result database.
  • the task processing result is bound to the corresponding task ID.
  • the user queries the task processing result in the result database through the task ID, the user can accurately query the corresponding task processing result, further Improve the efficiency of task processing.
  • the method further includes:
  • the user only needs to provide his own task ID to find the corresponding task processing result in the result database.
  • the method further includes:
  • each task processing function After each task processing function completes a task processing, it can cyclically extract the next head task parameter from the task queue and perform the corresponding operation.
  • the resource platform can reasonably use the task processor to process multiple tasks, so as to avoid the task processor being idle and causing waste of the task processor.
  • FIG. 3 is a schematic diagram of a device for exclusive use of resources provided by a resource platform provided by this application. As shown in FIG. 3, it includes:
  • a task obtaining module 301 configured to obtain task request information submitted by multiple users through the task manager;
  • the task storage module 302 is configured to insert a corresponding task parameter and task ID into a task queue according to each task request information;
  • the task processing module 303 is used to extract the head task parameters of the task queue from the task queue through multiple task processing functions, and call the task processor corresponding to the task processing function to process the task, and obtain the task processing respectively result;
  • the result storage module 304 is used to store the processing result of each task and the corresponding task ID in the result database.
  • a resource platform exclusive resource device can implement various processes implemented in the above method embodiments, and achieve the same technical effect. To avoid repetition, details are not described here.
  • FIG. 4 is a schematic structural diagram of an electronic device provided by the present application.
  • the electronic device includes: a memory 402, a processor 401, and stored on the memory 402 and can be processed in the process A computer program running on the processor 401, and when the processor 401 executes the computer program, the steps in the method described in the embodiments of the present invention are implemented.
  • An embodiment of the present invention provides a computer-readable storage medium that stores a computer program on the computer-readable storage medium.
  • the computer program is executed by the processor 401, the steps in the method described in the embodiments of the present invention are implemented.
  • the computer-readable storage medium or computer-readable program may be stored in a computer-readable memory.
  • the technical solution of the present application may essentially be a part that contributes to the prior art or all or part of the technical solution may be embodied in the form of a software product, and the computer software product is stored in a memory,
  • Several instructions are included to enable a computer device (which may be a personal computer, server, network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application.
  • the aforementioned memory includes: U disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
  • the program may be stored in a computer-readable memory, and the memory may include: a flash disk , Read-Only Memory (English: Read-Only Memory, abbreviation: ROM), Random Access Device (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disk, etc.
  • ROM Read-Only Memory
  • RAM Random Access Device
  • magnetic disk or optical disk etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Multi Processors (AREA)
  • Stored Programmes (AREA)

Abstract

一种资源平台独享资源的方法、装置及电子设备,所述方法包括如下步骤:通过所述任务管理器获取多个用户提交的任务请求信息(S201);根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中(S202);通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务处理结果(S203);将每个所述任务处理结果以及对应的任务ID存储在结果数据库中(S204)。所述方法能够提高任务处理的效率,以及任务处理成功率。

Description

一种资源平台独享资源的方法、装置及电子设备 技术领域
本申请涉及云技术技术领域,具体涉及一种资源平台独享资源的方法、装置及电子设备。
背景技术
随着GPU计算能力的快速提升,深度学习被越来越多得运用与工业领域,并获得了巨大的成功。在实际应用中,为了获得较高的准确率、较低的误识别率以及更好的需要在GPU上进行较长时间的运算,以获得一个好的模型。GPU资源在深度学习算法或者其他算法的训练时,一般是占用全部的显存。而训练时间一般都比较长,少则几小时,多则几天。在这个过程中,GPU不能被其他程序所使用,如果其他程序碰巧也要使用已经被占用的GPU,程序会报错。也就是说大部分情况下,在GPU上进行一个算法的训练是一个长时间独占GPU资源的过程。而对于一个供多用户来进行训练任务的平台来说,现有的资源平台存在任务处理效率低、且任务处理成功率不高的问题。
申请内容
本申请实施例提供了一种资源平台独享资源的方法、装置及相关产品,通过多个任务处理函数以及对应的任务处理器进行任务处理,且执行任务相互独立,提高任务处理效率以及任务处理成功率。
第一方面,本申请实施例提供一种资源平台独享资源的方法,所述资源平台包括:任务管理器、任务队列、多个任务处理器、与所述任务处理器个数对应的任务处理函数、以及结果数据库,所述方法包括如下步骤:
通过所述任务管理器获取多个用户提交的任务请求信息;
根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中;
通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务 处理结果;
将每个所述任务处理结果以及对应的任务ID存储在结果数据库中。
第二方面,本申请实施例提供一种资源平台独享资源的装置,包括:
任务获取模块,用于通过所述任务管理器获取多个用户提交的任务请求信息;
任务存储模块,用于根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中;
任务处理模块,用于通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务处理结果;
结果存储模块,用于将每个所述任务处理结果以及对应的任务ID存储在结果数据库中。
第三方面,本申请实施例提供一种电子设备,包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现本发明实施例中提供的所述方法中的步骤。
第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现本发明实施例中提供的所述方法中的步骤。
在本发明实施例中,通过所述任务管理器获取多个用户提交的任务请求信息;根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中;通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务处理结果;将每个所述任务处理结果以及对应的任务ID存储在结果数据库中;这样,在处理多个任务请求时,通过任务处理函数以及与所述任务处理函数对应的任务处理器配套处理用户的任务请求,且每个任务均是独立处理,不需要多个任务占用同一个任务处理函数以及任务处理器。提高了任务处理的效率,以及任务处理成功率。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所 需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是一种资源平台独享资源的网络架构图;
图2是本申请提供的一种资源平台独享资源的方法流程示意图;
图3是本申请提供的一种资源平台独享资源的装置示意图;
图4是本申请提供的一种电子设备结构示意图。
其中,1、用户;2、任务管理器;3、任务队列;4、任务处理函数;5、任务处理器;6结果数据库。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书及所述附图中的术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
参阅图1,图1为一种资源平台独享资源的网络架构图,其中,所述网络架构图包括:用户1、任务管理器2、任务队列3、任务处理函数4、任务处理器5、结果数据库6,其中所述用户可以是一个也可以是多个;所述任务管理器2可以是应用程序;上述任务队列3可以是待处理任务的存储数据库;上述任务处理函数4可以是任务处理算法的代码,上述任务处理函数4可调用上述任务处理器5,并且上述任务处理函数4与上述任务处理器5的个数一一对应。上述任务 处理器5的个数可以是一个或多个,可根据资源平台的需求进行设置。上述结果数据库6用来存储任务处理结果以及任务ID的,上述结果数据库6可以是键值对数据库、也可以是关系型数据库。用户向任务管理器2提交任务,任务管理器2将用户提交的任务的任务参数以及任务ID插入任务队列3中,通过任务处理函数4从任务队列3中提取任务参数,并通过该任务处理函数4调用对应的任务处理器5处理该任务,并将任务处理结果存储在结果数据库6中。当用户想要查询任务处理结果时,可通过在任务管理器2中输入任务ID从结果数据库6中查询到该用户对应的任务处理结果。
参阅图2,图2提供一种资源平台独享资源的方法流程示意图,所述资源平台包括:任务管理器2、任务队列3、多个任务处理器5、与所述任务处理器个数对应的任务处理函数4、以及结果数据库6,该方法如图2所示,包括如下步骤:
步骤S201、通过所述任务管理器获取多个用户提交的任务请求信息。
其中,上述任务管理器用于接收多个用户提供的任务请求,还可以用于用户查询任务处理结果。上述任务管理器还可以称为Appliction(应用程序)。该任务管理器提供任务提交接口,用户可以通过该任务提交接口提交任务,该任务提交接口是一个支持并发请求的接口,也就是说,多个用户可以同时通过该任务提交接口提交任务。该任务管理器还提供一个结果查询接口,用户可以通过该结果查询接口查询任务处理结果,该结果查询接口也是一个支持并发请求接口,多个用户可以同时查询任务处理结果。上述任务请求信息可以包括:任务提交时间、任务描述、以及任务参数等。当有用户提交任务后,所述任务管理器就可以直接获取所述任务的任务请求信息。
步骤S202、根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中。
其中,上述任务ID(编号)可以是代表该任务的身份证,比如,任务序列号等;该任务序列号可以是通过任务提交的时间和序号组成。该任务ID可以称为task_id(任务编号),该任务ID可以是接收到用户提交的任务请求时,根据任务提交的时间和任务序号组合生成,也可以是系统自动生成。上述任务参数可以是任务执行时需要的函数参数。所述任务队列可以是用于存储待执行任务的数据库;该数据库的数据结构类型是队列,该任务队列可以存储多个任务的 任务参数以及任务ID。当获取到用户提交的任务请求后,生成与该任务对应的任务ID,并将该任务的任务参数以及任务ID组成一个元组存储在该任务队列中。若接收到多个任务请求信息,则将多个任务请求信息按接收的时间顺序进行排序,保持先到先存的原则将每个任务的元组存入该任务队列中。这样就保证了,先提交的任务能被优先处理。该任务的排序方式也可根据实际需要进行选择。
步骤S203、通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务处理结果。
其中,上述任务处理函数可以是任务执行算法的代码。该任务处理函数可以配置对应的任务处理器,该任务处理函数可调用对应的任务处理器对任务进行处理;在资源平台中,该任务处理函数与所述任务处理器的个数相同,在处理任务时,每个任务处理函数只与一个任务处理器一一对应,且只执行一个任务,只有任务被处理完毕之后,才能执行下一个任务。上述任务队列的头部任务参数即为存储在任务队列中排在前面的第一个任务的任务参数。上述任务处理器可以是用于处理任务的处理器等,比如,GPU(Graphics Processing Unit,图形处理器)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)等。该任务处理器可以根据资源平台的任务类型以及任务目的进行选择。当资源平台需要处理多个任务时,可通过多个任务处理函数以及多个任务处理器一一对应组成多个任务组,并依次从任务队列中提取任务队列的第一个任务进行处理,并获取对应的任务处理结果,比如,任务队列中存储有10任务,而资源平台有5个任务处理器,相对应的有5个对应的任务处理函数,则将这5个任务处理器与5个任务处理函数一一对应组成5个任务组,5个任务组依次从任务队列中提取靠前的任务的任务参数,对该任务进行处理,并对应获得任务处理结果。因为任务难度不同,所花的任务处理时间也不同,这样5个任务组完成任务的时间也就有先后顺序,在先完成任务的任务组可再次从任务队列中提取靠前的任务的任务参数,并处理该任务。这样5个任务组可以交替循环从任务队列中提取任务的任务参数并处理提取的任务,把10个任务处理完成之后,任务组均可以停止工作。又或者,判断任务组是否取到任务参数,若否,则等待预设时间阈值之后重新从任务队列中提取任务进行处理,获取任务处理结果,所述预 设时间阈值可以是1s、2s、10s等。若是,则继续从任务队列中提取任务,并进行处理,并获取任务处理结果。
步骤S204、将每个所述任务处理结果以及对应的任务ID存储在结果数据库中。
其中,上述任务处理结果可以包括任务处理后得到的数据、图形、文本等。将任务处理结果与对应的任务ID一起存储在结果数据库中,方便用户查询任务处理结果。
在本发明实施例中,通过所述任务管理器获取多个用户提交的任务请求信息;根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中;通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务处理结果;将每个所述任务处理结果以及对应的任务ID存储在结果数据库中;这样,在处理多个任务请求时,通过任务处理函数以及与所述任务处理函数对应的任务处理器配套处理用户的任务请求,且每个任务均是独立处理,不需要多个任务占用同一个任务处理函数以及任务处理器。提高了任务处理的效率,以及任务处理成功率。
可选的,所述接收多个用户提交的任务请求信息之前,所述方法包括:
启动任务管理器,并让所述任务管理器在后台接收用户的任务请求;
启动任务处理函数以及与所述任务处理函数对应的任务处理器;
创建任务队列以及结果数据库。
具体的,预先启动任务管理器接收用户提交的任务请求,并将预先将任务处理函数以及任务处理器组成任务组为处理任务作准备,且预先创建任务队列以及结果数据库,分别用以存储用户提交的待处理的任务以及用以存储任务处理后的任务处理结果,其中上述待处理任务可以是一个也可以是多个,所述任务处理结果也可以是一个或多个。
在上述实施方式中,可预先为资源平台处理任务作准备,这样进一步提高任务处理效率。
可选的,所述启动任务处理函数以及与所述任务处理函数对应的任务处理器的步骤包括:
针对每个任务处理器配置一个编号;
维护一个任务处理文件,用以记录正在使用的任务处理器的编号;
启动任务处理函数时,获取所述资源平台中的第一任务处理器的编号;
判断所述第一任务处理器的编号是否记录在任务处理文件中;
若未记录在所述任务处理文件中,则将所述第一任务处理器的编号来启动所述任务处理函数,并将所述第一任务处理器的编号记录在所述任务处理文件中。
具体的,上述编号用以区别资源平台中的多个任务处理器,以及方便配置对应的任务处理函数。上述第一任务处理器即为第一匹配的任务处理器,上述第一任务处理器可以是随机选择的;上述任务处理文件可以是一个临时文件,在为任务处理函数配置可用任务处理器时使用,这样保证了任务处理器和任务处理函数的一一对应,不会造成两个任务同时使用同一个任务处理器而导致任务失败,进而提高了任务处理成功率。
可选的,所述获取多个用户提交的任务请求信息之后,所述方法包括:
根据所述多个用户提交的任务请求信息分别生成对应的任务ID,并分别将每个所述任务ID发送给用户。
具体的,这样可以当用户提交任务后得到一个对应的任务ID,可根据所述任务ID查询任务处理结果,避免任务结果认领错误,进而提高任务处理效率。
可选的,所述将每个所述任务处理结果以及对应的任务ID存储在结果数据库中的步骤包括:
将每个所述任务处理结果与对应的所述任务ID进行绑定,并存储在结果数据库中。
具体的,将所述任务处理结果与对应的所述任务ID进行绑定,当用户通过该任务ID在结果数据库中进行查询任务处理结果时,能够准确的查询到对应的任务处理结果,进一步的提高任务处理效率。
可选的,所述方法还包括:
当用户查询任务处理结果时,通过任务管理器获取用户输入的任务ID;
根据所述任务ID从所述结果数据库中提取对应的任务处理结果;
并将所述任务处理结果发送给用户。
具体的,用户只需提供自己的任务ID就可以在结果数据库中查找到对应的任务处理结果。
可选的,所述方法还包括:
当每个任务处理函数完成一个任务处理之后,可循环从任务队列中提取下一个头部任务参数,并执行相应操作。
具体的,这样资源平台可以合理的利用任务处理器处理多个任务,避免任务处理器闲置,造成任务处理器的浪费。
参见图3,图3是本申请提供的一种资源平台独享资源的装置示意图,如图3所示,包括:
任务获取模块301,用于通过所述任务管理器获取多个用户提交的任务请求信息;
任务存储模块302,用于根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中;
任务处理模块303,用于通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务处理结果;
结果存储模块304,用于将每个所述任务处理结果以及对应的任务ID存储在结果数据库中。
本发明实施例中,提供的一种资源平台独享资源的装置能够实现上述方法实施例中实现的各个过程,且达到相同的技术效果,为避免重复,在此不在赘述。
参见图4,图4是本申请提供的一种电子设备结构示意图,如图4所述,所述电子设备包括:存储器402、处理器401及存储在所述存储器402上并可在所述处理器401上运行的计算机程序,所述处理器401执行所述计算机程序时实现本发明实施例中所述的方法中的步骤。
本发明实施例提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器401执行时实现本发明实施例中所述的方法中的步骤。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施 例,所涉及的动作和模块并不一定是本申请所必须的。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的
另外,计算机可读存储介质或计算机可读程序可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取器(英文:Random Access Memory,简称:RAM)、磁盘或光盘等。
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (10)

  1. 一种资源平台独享资源的方法,其特征在于,所述资源平台包括:任务管理器、任务队列、多个任务处理器、与所述任务处理器个数对应的任务处理函数、以及结果数据库,所述方法包括如下步骤:
    通过所述任务管理器获取多个用户提交的任务请求信息;
    根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中;
    通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务处理结果;
    将每个所述任务处理结果以及对应的任务ID存储在结果数据库中。
  2. 如权利要求1所述的方法,其特征在于,所述接收多个用户提交的任务请求信息之前,所述方法包括:
    启动任务管理器,并让所述任务管理器在后台接收用户的任务请求;
    启动任务处理函数以及与所述任务处理函数对应的任务处理器;
    创建任务队列以及结果数据库。
  3. 如权利要求2所述的方法,其特征在于,所述启动任务处理函数以及与所述任务处理函数对应的任务处理器的步骤包括:
    针对每个任务处理器配置一个编号;
    维护一个任务处理文件,用以记录正在使用的任务处理器的编号;
    启动任务处理函数时,获取所述资源平台中的第一任务处理器的编号;
    判断所述第一任务处理器的编号是否记录在任务处理文件中;
    若未记录在所述任务处理文件中,则将所述第一任务处理器的编号来启动所述任务处理函数,并将所述第一任务处理器的编号记录在所述任务处理文件中。
  4. 如权利要求1所述的方法,其特征在于,所述获取多个用户提交的任务请求信息之后,所述方法包括:
    根据所述多个用户提交的任务请求信息分别生成对应的任务ID,并分别将每个所述任务ID发送给用户。
  5. 如权利要求4所述的方法,其特征在于,所述将每个所述任务处理结果以及对应的任务ID存储在结果数据库中的步骤包括:
    将每个所述任务处理结果与对应的所述任务ID进行绑定,并存储在结果数据库中。
  6. 如权利要求5所述的方法,其特征在于,所述方法还包括:
    当用户查询任务处理结果时,通过任务管理器获取用户输入的任务ID;
    根据所述任务ID从所述结果数据库中提取对应的任务处理结果;
    并将所述任务处理结果发送给用户。
  7. 如权利要求1所述的方法,其特征在于,所述方法还包括:
    当每个任务处理函数完成一个任务处理之后,可循环从任务队列中提取下一个头部任务参数,并执行相应操作。
  8. 一种资源平台独享资源的装置,其特征在于,包括:
    任务获取模块,用于通过所述任务管理器获取多个用户提交的任务请求信息;
    任务存储模块,用于根据每个所述任务请求信息将对应的任务参数以及任务ID组成一个元组插入任务队列中;
    任务处理模块,用于通过多个任务处理函数分别从任务队列中提取任务队列的头部任务参数,并调用与所述任务处理函数对应的任务处理器处理所述任务,并分别获取任务处理结果;
    结果存储模块,用于将每个所述任务处理结果以及对应的任务ID存储在结果数据库中。
  9. 一种电子设备,其特征在于,包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求1至7中任一项所述方法中的步骤。
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7中任一项所述方法中的步骤。
PCT/CN2018/122560 2018-12-21 2018-12-21 一种资源平台独享资源的方法、装置及电子设备 WO2020124524A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/122560 WO2020124524A1 (zh) 2018-12-21 2018-12-21 一种资源平台独享资源的方法、装置及电子设备
CN201880098613.XA CN112840320A (zh) 2018-12-21 2018-12-21 一种资源平台独享资源的方法、装置及电子设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/122560 WO2020124524A1 (zh) 2018-12-21 2018-12-21 一种资源平台独享资源的方法、装置及电子设备

Publications (2)

Publication Number Publication Date
WO2020124524A1 true WO2020124524A1 (zh) 2020-06-25
WO2020124524A8 WO2020124524A8 (zh) 2020-08-20

Family

ID=71101008

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/122560 WO2020124524A1 (zh) 2018-12-21 2018-12-21 一种资源平台独享资源的方法、装置及电子设备

Country Status (2)

Country Link
CN (1) CN112840320A (zh)
WO (1) WO2020124524A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114625502A (zh) * 2022-03-03 2022-06-14 盐城金堤科技有限公司 一种投词任务处理方法、装置、存储介质和电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8209701B1 (en) * 2007-09-27 2012-06-26 Emc Corporation Task management using multiple processing threads
CN103780635A (zh) * 2012-10-17 2014-05-07 百度在线网络技术(北京)有限公司 云环境中的分布式异步任务队列执行系统和方法
CN104462370A (zh) * 2014-12-09 2015-03-25 北京百度网讯科技有限公司 分布式任务调度系统及方法
CN106776008A (zh) * 2016-11-23 2017-05-31 福建六壬网安股份有限公司 一种基于zookeeper实现负载均衡的方法及系统
CN106775977A (zh) * 2016-12-09 2017-05-31 北京小米移动软件有限公司 任务调度方法、装置及系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9009187B2 (en) * 2006-12-19 2015-04-14 Ianywhere Solutions, Inc. Assigning tasks to threads requiring limited resources using programmable queues
CN104615487B (zh) * 2015-01-12 2019-03-08 中国科学院计算机网络信息中心 并行任务优化系统和方法
CN105022670B (zh) * 2015-07-17 2018-03-13 中国海洋大学 一种云计算平台中的异构分布式任务处理系统及其处理方法
CN107729139B (zh) * 2017-09-18 2021-02-26 北京京东尚科信息技术有限公司 一种并发获取资源的方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8209701B1 (en) * 2007-09-27 2012-06-26 Emc Corporation Task management using multiple processing threads
CN103780635A (zh) * 2012-10-17 2014-05-07 百度在线网络技术(北京)有限公司 云环境中的分布式异步任务队列执行系统和方法
CN104462370A (zh) * 2014-12-09 2015-03-25 北京百度网讯科技有限公司 分布式任务调度系统及方法
CN106776008A (zh) * 2016-11-23 2017-05-31 福建六壬网安股份有限公司 一种基于zookeeper实现负载均衡的方法及系统
CN106775977A (zh) * 2016-12-09 2017-05-31 北京小米移动软件有限公司 任务调度方法、装置及系统

Also Published As

Publication number Publication date
CN112840320A (zh) 2021-05-25
WO2020124524A8 (zh) 2020-08-20

Similar Documents

Publication Publication Date Title
JP2017004555A5 (zh)
WO2021012553A1 (zh) 一种数据处理方法及相关设备
US11467858B2 (en) Techniques for performing continuation workflows
JP6626211B2 (ja) ショートリンクを処理する方法及び装置並びにショートリンクサーバ
US9495207B1 (en) Cataloging data sets for reuse in pipeline applications
US8468146B2 (en) System and method for creating search index on cloud database
WO2017084362A1 (zh) 模型生成方法、推荐方法及对应装置、设备和存储介质
CN107784026B (zh) 一种etl数据处理方法及装置
WO2016095726A1 (zh) 一种用于分布式执行关系型计算指令的方法与设备
JP2016509711A5 (zh)
JP2017068861A5 (zh)
US8914390B2 (en) Repetitive query recognition and processing
WO2015027425A1 (zh) 存储数据的方法和装置
WO2020006827A1 (zh) 一种智能应答的方法和装置
WO2022134421A1 (zh) 基于多知识图谱的智能答复方法、装置、计算机设备及存储介质
JP2018536227A5 (zh)
WO2019100619A1 (zh) 电子装置、多表关联查询的方法、系统及存储介质
WO2015027932A1 (en) Multi-dimensional decomposition computing method and system
AU2017268599B2 (en) Method, device, server and storage medium of searching a group based on social network
US10467307B1 (en) Grouping of item data using seed expansion
CN106126731B (zh) 一种获取Elasticsearch分页数据的方法及装置
CN107480260B (zh) 大数据实时分析方法、装置、计算设备及计算机存储介质
JP2021508391A5 (zh)
WO2015081715A1 (zh) 一种网站的在线用户统计方法和装置
WO2020124524A1 (zh) 一种资源平台独享资源的方法、装置及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18943664

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 29.09.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18943664

Country of ref document: EP

Kind code of ref document: A1