[go: up one dir, main page]

CN112416545B - A task processing method and device - Google Patents

A task processing method and device Download PDF

Info

Publication number
CN112416545B
CN112416545B CN202011219440.8A CN202011219440A CN112416545B CN 112416545 B CN112416545 B CN 112416545B CN 202011219440 A CN202011219440 A CN 202011219440A CN 112416545 B CN112416545 B CN 112416545B
Authority
CN
China
Prior art keywords
task
target
processing
binary
identifier
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
CN202011219440.8A
Other languages
Chinese (zh)
Other versions
CN112416545A (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 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information 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 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN202011219440.8A priority Critical patent/CN112416545B/en
Publication of CN112416545A publication Critical patent/CN112416545A/en
Application granted granted Critical
Publication of CN112416545B publication Critical patent/CN112416545B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请示出了一种任务处理方法及装置。在本申请中,如果任务库中存在处于处理失败状态的目标任务,则在目标任务中的哪个子任务处于处理失败状态的情况下,重新执行该子任务即可,直至该子任务被处理成功为止,从而使得目标任务被处理成功,通过本申请,可以将目标任务中的每一个子任务单独看待并处理,可以仅对目标任务中的处于处理失败状态的目标子任务重新处理,可以不对目标任务中的全部子任务重新处理,如此,可以不对目标任务中的处于处理成功状态的子任务重新处理,从而可以减少目标任务中的需要重新处理的子任务的数量,从而可以节省系统资源,节省时间,提高将目标任务处理成功的效率。

The present application shows a task processing method and device. In the present application, if there is a target task in a processing failure state in the task library, then if a subtask in the target task is in a processing failure state, the subtask can be re-executed until the subtask is successfully processed, so that the target task is successfully processed. Through the present application, each subtask in the target task can be treated and processed separately, and only the target subtask in the processing failure state in the target task can be reprocessed, and all subtasks in the target task can be not reprocessed. In this way, the subtask in the target task that is in a processing success state can be not reprocessed, so that the number of subtasks in the target task that need to be reprocessed can be reduced, thereby saving system resources, saving time, and improving the efficiency of successfully processing the target task.

Description

一种任务处理方法及装置A task processing method and device

技术领域Technical Field

本申请涉及计算机技术领域,特别是涉及一种任务处理方法及装置。The present application relates to the field of computer technology, and in particular to a task processing method and device.

背景技术Background Art

当前,各大数据服务厂商可以架设自己的服务系统,已对外提供数据服务。Currently, major data service providers can set up their own service systems and provide data services to the outside world.

例如,广大用户可以向服务系统上传数据请求,服务系统可以响应数据请求,例如,获取用户需要访问的数据,并向用户返回用户需要访问的数据,从而实现对用户提供数据服务。For example, users can upload data requests to the service system, and the service system can respond to the data requests, for example, obtain the data that the user needs to access, and return the data that the user needs to access to the user, thereby providing data services to the user.

然而,在服务系统响应数据请求的过程中,可能由于多种多样的原因导致出现对数据请求响应失败的情况,这就无法实现对用户提供数据服务。However, in the process of the service system responding to the data request, a variety of reasons may cause the response to the data request to fail, which makes it impossible to provide data services to users.

为了能够实现对用户提供数据服务,则需要可以周期性轮巡接收到的数据请求,在发现某一数据请求处于响应失败的状态的情况下,重新响应这个数据请求,直至将其响应成功为止。In order to provide data services to users, it is necessary to periodically poll the received data requests, and if a data request is found to be in a state of response failure, respond to the data request again until it is responded successfully.

然而,发明人发现,重新响应处于响应失败的状态的数据请求的过程会耗费较多的系统资源,且会耗费较多的时间,进而导致将数据请求响应成功的效率降低。However, the inventors have discovered that the process of re-responding to a data request that is in a failed response state consumes more system resources and takes more time, thereby reducing the efficiency of successfully responding to the data request.

发明内容Summary of the invention

为了节省系统资源以及提高将数据请求响应成功的效率,本申请示出了一种任务处理方法及装置。In order to save system resources and improve the efficiency of successfully responding to data requests, the present application shows a task processing method and device.

第一方面,本申请示出了一种任务处理方法,应用于电子设备,所述方法包括:In a first aspect, the present application provides a task processing method, which is applied to an electronic device, and the method includes:

基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务;Based on a binary identifier used to characterize the processing status of each task in the task library, detecting whether there is a target task in a processing failure state in the task library;

在存在所述目标任务的情况下,获取用于分别表征所述目标任务中的每一个子任务的处理状态的二进制标识符;In the case where the target task exists, obtaining a binary identifier for respectively characterizing the processing status of each subtask in the target task;

基于用于分别表征每一个子任务的处理状态的二进制标识符,在所述目标任务中的多个子任务中查找处于处理失败状态的目标子任务;Based on the binary identifier used to respectively characterize the processing status of each subtask, searching for a target subtask in a processing failure state among the plurality of subtasks in the target task;

处理所述目标子任务。Process the target subtask.

在一个可选的实现方式中,所述获取用于分别表征所述目标任务中的每一个子任务的处理状态的二进制标识符,包括:In an optional implementation, the acquiring of binary identifiers for respectively characterizing the processing status of each subtask in the target task includes:

获取用于表征所述目标任务中的每一个子任务的处理状态的十进制标识符;Obtaining a decimal identifier for characterizing a processing status of each subtask in the target task;

将所述十进制标识符数转换为二进制字符串,所述二进制字符串中包括用于分别表征所述目标任务中的每一个子任务的处理状态的二进制标识符。The decimal identifier number is converted into a binary string, wherein the binary string includes a binary identifier for respectively representing the processing status of each subtask in the target task.

在一个可选的实现方式中,所述获取用于表征所述目标任务中的每一个子任务的处理状态的十进制标识符,包括:In an optional implementation, the obtaining of a decimal identifier for characterizing the processing status of each subtask in the target task includes:

获取已存储的编码,所述编码是事先在存储所述十进制标识符时,对所述十进制标识符使用base64编码方式编码得到的;Obtaining a stored code, wherein the code is obtained by encoding the decimal identifier using a base64 encoding method when storing the decimal identifier in advance;

使用base64编码方式对应的解码方式对所述编码解码,得到所述十进制标识符。The encoding is decoded using a decoding method corresponding to the base64 encoding method to obtain the decimal identifier.

在一个可选的实现方式中,所述基于用于分别表征每一个子任务的处理状态的二进制标识符,在所述目标任务中的多个子任务中查找处于处理失败状态的目标子任务,包括:In an optional implementation, searching for a target subtask in a processing failure state among multiple subtasks in the target task based on a binary identifier for respectively characterizing the processing state of each subtask includes:

在所述二进制字符串中查找用于表征处理状态为处理失败状态的二进制标识符;Searching the binary string for a binary identifier used to indicate that the processing status is a processing failure status;

获取查找到的二进制标识符在所述二进制字符串中的位置顺序;Obtaining the position order of the found binary identifier in the binary string;

将所述位置顺序所对应的子任务确定为所述目标子任务。The subtask corresponding to the position sequence is determined as the target subtask.

在一个可选的实现方式中,所述处理所述目标子任务之后,还包括:In an optional implementation, after processing the target subtask, the method further includes:

在将所述目标子任务处理成功的情况下,将用于表征所述目标任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符;和/或,将用于表征所述目标子任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。When the target subtask is processed successfully, the binary identifier used to characterize the processing status of the target task is modified to a binary identifier used to characterize that the processing status is a successful processing status; and/or, the binary identifier used to characterize the processing status of the target subtask is modified to a binary identifier used to characterize that the processing status is a successful processing status.

在一个可选的实现方式中,所述处理所述目标子任务,包括:In an optional implementation, the processing the target subtask includes:

将所述目标子任务存储在任务队列中;异步地,串行处理所述任务队列中的目标子任务。The target subtask is stored in a task queue; and the target subtask in the task queue is processed serially asynchronously.

在一个可选的实现方式中,所述方法还包括:In an optional implementation, the method further includes:

在所述任务队列中,删除已处理成功的目标子任务。In the task queue, the successfully processed target subtasks are deleted.

在一个可选的实现方式中,所述方法还包括:In an optional implementation, the method further includes:

在执行所述基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务的步骤之后,间隔预设时长,再次执行所述基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务的步骤。After executing the step of detecting whether there is a target task in a processing failure state in the task library based on the binary identifier used to characterize the processing status of each task in the task library, the step of detecting whether there is a target task in a processing failure state in the task library based on the binary identifier used to characterize the processing status of each task in the task library is executed again at an interval of a preset time.

在一个可选的实现方式中,所述方法还包括:In an optional implementation, the method further includes:

根据所述目标任务的数量和/或目标任务中的目标子任务的数量调整所述预设时长。The preset duration is adjusted according to the number of the target tasks and/or the number of target subtasks in the target task.

在一个可选的实现方式中,所述根据所述目标任务的数量和/或目标任务中的目标子任务的数量调整所述预设时长,包括:In an optional implementation, adjusting the preset duration according to the number of the target tasks and/or the number of target subtasks in the target task includes:

在所述目标任务的数量大于第一预设阈值或者所述目标子任务的数量大于第二预设阈值的情况下,缩短所述预设时长;When the number of the target tasks is greater than a first preset threshold or the number of the target subtasks is greater than a second preset threshold, shortening the preset duration;

或者,or,

在所述目标任务的数量小于或等于第一预设阈值且所述目标子任务的数量小于或等于第二预设阈值的情况下,延长所述预设时长。When the number of the target tasks is less than or equal to a first preset threshold and the number of the target subtasks is less than or equal to a second preset threshold, the preset duration is extended.

第二方面,本申请示出了一种任务处理装置,应用于电子设备,所述装置包括:In a second aspect, the present application shows a task processing device, which is applied to an electronic device, and the device includes:

检测模块,用于基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务;a detection module, for detecting whether there is a target task in a processing failure state in the task library based on a binary identifier for characterizing a processing state of each task in the task library;

获取模块,用于在存在所述目标任务的情况下,获取用于分别表征所述目标任务中的每一个子任务的处理状态的二进制标识符;an acquisition module, used for acquiring, when the target task exists, a binary identifier for respectively representing a processing status of each subtask in the target task;

查找模块,用于基于用于分别表征每一个子任务的处理状态的二进制标识符,在所述目标任务中的多个子任务中查找处于处理失败状态的目标子任务;A search module, used for searching a target subtask in a processing failure state among a plurality of subtasks in the target task based on a binary identifier used to respectively characterize a processing state of each subtask;

处理模块,用于处理所述目标子任务。A processing module is used to process the target subtask.

在一个可选的实现方式中,所述获取模块包括:In an optional implementation, the acquisition module includes:

第一获取单元,用于获取用于表征所述目标任务中的每一个子任务的处理状态的十进制标识符;A first acquisition unit, used for acquiring a decimal identifier for representing a processing status of each subtask in the target task;

转换单元,用于将所述十进制标识符数转换为二进制字符串,所述二进制字符串中包括用于分别表征所述目标任务中的每一个子任务的处理状态的二进制标识符。The conversion unit is used to convert the decimal identifier number into a binary string, wherein the binary string includes a binary identifier for respectively representing the processing status of each subtask in the target task.

在一个可选的实现方式中,所述第一获取单元包括:In an optional implementation, the first acquiring unit includes:

获取子单元,用于获取已存储的编码,所述编码是事先在存储所述十进制标识符时,对所述十进制标识符使用base64编码方式编码得到的;An acquisition subunit, used for acquiring a stored code, wherein the code is obtained by encoding the decimal identifier using a base64 encoding method when storing the decimal identifier in advance;

解码子单元,用于使用base64编码方式对应的解码方式对所述编码解码,得到所述十进制标识符。The decoding subunit is used to decode the encoding using a decoding method corresponding to the base64 encoding method to obtain the decimal identifier.

在一个可选的实现方式中,所述查找模块包括:In an optional implementation, the search module includes:

查找单元,用于在所述二进制字符串中查找用于表征处理状态为处理失败状态的二进制标识符;A searching unit, used for searching the binary identifier used to indicate that the processing status is a processing failure status in the binary string;

第二获取单元,用于获取查找到的二进制标识符在所述二进制字符串中的位置顺序;A second obtaining unit, used for obtaining the position sequence of the found binary identifier in the binary string;

确定单元,用于将所述位置顺序所对应的子任务确定为所述目标子任务。A determination unit is used to determine the subtask corresponding to the position sequence as the target subtask.

在一个可选的实现方式中,所述装置还包括:In an optional implementation, the device further includes:

修改模块,用于在将所述目标子任务处理成功的情况下,将用于表征所述目标任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符;和/或,将用于表征所述目标子任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。A modification module is used to modify the binary identifier used to characterize the processing status of the target task into a binary identifier used to characterize the processing status as a successful processing status when the target subtask is processed successfully; and/or, to modify the binary identifier used to characterize the processing status of the target subtask into a binary identifier used to characterize the processing status as a successful processing status.

在一个可选的实现方式中,所述处理模块包括:In an optional implementation, the processing module includes:

存储单元,用于将所述目标子任务存储在任务队列中;以及,处理单元,用于串行处理所述任务队列中的目标子任务。A storage unit is used to store the target subtask in a task queue; and a processing unit is used to serially process the target subtask in the task queue.

在一个可选的实现方式中,所述处理模块还包括:In an optional implementation, the processing module further includes:

删除单元,用于在所述任务队列中,删除已处理成功的目标子任务。The deleting unit is used to delete the successfully processed target subtask in the task queue.

在一个可选的实现方式中,所述检测模块还用于:In an optional implementation, the detection module is further used to:

在基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务的之后,间隔预设时长,再次基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务。After detecting whether there is a target task in a processing failure state in the task library based on the binary identifier used to characterize the processing status of each task in the task library, at an interval of a preset time, detecting whether there is a target task in a processing failure state in the task library again based on the binary identifier used to characterize the processing status of each task in the task library.

在一个可选的实现方式中,所述装置还包括:In an optional implementation, the device further includes:

调整模块,用于根据所述目标任务的数量和/或目标任务中的目标子任务的数量调整所述预设时长。The adjustment module is used to adjust the preset duration according to the number of the target tasks and/or the number of target subtasks in the target task.

在一个可选的实现方式中,所述调整模块包括:In an optional implementation, the adjustment module includes:

缩短单元,用于在所述目标任务的数量大于第一预设阈值或者所述目标子任务的数量大于第二预设阈值的情况下,缩短所述预设时长;a shortening unit, configured to shorten the preset duration when the number of the target tasks is greater than a first preset threshold or the number of the target subtasks is greater than a second preset threshold;

或者,or,

延长单元,用于在所述目标任务的数量小于或等于第一预设阈值且所述目标子任务的数量小于或等于第二预设阈值的情况下,延长所述预设时长。The extension unit is used to extend the preset duration when the number of the target tasks is less than or equal to a first preset threshold and the number of the target subtasks is less than or equal to a second preset threshold.

第三方面,本申请示出了一种电子设备,所述电子设备包括:In a third aspect, the present application shows an electronic device, the electronic device comprising:

处理器;processor;

用于存储处理器可执行指令的存储器;a memory for storing processor-executable instructions;

其中,所述处理器被配置为执行如第一方面所述的任务处理方法。Wherein, the processor is configured to execute the task processing method as described in the first aspect.

第四方面,本申请示出了一种非临时性计算机可读存储介质,当所述存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行如第一方面所述的任务处理方法。In a fourth aspect, the present application illustrates a non-temporary computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the task processing method described in the first aspect.

第五方面,本申请示出了一种计算机程序产品,当所述计算机程序产品中的指令由电子设备的处理器执行时,使得电子设备能够执行如第一方面所述的任务处理方法。In a fifth aspect, the present application illustrates a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to perform the task processing method as described in the first aspect.

本申请提供的技术方案可以包括以下有益效果:The technical solution provided by this application may have the following beneficial effects:

基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务。在存在目标任务的情况下,获取用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符。基于用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符,在目标任务中的多个子任务中查找处于处理失败状态的目标子任务。处理目标子任务。Based on the binary identifier used to characterize the processing status of each task in the task library, detect whether there is a target task in a processing failure state in the task library. In the case of a target task, obtain a binary identifier used to respectively characterize the processing status of each subtask in the target task. Based on the binary identifier used to respectively characterize the processing status of each subtask in the target task, search for a target subtask in a processing failure state among multiple subtasks in the target task. Process the target subtask.

可见,在本申请中,如果任务库中存在处于处理失败状态的目标任务,则在目标任务中的哪个子任务处于处理失败状态的情况下,重新执行该子任务即可,直至该子任务被处理成功为止,从而使得目标任务被处理成功,通过本申请,可以将目标任务中的每一个子任务单独看待并处理,可以仅对目标任务中的处于处理失败状态的目标子任务重新处理,可以不对目标任务中的全部子任务重新处理,如此,可以不对目标任务中的处于处理成功状态的子任务重新处理,从而可以减少目标任务中的需要重新处理的子任务的数量,从而可以节省系统资源,节省时间,提高将目标任务处理成功的效率。It can be seen that in the present application, if there is a target task in the task library that is in a processing failure state, then if a subtask in the target task is in a processing failure state, the subtask can be re-executed until the subtask is successfully processed, thereby making the target task successfully processed. Through the present application, each subtask in the target task can be viewed and processed separately, and only the target subtask in the target task that is in a processing failure state can be reprocessed, and all the subtasks in the target task do not need to be reprocessed. In this way, the subtask in the target task that is in a processing success state does not need to be reprocessed, thereby reducing the number of subtasks in the target task that need to be reprocessed, thereby saving system resources, saving time, and improving the efficiency of successfully processing the target task.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1是本申请的一种任务处理方法的步骤流程图。FIG1 is a flowchart of the steps of a task processing method of the present application.

图2是本申请的一种获取二进制标识符的方法的步骤流程图。FIG2 is a flowchart of a method for obtaining a binary identifier of the present application.

图3是本申请的一种任务处理装置的结构框图。FIG3 is a structural block diagram of a task processing device of the present application.

图4是本申请示出的一种电子设备的框图。FIG. 4 is a block diagram of an electronic device shown in the present application.

图5是本申请示出的一种电子设备的框图。FIG. 5 is a block diagram of an electronic device shown in the present application.

具体实施方式DETAILED DESCRIPTION

为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

参照图1,示出了本申请的一种任务处理方法的步骤流程图,该方法应用于电子设备,该方法具体可以包括如下步骤:1 , a flowchart of a task processing method of the present application is shown. The method is applied to an electronic device and may specifically include the following steps:

在步骤S101中,基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务。In step S101 , based on a binary identifier used to characterize the processing status of each task in the task library, it is detected in the task library whether there is a target task in a processing failure state.

在本申请中,对于电子设备而言,电子设备可以将需要处理的任务存储在任务库中,然后处理任务库中的任务。In the present application, for an electronic device, the electronic device can store tasks that need to be processed in a task library, and then process the tasks in the task library.

对于任务库中的任意一个任务,电子设备可以获取用于表征该任务的处理状态的二进制标识符,然后基于用于表征该任务的处理状态的二进制标识符,检测该任务是否处于处理失败状态,对于其他每一个任务,同样执行上述操作,如此实现在任务库中检测是否存在处于处理失败状态的目标任务。For any task in the task library, the electronic device can obtain a binary identifier used to characterize the processing status of the task, and then detect whether the task is in a processing failure state based on the binary identifier used to characterize the processing status of the task. For each other task, the above operation is performed in the same way, thereby realizing the detection of whether there is a target task in the task library that is in a processing failure state.

具体地,对于任务库中的任意一个任务,可以通过如下方式检测该任务是否处于处理失败状态,包括:Specifically, for any task in the task library, you can detect whether the task is in a processing failure state in the following ways, including:

1011、获取用于表征该任务的处理状态的二进制标识符。1011. Obtain a binary identifier for representing the processing status of the task.

其中,每当电子设备得到一个任务并将该任务存储在任务库中之后且在电子设备处理该任务之前,电子设备就可以设置用于表征该任务的处理状态为处理失败状态的二进制标识符,然后将该任务的任务标识与设置的二进制标识符组成对应表项,并存储在任务的任务标识与用于表征任务的处理状态的二进制标识符之间的第一对应关系中。Among them, whenever the electronic device obtains a task and stores the task in a task library and before the electronic device processes the task, the electronic device can set a binary identifier used to characterize the processing status of the task as a processing failure state, and then form a corresponding table entry with the task identifier of the task and the set binary identifier, and store it in the first corresponding relationship between the task identifier of the task and the binary identifier used to characterize the processing status of the task.

进一步地,在电子设备之后处理该任务并将该任务处理成功之后,可以在第一对应关系中,将与该任务的任务标识相对应的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。Furthermore, after the electronic device processes the task and successfully processes the task, the binary identifier corresponding to the task identifier of the task can be modified in the first corresponding relationship to a binary identifier used to indicate that the processing status is a successful processing status.

其中,用于表征任务的处理状态为处理失败状态的二进制标识符与用于表征任务的处理状态为处理成功状态的二进制标识符不同。The binary identifier used to indicate that the processing status of the task is a processing failure status is different from the binary identifier used to indicate that the processing status of the task is a processing success status.

用于表征任务的处理状态为处理失败状态的二进制标识符可以为“0”等,用于表征任务的处理状态为处理成功状态的二进制标识符可以为“1”等,本申请对此不加以限定。The binary identifier used to indicate that the processing status of a task is a processing failure status may be "0" or the like, and the binary identifier used to indicate that the processing status of a task is a processing success status may be "1" or the like, and this application does not impose any limitation on this.

因此,在步骤1011中,可以获取该任务的任务标识,然后在第一对应关系中查找与该任务的任务标识相对应的用于表征任务的处理状态的二进制标识符。Therefore, in step 1011, the task identifier of the task may be obtained, and then a binary identifier corresponding to the task identifier of the task and used to characterize the processing status of the task may be searched in the first corresponding relationship.

1012、基于二进制标识符确定该任务是否处于处理失败状态。1012. Determine whether the task is in a processing failure state based on the binary identifier.

在本申请中,获取的用于表征该任务的处理状态的二进制标识符可能用于表征该任务的处理状态为处理失败状态,也可能用于表征该任务的处理状态为处理成功状态。In the present application, the binary identifier obtained for characterizing the processing status of the task may be used to characterize that the processing status of the task is a processing failure status, or may be used to characterize that the processing status of the task is a processing success status.

例如,在该二进制标识符用于表征该任务的处理状态为处理失败状态的情况下,可以确定该任务处于处理失败状态,然后可以将该任务确定为目标任务。在该二进制标识符用于表征该任务的处理状态为处理成功状态的情况下,则可以确定该任务处于处理成功状态。For example, when the binary identifier is used to represent that the processing state of the task is a processing failure state, it can be determined that the task is in a processing failure state, and then the task can be determined as a target task. When the binary identifier is used to represent that the processing state of the task is a processing success state, it can be determined that the task is in a processing success state.

在存在目标任务的情况下,在步骤S102中,获取用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符。In the case that there is a target task, in step S102 , a binary identifier for respectively characterizing the processing status of each subtask in the target task is obtained.

在本申请中,目标任务可能会包括至少两个子任务。In this application, the target task may include at least two subtasks.

例如,假设用户需要在电子设备维护的社交平台发布社交内容,社交内容包括图片和文本,用户可以向电子设备上传发布社交内容的请求,电子设备接收发布社交内容的请求,可以将该请求作为一个任务,对目标任务的处理即为对该请求的处理,在该任务中,通常情况下,电子设备需要将图片处理为统一的尺寸以及统一的分辨率的图片,然后检测文本中是否包括不宜公开发布的内容(例如违法的内容或者违背公序良俗的内容等),在文本中不包括不宜发布的内容的情况下,再将文本和处理后的图片作为社交内容发布在社交平台上。For example, suppose a user needs to publish social content on a social platform maintained by an electronic device, and the social content includes pictures and text. The user can upload a request to publish the social content to the electronic device. The electronic device receives the request to publish the social content and can treat the request as a task. The processing of the target task is the processing of the request. In this task, usually, the electronic device needs to process the picture into a picture of a uniform size and a uniform resolution, and then detect whether the text includes content that is not suitable for public release (such as illegal content or content that violates public order and good morals, etc.). If the text does not include content that is not suitable for release, the text and the processed picture are published as social content on the social platform.

其中,“将图片处理为统一的尺寸以及统一的分辨率的图片”、“检测文本中是否包括不宜公开发布的内”以及“将文本和处理后的图片作为社交内容发布在社交平台上”分别为3个子任务。Among them, "processing images into images of uniform size and resolution", "detecting whether the text contains content that is not suitable for public release" and "publishing the text and processed images as social content on social platforms" are three subtasks respectively.

其中,每当电子设备得到一个任务并将该任务存储在任务库中之后且在电子设备处理该任务之前,电子设备就可以确定该任务中包括哪些子任务,以及确定每一个子任务在该任务中的位置顺序,对于该任务中包括的任意一个子任务,电子设备可以设置用于表征该子任务的处理状态为处理失败状态的二进制标识符,对于该任务中包括的其他每一个子任务,同样执行上述操作,如此得到用于分别表征每一个子任务的处理状态为处理失败状态的二进制标识符,然后将每一个子任务对应的二进制标识符按照每一个子任务分别在该任务中的位置顺序组合在一起,得到二进制字符串。然后将该任务的任务标识与得到的该二进制字符串组成对应表项,并存储在任务的任务标识与二进制字符串之间的第二对应关系中。Wherein, whenever the electronic device obtains a task and stores the task in the task library and before the electronic device processes the task, the electronic device can determine which subtasks are included in the task, and determine the position order of each subtask in the task. For any subtask included in the task, the electronic device can set a binary identifier for characterizing that the processing status of the subtask is a processing failure state. For each other subtask included in the task, the above operation is performed in the same way, so as to obtain a binary identifier for characterizing that the processing status of each subtask is a processing failure state, and then the binary identifiers corresponding to each subtask are combined according to the position order of each subtask in the task to obtain a binary string. Then, the task identifier of the task and the obtained binary string form a corresponding table item, and store it in the second corresponding relationship between the task identifier of the task and the binary string.

进一步地,在电子设备之后处理该任务的过程中,如果处理该任务中的某一子任务且将该子任务处理成功,则可以在第二对应关系中的与该任务的任务标识相对应的二进制字符串中,将用于表征该子任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。Furthermore, in the process of the electronic device processing the task later, if a subtask in the task is processed and the subtask is processed successfully, the binary identifier used to characterize the processing status of the subtask can be modified to a binary identifier used to characterize the processing status as a successful processing status in the binary string corresponding to the task identifier of the task in the second correspondence.

其中,用于表征子任务的处理状态为处理失败状态的二进制标识符与用于表征子任务的处理状态为处理成功状态的二进制标识符不同。The binary identifier used to indicate that the processing status of the subtask is a processing failure status is different from the binary identifier used to indicate that the processing status of the subtask is a processing success status.

用于表征子任务的处理状态为处理失败状态的二进制标识符可以为“0”等,用于表征子任务的处理状态为处理成功状态的二进制标识符可以为“1”等,本申请对此不加以限定。The binary identifier used to indicate that the processing status of the subtask is a processing failure status may be "0" or the like, and the binary identifier used to indicate that the processing status of the subtask is a processing success status may be "1" or the like, and this application does not impose any limitation on this.

因此,在本步骤中,可以获取目标任务的任务标识,然后在第二对应关系中查找与目标任务任务标识相对应的二进制字符串,获取该二进制字符串中的每一个二进制标识符,从而得到用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符。Therefore, in this step, the task identifier of the target task can be obtained, and then the binary string corresponding to the task identifier of the target task can be searched in the second corresponding relationship to obtain each binary identifier in the binary string, thereby obtaining binary identifiers for respectively representing the processing status of each subtask in the target task.

在本申请另一实施例中,在目标任务处于处理成功状态的情况下,可以结束流程,或者,也可以间隔一段时间后再次开始执行步骤S101。In another embodiment of the present application, when the target task is in a successfully processed state, the process can be ended, or step S101 can be started again after a period of time.

在步骤S103中,基于用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符,在目标任务中的多个子任务中查找处于处理失败状态的目标子任务。In step S103 , based on the binary identifier used to respectively characterize the processing status of each subtask in the target task, a target subtask in a processing failure state is searched for among the multiple subtasks in the target task.

其中,可以在用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符中,查找用于表征处理状态为处理失败状态的二进制标识符,将查找到的二进制标识符对应的子任务确定为处于处理失败状态的目标子任务。Among them, a binary identifier used to represent the processing status as a processing failure state can be searched among the binary identifiers used to respectively represent the processing status of each subtask in the target task, and the subtask corresponding to the found binary identifier is determined as the target subtask in the processing failure state.

在步骤S104中,处理目标子任务。In step S104, the target subtask is processed.

进一步地,在本申请一个实施例中,如果目标任务中的处于处理失败状态的目标子任务为一个,则在处理目标子任务且将目标子任务处理成功的情况下,则说明目标任务中的子任务已经被全部处理成功。Further, in one embodiment of the present application, if there is one target subtask in the target task that is in a processing failure state, then when the target subtask is processed and successfully processed, it means that all subtasks in the target task have been successfully processed.

如此,可以将用于表征目标任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。例如,可以在第一对应关系中,将与目标任务的任务标识相对应的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。In this way, the binary identifier used to characterize the processing status of the target task can be modified to a binary identifier used to characterize that the processing status is a processing success status. For example, in the first corresponding relationship, the binary identifier corresponding to the task identifier of the target task can be modified to a binary identifier used to characterize that the processing status is a processing success status.

以及,还可以将用于表征目标子任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。Furthermore, the binary identifier used to characterize the processing status of the target subtask may be modified to a binary identifier used to characterize that the processing status is a processing success status.

例如,可以在第二对应关系中的与目标任务的任务标识相对应的二进制字符串中,将用于表征目标子任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。For example, in the binary string corresponding to the task identifier of the target task in the second corresponding relationship, the binary identifier used to characterize the processing status of the target subtask can be modified to a binary identifier used to characterize that the processing status is a processing success status.

或者,在本申请又一个实施例中,如果目标任务中的处于处理失败状态的目标子任务为至少两个,则在处理至少两个目标子任务且将至少两个目标子任务分别处理成功的情况下,则说明目标任务中的子任务已经全部被处理成功。Alternatively, in another embodiment of the present application, if there are at least two target subtasks in the target task that are in a processing failure state, then when at least two target subtasks are processed and the at least two target subtasks are processed successfully respectively, it means that all subtasks in the target task have been processed successfully.

如此,可以将用于表征目标任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。例如,可以在第一对应关系中,将与目标任务的任务标识相对应的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。In this way, the binary identifier used to characterize the processing status of the target task can be modified to a binary identifier used to characterize that the processing status is a processing success status. For example, in the first corresponding relationship, the binary identifier corresponding to the task identifier of the target task can be modified to a binary identifier used to characterize that the processing status is a processing success status.

以及,还可以将用于表征每一个目标子任务的处理状态的二进制标识符分别修改为用于表征处理状态为处理成功状态的二进制标识符。Furthermore, the binary identifier used to characterize the processing status of each target subtask may be modified to a binary identifier used to characterize that the processing status is a processing success status.

例如,可以在第二对应关系中的与目标任务的任务标识相对应的二进制字符串中,将用于表征每一个目标子任务的处理状态的二进制标识符分别修改为用于表征处理状态为处理成功状态的二进制标识符。For example, in the binary string corresponding to the task identifier of the target task in the second corresponding relationship, the binary identifier used to characterize the processing status of each target subtask can be modified into a binary identifier used to characterize that the processing status is a processing success status.

如此,可以避免之后重复处理已被处理成功的目标任务,以及,避免之后重复处理目标任务中的已被处理成功的目标子任务,进而避免浪费系统资源。In this way, it is possible to avoid repeated processing of a target task that has been successfully processed, and to avoid repeated processing of a target subtask in a target task that has been successfully processed, thereby avoiding wasting system resources.

在本申请中,基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务。在存在目标任务的情况下,获取用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符。基于用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符,在目标任务中的多个子任务中查找处于处理失败状态的目标子任务。处理目标子任务。In the present application, based on the binary identifier used to characterize the processing status of each task in the task library, it is detected whether there is a target task in a processing failure state in the task library. In the case of a target task, a binary identifier used to characterize the processing status of each subtask in the target task is obtained. Based on the binary identifier used to characterize the processing status of each subtask in the target task, a target subtask in a processing failure state is searched among multiple subtasks in the target task. The target subtask is processed.

可见,在本申请中,如果任务库中存在处于处理失败状态的目标任务,则在目标任务中的哪个子任务处于处理失败状态的情况下,重新执行该子任务即可,直至该子任务被处理成功为止,从而使得目标任务被处理成功,通过本申请,可以将目标任务中的每一个子任务单独看待并处理,可以仅对目标任务中的处于处理失败状态的目标子任务重新处理,可以不对目标任务中的全部子任务重新处理,如此,可以不对目标任务中的处于处理成功状态的子任务重新处理,从而可以减少目标任务中的需要重新处理的子任务的数量,从而可以节省系统资源,节省时间,提高将目标任务处理成功的效率。It can be seen that in the present application, if there is a target task in the task library that is in a processing failure state, then if a subtask in the target task is in a processing failure state, the subtask can be re-executed until the subtask is successfully processed, thereby making the target task successfully processed. Through the present application, each subtask in the target task can be viewed and processed separately, and only the target subtask in the target task that is in a processing failure state can be reprocessed, and all the subtasks in the target task do not need to be reprocessed. In this way, the subtask in the target task that is in a processing success state does not need to be reprocessed, thereby reducing the number of subtasks in the target task that need to be reprocessed, thereby saving system resources, saving time, and improving the efficiency of successfully processing the target task.

在前述实施例中,电子设备中会存储用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符,也即,目标任务中存在几个子任务,电子设备就会存储几个二进制标识符。然而,在目标任务中包括的子任务的数量较多的情况下,电子设备存储的二进制标识符也会较多,较多的二进制标识符会占用电子设备较多的存储空间。In the above-mentioned embodiment, the electronic device stores binary identifiers for representing the processing status of each subtask in the target task, that is, the electronic device stores several binary identifiers if there are several subtasks in the target task. However, when the number of subtasks included in the target task is large, the electronic device stores more binary identifiers, and more binary identifiers will occupy more storage space of the electronic device.

因此,为了节省电子设备的存储空间,在本申请另一实施例中,参见图2,步骤S102包括:Therefore, in order to save storage space of the electronic device, in another embodiment of the present application, referring to FIG. 2 , step S102 includes:

在步骤S201中,获取用于表征目标任务中的每一个子任务的处理状态的十进制标识符。In step S201 , a decimal identifier for characterizing the processing status of each subtask in the target task is obtained.

在本申请中,事先可以设置目标任务中的每一个子任务分别在目标任务中的位置顺序,然后按照每一个子任务分别在目标任务中的位置顺序,将用于表征目标任务中的每一个子任务的处理状态的二进制标识符组合为二进制字符串,然后将二进制字符串转换为十进制字符,然后将目标任务的任务标识与转换得到的十进制字符组成对应表项,并存储在任务的任务标识与用于表征任务中的每一个子任务的处理状态的十进制标识符之间的第三对应关系中。In the present application, the position order of each subtask in the target task can be set in advance, and then the binary identifiers used to characterize the processing status of each subtask in the target task can be combined into a binary string according to the position order of each subtask in the target task, and then the binary string is converted into decimal characters, and then the task identifier of the target task and the converted decimal characters are composed of corresponding table items, and stored in the third correspondence between the task identifier of the task and the decimal identifier used to characterize the processing status of each subtask in the task.

如此,在本步骤中,可以获取目标任务的任务标识,然后在第三对应关系中查找与目标任务的任务标识相对应的十进制标识符。Thus, in this step, the task identifier of the target task may be obtained, and then the decimal identifier corresponding to the task identifier of the target task may be searched in the third corresponding relationship.

其中,在目标任务中包括的子任务的数量较多的情况下,将分别用于表征目标任务中的每一个子任务的处理状态的二进制标识符组合得到的二进制字符串所占的空间会大于将二进制字符串转换得到的十进制字符所占的空间,因此,存储十进制标识符可以节省存储空间。Among them, when the number of subtasks included in the target task is large, the space occupied by the binary string obtained by combining the binary identifiers used to represent the processing status of each subtask in the target task will be larger than the space occupied by the decimal characters converted from the binary string. Therefore, storing decimal identifiers can save storage space.

然而,在十进制字符为UTL-8编码的字符的情况下,在电子设备存储十进制字符的过程中,可能会发生对十进制字符的转义的情况,导致之后读取到的并不是这个十进制字符,而是转义后的十进制字符,是不准确的十进制字符,依照不准确的十进制字符判定处于处理失败状态的子任务可能会出错。However, in the case where the decimal character is a UTL-8 encoded character, the decimal character may be escaped during the process of storing the decimal character in the electronic device, resulting in the decimal character being read later instead of the decimal character itself, which is an inaccurate decimal character. The subtask that is determined to be in a failed processing state based on the inaccurate decimal character may go wrong.

因此,为了避免这种情况发生,在存储十进制标识符之前,可以对十进制标识符使用base64编码方式编码,得到一编码,然后将目标任务的任务标识与该编码组成对应表项,并存储在任务的任务标识与编码之间的第四对应关系中。Therefore, in order to avoid this situation, before storing the decimal identifier, the decimal identifier can be encoded using base64 encoding to obtain a code, and then the task identifier of the target task and the code are composed of a corresponding table entry and stored in the fourth corresponding relationship between the task identifier and the code.

如此,在本步骤中,可以获取已存储的编码,例如,可以获取目标任务的任务标识,然后在第四对应关系中查找与目标任务的任务标识相对应的编码。该编码是事先在存储十进制标识符时,对十进制标识符使用base64编码方式编码得到的,然后使用base64编码方式对应的解码方式对编码解码,得到十进制标识符,这样,得到的十进制字符就与当初需要存储的十进制字符相同,是准确的十进制字符,依照准确的十进制字符判定处于处理失败状态的子任务不会出错。Thus, in this step, the stored code can be obtained, for example, the task identifier of the target task can be obtained, and then the code corresponding to the task identifier of the target task can be found in the fourth corresponding relationship. The code is obtained by encoding the decimal identifier using the base64 encoding method when storing the decimal identifier in advance, and then decoding the code using the decoding method corresponding to the base64 encoding method to obtain the decimal identifier. In this way, the decimal character obtained is the same as the decimal character that needs to be stored at the beginning, and is an accurate decimal character. It will not be wrong to determine the subtask in the processing failure state according to the accurate decimal character.

在步骤S202中,将十进制标识符数转换为二进制字符串,二进制字符串中包括用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符。In step S202, the decimal identifier number is converted into a binary string, wherein the binary string includes a binary identifier for respectively representing the processing status of each subtask in the target task.

进一步地,在步骤S103中,可以在二进制字符串包括的用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符中,查找用于表征处理状态为处理失败状态的二进制标识符,然后获取查找到的二进制标识符在二进制字符串中的位置顺序,将该位置顺序所对应的子任务确定为处于处理失败状态的目标子任务。Furthermore, in step S103, a binary identifier used to characterize the processing status as a processing failure state can be searched for in the binary identifiers included in the binary string and used to respectively characterize the processing status of each subtask in the target task, and then the position sequence of the found binary identifiers in the binary string is obtained, and the subtask corresponding to the position sequence is determined as the target subtask in the processing failure state.

例如,假设用于表征子任务的处理状态为处理失败状态的二进制标识符为“0”,用于表征子任务的处理状态为处理成功状态的二进制标识符为“1”。For example, it is assumed that the binary identifier used to indicate that the processing status of the subtask is a processing failure status is “0”, and the binary identifier used to indicate that the processing status of the subtask is a processing success status is “1”.

目标任务中包括3个子任务,目标任务对应的二进制字符串为“011”,位置顺序为第1位的二进制标识符“0”对应的子任务为目标任务中的第1个子任务,位置顺序为第2位的二进制标识符“1”对应的子任务为目标任务中的第2个子任务,位置顺序为第3位的二进制标识符“1”对应的子任务为目标任务中的第3个子任务。The target task includes 3 subtasks. The binary string corresponding to the target task is "011". The subtask corresponding to the binary identifier "0" in the first position is the first subtask in the target task. The subtask corresponding to the binary identifier "1" in the second position is the second subtask in the target task. The subtask corresponding to the binary identifier "1" in the third position is the third subtask in the target task.

其中,二进制标识符“0”在二进制字符串为“011”中的位置顺序为第1位,因此,可以将位置顺序第1位对应的第1个子任务确定为处于处理失败状态的目标子任务。The binary identifier "0" is at the first position in the binary string "011", so the first subtask corresponding to the first position can be determined as the target subtask in the processing failure state.

在本申请一个实施例中,步骤S104中处理目标子任务时,可以将目标子任务存储在任务队列中。异步地,可以串行处理任务队列中的目标子任务。In one embodiment of the present application, when processing the target subtask in step S104, the target subtask may be stored in a task queue. Asynchronously, the target subtasks in the task queue may be processed serially.

在本申请中,在任务队列中存储目标子任务的流程以及处理任务队列中的目标子任务的流程可以分别由电子设备中的不同的线程执行。In the present application, the process of storing the target subtask in the task queue and the process of processing the target subtask in the task queue can be executed by different threads in the electronic device respectively.

例如,电子设备中包括任务调度线程和任务处理线程,任务调度线程与任务处理线程之间相互不干扰。For example, the electronic device includes a task scheduling thread and a task processing thread, and the task scheduling thread and the task processing thread do not interfere with each other.

电子设备可以基于任务调度线程将目标子任务存储在任务队列中,以及,电子设备可以基于任务处理线程处理任务队列中的目标子任务。The electronic device may store the target subtask in the task queue based on the task scheduling thread, and the electronic device may process the target subtask in the task queue based on the task processing thread.

如此,在电子设备基于任务调度线程在任务队列中存储目标子任务的过程中,在任务队列中开始存储一个目标子任务之后,异步地,电子设备基于任务处理线程就可以开始处理任务队列中的目标子任务,避免出现“在任务队列中存储完毕所有目标子任务之后才开始串行处理任务队列中的目标子任务”的情况,从而可以提高任务处理效率。In this way, in the process of the electronic device storing target subtasks in the task queue based on the task scheduling thread, after starting to store a target subtask in the task queue, the electronic device can asynchronously start processing the target subtask in the task queue based on the task processing thread, avoiding the situation of "serial processing of target subtasks in the task queue only starts after all target subtasks are stored in the task queue", thereby improving task processing efficiency.

在一个实施例中,电子设备可以同时大批量地处理任务队列中的子任务,也即,一次处理任务队列中的多个目标子任务,但是,这样会突然占用电子设备中较多的系统资源,也即,会使得电子设备的系统资源的利用率突增,会给电子设备带来安全隐患。In one embodiment, the electronic device can process subtasks in the task queue in batches at the same time, that is, process multiple target subtasks in the task queue at one time. However, this will suddenly occupy more system resources in the electronic device, that is, it will cause a sudden increase in the utilization rate of the system resources of the electronic device, which will bring security risks to the electronic device.

因此,为了避免这种情况发生,电子设备可以串行处理任务队列中的目标子任务,如此可以避免电子设备的系统资源的利用率突增,进而可以避免给电子设备带来安全隐患。Therefore, in order to avoid this situation, the electronic device can process the target subtasks in the task queue in serial, so as to avoid a sudden increase in the utilization of the system resources of the electronic device, thereby avoiding safety hazards to the electronic device.

进一步地,在本申请一个实施例中,在任务队列中,还可以删除已处理成功的目标子任务,以避免之后重复处理已处理成功的目标子任务,进而避免浪费系统资源。Furthermore, in one embodiment of the present application, in the task queue, the successfully processed target subtasks may be deleted to avoid repeated processing of the successfully processed target subtasks, thereby avoiding wasting system resources.

例如,对于任务处理队列中的任意一个目标子任务,在电子设备处理一次该目标子任务之后,如果将该目标子任务处理成功,则可以从任务队列中删除该目标子任务,如果未将该目标子任务处理成功,则再次继续尝试处理该目标子任务,直至将该目标子任务处理成功为止,然后可以从任务队列中删除该目标子任务。For example, for any target subtask in the task processing queue, after the electronic device processes the target subtask once, if the target subtask is processed successfully, the target subtask can be deleted from the task queue; if the target subtask is not processed successfully, the target subtask is tried again until it is processed successfully, and then the target subtask can be deleted from the task queue.

对于任务处理队列中的其他每一个目标子任务,同样如此。The same is true for each other target subtask in the task processing queue.

然而,在本申请一个实施例中,为了尽可能保证处于处理失败状态的任务能够被处理成功,则可以每间隔预设时长就至少执行一次图1所示的实施例,也即,每间隔预设时长就至少执行一次步骤S101~步骤S104的流程。However, in one embodiment of the present application, in order to ensure as much as possible that a task in a processing failure state can be processed successfully, the embodiment shown in Figure 1 can be executed at least once at every preset time interval, that is, the process of steps S101 to S104 can be executed at least once at every preset time interval.

例如,在一个示例中,在执行步骤S101“基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务”之后,可以间隔预设时长,然后再次开始执行步骤S101:基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务。For example, in one example, after executing step S101 "based on the binary identifier used to characterize the processing status of each task in the task library, detecting whether there is a target task in the task library that is in a processing failure state", a preset time interval can be maintained, and then step S101 can be started again: based on the binary identifier used to characterize the processing status of each task in the task library, detecting whether there is a target task in the task library that is in a processing failure state.

然而,在前述实施例中,对于任务队列中的任意一个目标子任务,如果未将该目标子任务处理成功,则可以再次继续尝试处理该目标子任务,直至将该目标子任务处理成功为止,然后可以从任务队列中删除该目标子任务。However, in the aforementioned embodiment, for any target subtask in the task queue, if the target subtask is not processed successfully, the target subtask can be tried again until it is processed successfully, and then the target subtask can be deleted from the task queue.

但是,在执行步骤S101之后如果已到达预设时长,但是电子设备仍旧未将该目标子任务处理成功,则在再次执行步骤S101之后,会将该目标子任务重复存储在任务队列中,之后可能会造成对该目标子任务被多次重复处理,从而浪费系统资源。However, after executing step S101, if the preset time has been reached, but the electronic device still has not successfully processed the target subtask, then after executing step S101 again, the target subtask will be repeatedly stored in the task queue, which may cause the target subtask to be repeatedly processed multiple times, thereby wasting system resources.

因此,为了节省系统资源,在本申请另一实施例中,将目标子任务存储在任务队列中之前,可以判断目标子任务是否存储在任务队列中,如果目标子任务未存储在任务队列中,则再在任务队列中存储目标子任务,如果目标子任务已存储在任务队列中,则不在任务队列中存储目标子任务,从而避免将该目标子任务重复存储在任务队列中,进而可以避免对该目标子任务的重复处理,进而避免浪费系统资源。Therefore, in order to save system resources, in another embodiment of the present application, before storing the target subtask in the task queue, it can be determined whether the target subtask is stored in the task queue. If the target subtask is not stored in the task queue, the target subtask is stored in the task queue. If the target subtask has been stored in the task queue, the target subtask is not stored in the task queue, thereby avoiding repeated storage of the target subtask in the task queue, thereby avoiding repeated processing of the target subtask, and thus avoiding wasting system resources.

在本申请中,预设时长可以是技术人员事先在电子设备中根据实际情况设定的,例如,可以包括1秒、2秒或5秒等,本申请对此不加以限定。In the present application, the preset duration may be set in advance by a technician in the electronic device according to actual conditions, for example, it may include 1 second, 2 seconds or 5 seconds, etc., and the present application does not limit this.

在前述实施例中,预设时长可以是固定的时长,然而,有时候,处于处理失败状态的目标子任务有很多,有时候,处于处理失败状态的目标子任务较少。In the aforementioned embodiment, the preset duration may be a fixed duration. However, sometimes, there are many target subtasks in the processing failure state, and sometimes, there are fewer target subtasks in the processing failure state.

由于电子设备在单位时长内能够处理的子任务的数量是有限的,因此,在处于处理失败状态的目标子任务有很多的情况下,为了尽可能地使得更多的子任务能够尽快被处理成功,则可以缩短预设时长。Since the number of subtasks that an electronic device can process within a unit time is limited, when there are many target subtasks in a processing failure state, the preset time can be shortened in order to enable as many subtasks as possible to be processed successfully as soon as possible.

在处于处理失败状态的目标子任务有较少的情况下,为了避免多次重复无意义地至少执行图1所示的实施例,进而节省电子设备的系统资源,则可以延长预设时长。When there are fewer target subtasks in a processing failure state, the preset duration may be extended to avoid meaninglessly executing at least the embodiment shown in FIG. 1 repeatedly and thereby save system resources of the electronic device.

所以,可以根据目标任务的数量和/或目标任务中的目标子任务的数量调整预设时长。目标任务中的目标子任务包括每一个目标任务中的目标子任务的数量的总和。Therefore, the preset duration can be adjusted according to the number of target tasks and/or the number of target subtasks in the target task. The target subtasks in the target task include the sum of the number of target subtasks in each target task.

例如,在目标任务的数量大于第一预设阈值或者目标子任务的数量大于第二预设阈值的情况下,缩短预设时长。For example, when the number of target tasks is greater than a first preset threshold or the number of target subtasks is greater than a second preset threshold, the preset duration is shortened.

具体地,可以使用一个更短的预设时长替换当前的预设时长。更短的预设时长短于当前的预设时长,更短的预设时长的具体确定方式可以根据目标任务的数量或者目标子任务的数量来确定,本申请对具体的确定方式不做限定。Specifically, a shorter preset duration can be used to replace the current preset duration. The shorter preset duration is shorter than the current preset duration. The specific determination method of the shorter preset duration can be determined according to the number of target tasks or the number of target subtasks, and this application does not limit the specific determination method.

在目标任务的数量大于第一预设阈值或者目标子任务的数量大于第二预设阈值的前提下,目标任务的数量或者目标子任务的数量越大,则预设时长越短,目标任务的数量或者目标子任务的数量小,则预设时长越长。On the premise that the number of target tasks is greater than the first preset threshold or the number of target subtasks is greater than the second preset threshold, the larger the number of target tasks or the number of target subtasks is, the shorter the preset duration is, and the smaller the number of target tasks or the number of target subtasks is, the longer the preset duration is.

或者,在目标任务的数量小于或等于第一预设阈值且目标子任务的数量小于或等于第二预设阈值的情况下,延长预设时长。Alternatively, when the number of target tasks is less than or equal to a first preset threshold and the number of target subtasks is less than or equal to a second preset threshold, the preset duration is extended.

具体地,可以使用一个更长的预设时长替换当前的预设时长。更长的预设时长长于当前的预设时长,更长的预设时长的具体确定方式可以根据目标任务的数量以及目标子任务的数量来确定,本申请对具体的确定方式不做限定。Specifically, a longer preset duration can be used to replace the current preset duration. The longer preset duration is longer than the current preset duration. The specific determination method of the longer preset duration can be determined according to the number of target tasks and the number of target subtasks, and this application does not limit the specific determination method.

在目标任务的数量小于或等于第一预设阈值且目标子任务的数量小于或等于第二预设阈值的情况下,目标任务的数量以及目标子任务的数量越大,则预设时长越短,目标任务的数量或者目标子任务的数量小,则预设时长越长。When the number of target tasks is less than or equal to the first preset threshold and the number of target subtasks is less than or equal to the second preset threshold, the larger the number of target tasks and the number of target subtasks, the shorter the preset duration; the smaller the number of target tasks or the number of target subtasks, the longer the preset duration.

第一预设阈值和第二预设阈值可以根据实际情况确定,本申请对此不加以限定。The first preset threshold and the second preset threshold can be determined according to actual conditions, and this application does not limit this.

需要说明的是,对于方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作并不一定是本申请所必须的。It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present application.

参照图3,示出了本申请的一种任务处理装置的结构框图,该装置具体可以包括如下模块:3, a structural block diagram of a task processing device of the present application is shown, and the device may specifically include the following modules:

检测模块11,用于基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务;A detection module 11 is used to detect whether there is a target task in a processing failure state in the task library based on a binary identifier used to characterize the processing state of each task in the task library;

获取模块12,用于在存在所述目标任务的情况下,获取用于分别表征所述目标任务中的每一个子任务的处理状态的二进制标识符;An acquisition module 12, used for acquiring binary identifiers for respectively representing the processing status of each subtask in the target task when the target task exists;

查找模块13,用于基于用于分别表征每一个子任务的处理状态的二进制标识符,在所述目标任务中的多个子任务中查找处于处理失败状态的目标子任务;A search module 13, configured to search for a target subtask in a processing failure state among the multiple subtasks in the target task based on a binary identifier used to respectively characterize the processing state of each subtask;

处理模块14,用于处理所述目标子任务。The processing module 14 is used to process the target subtask.

在一个可选的实现方式中,所述获取模块包括:In an optional implementation, the acquisition module includes:

第一获取单元,用于获取用于表征所述目标任务中的每一个子任务的处理状态的十进制标识符;A first acquisition unit, used for acquiring a decimal identifier for representing a processing status of each subtask in the target task;

转换单元,用于将所述十进制标识符数转换为二进制字符串,所述二进制字符串中包括用于分别表征所述目标任务中的每一个子任务的处理状态的二进制标识符。The conversion unit is used to convert the decimal identifier number into a binary string, wherein the binary string includes a binary identifier for respectively representing the processing status of each subtask in the target task.

在一个可选的实现方式中,所述第一获取单元包括:In an optional implementation, the first acquiring unit includes:

获取子单元,用于获取已存储的编码,所述编码是事先在存储所述十进制标识符时,对所述十进制标识符使用base64编码方式编码得到的;An acquisition subunit, used for acquiring a stored code, wherein the code is obtained by encoding the decimal identifier using a base64 encoding method when storing the decimal identifier in advance;

解码子单元,用于使用base64编码方式对应的解码方式对所述编码解码,得到所述十进制标识符。The decoding subunit is used to decode the encoding using a decoding method corresponding to the base64 encoding method to obtain the decimal identifier.

在一个可选的实现方式中,所述查找模块包括:In an optional implementation, the search module includes:

查找单元,用于在所述二进制字符串中查找用于表征处理状态为处理失败状态的二进制标识符;A searching unit, used for searching the binary identifier used to indicate that the processing status is a processing failure status in the binary string;

第二获取单元,用于获取查找到的二进制标识符在所述二进制字符串中的位置顺序;A second obtaining unit, used for obtaining the position sequence of the found binary identifier in the binary string;

确定单元,用于将所述位置顺序所对应的子任务确定为所述目标子任务。A determination unit is used to determine the subtask corresponding to the position sequence as the target subtask.

在一个可选的实现方式中,所述装置还包括:In an optional implementation, the device further includes:

修改模块,用于在将所述目标子任务处理成功的情况下,将用于表征所述目标任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符;和/或,将用于表征所述目标子任务的处理状态的二进制标识符修改为用于表征处理状态为处理成功状态的二进制标识符。A modification module is used to modify the binary identifier used to characterize the processing status of the target task into a binary identifier used to characterize the processing status as a successful processing status when the target subtask is processed successfully; and/or, to modify the binary identifier used to characterize the processing status of the target subtask into a binary identifier used to characterize the processing status as a successful processing status.

在一个可选的实现方式中,所述处理模块包括:In an optional implementation, the processing module includes:

存储单元,用于将所述目标子任务存储在任务队列中;以及,处理单元,用于串行处理所述任务队列中的目标子任务。A storage unit is used to store the target subtask in a task queue; and a processing unit is used to serially process the target subtask in the task queue.

在一个可选的实现方式中,所述处理模块还包括:In an optional implementation, the processing module further includes:

删除单元,用于在所述任务队列中,删除已处理成功的目标子任务。The deleting unit is used to delete the successfully processed target subtask in the task queue.

在一个可选的实现方式中,所述检测模块还用于:In an optional implementation, the detection module is further used to:

在基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务的之后,间隔预设时长,再次基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务。After detecting whether there is a target task in a processing failure state in the task library based on the binary identifier used to characterize the processing status of each task in the task library, at an interval of a preset time, detecting whether there is a target task in a processing failure state in the task library again based on the binary identifier used to characterize the processing status of each task in the task library.

在一个可选的实现方式中,所述装置还包括:In an optional implementation, the device further includes:

调整模块,用于根据所述目标任务的数量和/或目标任务中的目标子任务的数量调整所述预设时长。The adjustment module is used to adjust the preset duration according to the number of the target tasks and/or the number of target subtasks in the target task.

在一个可选的实现方式中,所述调整模块包括:In an optional implementation, the adjustment module includes:

缩短单元,用于在所述目标任务的数量大于第一预设阈值或者所述目标子任务的数量大于第二预设阈值的情况下,缩短所述预设时长;a shortening unit, configured to shorten the preset duration when the number of the target tasks is greater than a first preset threshold or the number of the target subtasks is greater than a second preset threshold;

或者,or,

延长单元,用于在所述目标任务的数量小于或等于第一预设阈值且所述目标子任务的数量小于或等于第二预设阈值的情况下,延长所述预设时长。The extension unit is used to extend the preset duration when the number of the target tasks is less than or equal to a first preset threshold and the number of the target subtasks is less than or equal to a second preset threshold.

基于用于表征任务库中的每一个任务的处理状态的二进制标识符,在任务库中检测是否存在处于处理失败状态的目标任务。在存在目标任务的情况下,获取用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符。基于用于分别表征目标任务中的每一个子任务的处理状态的二进制标识符,在目标任务中的多个子任务中查找处于处理失败状态的目标子任务。处理目标子任务。Based on the binary identifier used to characterize the processing status of each task in the task library, detect whether there is a target task in a processing failure state in the task library. In the case of a target task, obtain a binary identifier used to respectively characterize the processing status of each subtask in the target task. Based on the binary identifier used to respectively characterize the processing status of each subtask in the target task, search for a target subtask in a processing failure state among multiple subtasks in the target task. Process the target subtask.

可见,在本申请中,如果任务库中存在处于处理失败状态的目标任务,则在目标任务中的哪个子任务处于处理失败状态的情况下,重新执行该子任务即可,直至该子任务被处理成功为止,从而使得目标任务被处理成功,通过本申请,可以将目标任务中的每一个子任务单独看待并处理,可以仅对目标任务中的处于处理失败状态的目标子任务重新处理,可以不对目标任务中的全部子任务重新处理,如此,可以不对目标任务中的处于处理成功状态的子任务重新处理,从而可以减少目标任务中的需要重新处理的子任务的数量,从而可以节省系统资源,节省时间,提高将目标任务处理成功的效率。It can be seen that in the present application, if there is a target task in the task library that is in a processing failure state, then if a subtask in the target task is in a processing failure state, the subtask can be re-executed until the subtask is successfully processed, thereby making the target task successfully processed. Through the present application, each subtask in the target task can be viewed and processed separately, and only the target subtask in the target task that is in a processing failure state can be reprocessed, and all the subtasks in the target task do not need to be reprocessed. In this way, the subtask in the target task that is in a processing success state does not need to be reprocessed, thereby reducing the number of subtasks in the target task that need to be reprocessed, thereby saving system resources, saving time, and improving the efficiency of successfully processing the target task.

对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

图4是本申请示出的一种电子设备800的框图。例如,电子设备800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。4 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

参照图4,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电力组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。4 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input/output (I/O) interface 812 , a sensor component 814 , and a communication component 816 .

处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

存储器804被配置为存储各种类型的数据以支持在设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图像,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, images, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。I/O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

传感器组件814包括一个或多个传感器,用于为电子设备800提供每一个方面的状态评估。例如,传感器组件814可以检测到设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。The sensor assembly 814 includes one or more sensors for providing status assessment of each aspect of the electronic device 800. For example, the sensor assembly 814 can detect the open/closed state of the device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration/deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如WiFi,运营商网络(如2G、3G、4G或5G),或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播操作信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器804,上述指令可由电子设备800的处理器820执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

图5是本申请示出的一种电子设备1900的框图。例如,电子设备1900可以被提供为一服务器。Fig. 5 is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 can be provided as a server.

参照图5,电子设备1900包括处理组件1922,其进一步包括一个或多个处理器,以及由存储器1932所代表的存储器资源,用于存储可由处理组件1922的执行的指令,例如应用程序。存储器1932中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件1922被配置为执行指令,以执行上述方法。5, the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions, such as applications, that can be executed by the processing component 1922. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

电子设备1900还可以包括一个电源组件1926被配置为执行电子设备1900的电源管理,一个有线或无线网络接口1950被配置为将电子设备1900连接到网络,和一个输入输出(I/O)接口1958。电子设备1900可以操作基于存储在存储器1932的操作系统,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM或类似。The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.

本说明书中的每一个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,每一个实施例之间相同相似的部分互相参见即可。Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between each embodiment can be referenced to each other.

本领域内的技术人员应明白,本申请的实施例可提供为方法、装置、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

本申请是参照根据本申请的方法、终端设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to the flowchart and/or block diagram of the method, terminal device (system), and computer program product according to the present application. It should be understood that each process and/or box in the flowchart and/or block diagram, as well as the combination of the process and/or box in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for implementing the functions specified in one process or multiple processes in the flowchart and/or one box or multiple boxes in the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

尽管已描述了本申请的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请范围的所有变更和修改。Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的相同要素。Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

以上对本申请所提供的一种任务处理方法及装置,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The above is a detailed introduction to a task processing method and device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims (22)

1. A method for processing tasks, applied to an electronic device, the method comprising:
Detecting, in the task library, whether there is a target task in a processing failure state based on a binary identifier for characterizing a processing state of each task in the task library;
in the presence of the target task, obtaining a binary identifier for characterizing the processing state of each sub-task in the target task, respectively, comprising: acquiring a task identifier of the target task, searching a binary character string corresponding to the task identifier in a second corresponding relation, acquiring each binary identifier in the binary character string, and storing a corresponding table item formed by the task identifier of each task and the binary character string of the task in the second corresponding relation, wherein the binary identifiers corresponding to each subtask in the binary character string are combined according to the position sequence of each subtask in the target task;
Searching a target subtask in a processing failure state in a plurality of subtasks in the target task based on a binary identifier for respectively representing the processing state of each subtask;
And processing the target subtasks.
2. The method of claim 1, wherein the obtaining a binary identifier for characterizing the processing state of each of the subtasks in the target task, respectively, comprises:
obtaining a decimal identifier for characterizing a processing state of each subtask in the target task;
The decimal identifier number is converted into a binary character string, and the binary character string comprises binary identifiers used for respectively representing the processing states of each subtask in the target task.
3. The method of claim 2, wherein the obtaining a decimal identifier for characterizing a processing state of each of the subtasks in the target task comprises:
Acquiring a stored code, wherein the code is obtained by coding the decimal identifier in a base64 coding mode in advance when the decimal identifier is stored;
and decoding the code by using a decoding mode corresponding to the base64 coding mode to obtain the decimal identifier.
4. A method according to claim 2 or 3, wherein searching for a target subtask in a processing failure state among a plurality of subtasks in the target task based on a binary identifier for characterizing a processing state of each subtask, respectively, comprises:
Searching a binary identifier for representing that the processing state is a processing failure state in the binary character string;
acquiring the position sequence of the searched binary identifier in the binary character string;
And determining the subtasks corresponding to the position sequence as the target subtasks.
5. The method of claim 1, wherein after processing the target subtask, further comprising:
Modifying a binary identifier for representing the processing state of the target task into a binary identifier for representing the processing state as a processing success state under the condition that the target subtask is successfully processed; and/or modifying a binary identifier for characterizing the processing state of the target subtask into a binary identifier for characterizing the processing state as a processing success state.
6. The method of claim 1, wherein the processing the target subtask comprises:
Storing the target subtasks in a task queue; asynchronously, the target subtasks in the task queue are processed serially.
7. The method of claim 6, wherein the method further comprises:
And deleting the successfully processed target subtasks in the task queue.
8. The method according to claim 1 or 5, characterized in that the method further comprises:
And after the step of detecting whether the target task in the processing failure state exists in the task library or not based on the binary identifier for representing the processing state of each task in the task library is executed, the step of detecting whether the target task in the processing failure state exists in the task library or not based on the binary identifier for representing the processing state of each task in the task library is executed again at intervals of preset time length.
9. The method of claim 8, wherein the method further comprises:
And adjusting the preset duration according to the number of the target tasks and/or the number of target subtasks in the target tasks.
10. The method according to claim 9, wherein said adjusting the preset time period according to the number of target tasks and/or the number of target sub-tasks in a target task comprises:
shortening the preset duration when the number of the target tasks is greater than a first preset threshold or the number of the target subtasks is greater than a second preset threshold;
Or alternatively
And when the number of the target tasks is smaller than or equal to a first preset threshold value and the number of the target subtasks is smaller than or equal to a second preset threshold value, prolonging the preset duration.
11. A task processing device, characterized by being applied to an electronic apparatus, the device comprising:
A detection module for detecting whether there is a target task in a processing failure state in the task library based on a binary identifier for characterizing a processing state of each task in the task library;
An acquisition module for acquiring a binary identifier for characterizing a processing state of each subtask in the target task, respectively, in the presence of the target task;
The searching module is used for searching a target subtask in a processing failure state from a plurality of subtasks in the target task based on the binary identifiers used for respectively representing the processing states of each subtask;
The processing module is used for processing the target subtasks;
wherein the binary identifier is obtained by a module in the device for performing the following procedure:
Acquiring a task identifier of the target task, searching a binary character string corresponding to the task identifier in a second corresponding relation, acquiring each binary identifier in the binary character string, storing a corresponding table item formed by the task identifier of each task and the binary character string of the task in the second corresponding relation, and combining the binary identifiers corresponding to each subtask in the binary character string according to the position sequence of each subtask in the target task.
12. The apparatus of claim 11, wherein the acquisition module comprises:
A first acquisition unit configured to acquire a decimal identifier for characterizing a processing state of each of the subtasks in the target task;
A conversion unit, configured to convert the decimal identifier number into a binary string, where the binary string includes a binary identifier that is used to respectively characterize a processing state of each subtask in the target task.
13. The apparatus of claim 12, wherein the first acquisition unit comprises:
An acquisition subunit, configured to acquire a stored code, where the code is obtained by encoding the decimal identifier in a base64 encoding manner when the decimal identifier is stored in advance;
and the decoding subunit is used for decoding the codes by using a decoding mode corresponding to the base64 coding mode to obtain the decimal identifier.
14. The apparatus according to claim 12 or 13, wherein the lookup module comprises:
A searching unit, configured to search the binary string for a binary identifier that characterizes the processing state as a processing failure state;
a second obtaining unit, configured to obtain a position order of the searched binary identifier in the binary string;
And the determining unit is used for determining the subtasks corresponding to the position sequence as the target subtasks.
15. The apparatus of claim 11, wherein the apparatus further comprises:
A modifying module, configured to modify, if the target subtask is successfully processed, a binary identifier for characterizing a processing state of the target subtask into a binary identifier for characterizing that the processing state is a processing success state; and/or modifying a binary identifier for characterizing the processing state of the target subtask into a binary identifier for characterizing the processing state as a processing success state.
16. The apparatus of claim 11, wherein the processing module comprises:
The storage unit is used for storing the target subtasks in a task queue; and the processing unit is used for serially processing the target subtasks in the task queue.
17. The apparatus of claim 16, wherein the processing module further comprises:
And the deleting unit is used for deleting the successfully processed target subtasks in the task queue.
18. The apparatus of claim 11 or 15, wherein the detection module is further configured to:
after detecting whether there is a target task in a processing failure state in the task library based on the binary identifier for characterizing the processing state of each task in the task library, a preset time period is set between, and detecting whether there is a target task in a processing failure state in the task library based on the binary identifier for characterizing the processing state of each task in the task library again.
19. The apparatus of claim 18, wherein the apparatus further comprises:
The adjusting module is used for adjusting the preset duration according to the number of the target tasks and/or the number of target subtasks in the target tasks.
20. The apparatus of claim 19, wherein the adjustment module comprises:
A shortening unit, configured to shorten the preset duration when the number of the target tasks is greater than a first preset threshold or the number of the target subtasks is greater than a second preset threshold;
Or alternatively
The extension unit is used for extending the preset duration when the number of the target tasks is smaller than or equal to a first preset threshold value and the number of the target subtasks is smaller than or equal to a second preset threshold value.
21. An electronic device, the electronic device comprising:
A processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the task processing method of any of claims 1-10.
22. A non-transitory computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the task processing method of any of claims 1-10.
CN202011219440.8A 2020-11-04 2020-11-04 A task processing method and device Active CN112416545B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011219440.8A CN112416545B (en) 2020-11-04 2020-11-04 A task processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011219440.8A CN112416545B (en) 2020-11-04 2020-11-04 A task processing method and device

Publications (2)

Publication Number Publication Date
CN112416545A CN112416545A (en) 2021-02-26
CN112416545B true CN112416545B (en) 2024-11-08

Family

ID=74827962

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011219440.8A Active CN112416545B (en) 2020-11-04 2020-11-04 A task processing method and device

Country Status (1)

Country Link
CN (1) CN112416545B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020420B (en) * 2021-09-22 2024-08-06 成都鲁易科技有限公司 Distributed task to be executed execution method and system, storage medium and terminal

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109558237A (en) * 2017-09-27 2019-04-02 北京国双科技有限公司 A kind of task status management method and device

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8479203B2 (en) * 2009-07-24 2013-07-02 International Business Machines Corporation Reducing processing overhead and storage cost by batching task records and converting to audit records
CN104348578B (en) * 2013-08-02 2019-01-29 腾讯科技(深圳)有限公司 The method and device of data processing
CN104836717B (en) * 2014-02-10 2019-09-17 腾讯科技(深圳)有限公司 A kind of data processing method, device and terminal device
CN105446801A (en) * 2014-06-23 2016-03-30 阿里巴巴集团控股有限公司 Task processing method and device in distributed system
US9621650B2 (en) * 2014-09-30 2017-04-11 Google Inc Mobile application state identifier framework
CN112217831B (en) * 2017-09-18 2023-04-25 创新先进技术有限公司 Information interaction method, device and equipment for Internet of things equipment
CN110389815B (en) * 2018-04-18 2023-09-12 阿里巴巴集团控股有限公司 Task processing method, device and system
CN112703714B (en) * 2018-11-05 2023-05-05 深圳市欢太科技有限公司 Application processing method and device, computer equipment and computer readable storage medium
CN109766172B (en) * 2018-12-13 2024-05-14 中国平安财产保险股份有限公司 Asynchronous task scheduling method and device
CN110532077B (en) * 2019-08-22 2021-12-07 腾讯科技(深圳)有限公司 Task processing method and device and storage medium
CN111190710A (en) * 2019-11-25 2020-05-22 泰康保险集团股份有限公司 Method and device for assigning tasks

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109558237A (en) * 2017-09-27 2019-04-02 北京国双科技有限公司 A kind of task status management method and device

Also Published As

Publication number Publication date
CN112416545A (en) 2021-02-26

Similar Documents

Publication Publication Date Title
US10372469B2 (en) Method and device for displaying information
CN107888965B (en) Image gift display method and device, terminal, system and storage medium
CN110460664A (en) Information synchronization method and device, electronic equipment and storage medium
CN106897937B (en) Method and device for displaying social sharing information
JP2017524212A (en) Application installation package processing method, apparatus, program, and recording medium
CN105183513A (en) Application recommendation method and apparatus
US20220343056A1 (en) Method for loading image and electronic device
CN107094094B (en) Application networking method and device and terminal
CN110349578A (en) Equipment wakes up processing method and processing device
WO2020020048A1 (en) Method and apparatus for updating group member data, and terminal, system and storage medium
CN116048757A (en) Task processing method, device, electronic equipment and storage medium
CN107402767B (en) Method and apparatus for displaying push messages
CN108280342B (en) Application synchronization method and device for application synchronization
CN106817492A (en) The method and apparatus that red packet activity is reminded
CN111241134B (en) Data processing method and device
CN112416545B (en) A task processing method and device
CN113238881A (en) Page communication method and device
CN113535161B (en) User interface generation method and device
CN106447747B (en) Image processing method and device
CN109491655B (en) Input event processing method and device
CN111221862A (en) Request processing method and device
CN111695064A (en) Embedded point loading method and device
CN106775815B (en) Method and device for application data migration
CN113961839B (en) A method and device for obtaining time
CN112182027B (en) Information query method, device, electronic equipment and storage medium

Legal Events

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