Asynchronous task scheduling method, system and equipment and storage medium
By encapsulating asynchronous task requests as entity task objects, marking and clearing old tasks in the execution queue, and ensuring that new tasks exclusively occupy resources within a specified time, the conflict problem when recording tasks overlap is resolved, and the integrity and correctness of the recorded files are achieved.
Patent Information
- Application Number
- CN202510855901.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-10-10
AI Technical Summary
Traditional recording methods cannot effectively handle the residual operations of old recording tasks when new recording tasks are requested, resulting in an inability to handle recording conflicts in overlapping time periods when recording tasks are superimposed, generating duplicate or damaged recording files.
Encapsulate the asynchronous task request as an entity task object, query whether there is an executing task in the execution queue, mark it as invalid and clear the queue, retain temporary data, and after clearing the old task, mark the new task as valid and move it into the execution queue to ensure exclusive execution resources within the specified time.
Effectively handle time conflicts when multiple tasks are superimposed, ensure the integrity and correctness of recorded files, and avoid execution conflicts caused by invalid tasks occupying resources.
Smart Images

Figure CN120762838A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of video recording technology, and specifically relates to an asynchronous task scheduling method, system, device and storage medium. Background Art
[0002] With the advancement of medical technology and the popularization of digital medicine, the recording scenarios of medical videos such as surgical video recording and remote consultation image acquisition are increasing. They can not only provide intuitive video materials for medical teaching, but also help medical staff review problems in the operation process by reviewing the surgical video after surgery. In some remote consultations, they can also help doctors in other places to provide imaging surgery guidance.
[0003] At the same time, scenarios such as remote account opening face-to-face signing, high-risk transaction review video record in the field of financial technology, as well as remote nursing interaction and health management guidance in elderly care and health-related businesses have also generated a large number of video recording needs. By recording videos, relevant personnel after the service can review problems in the operation process through retrospective videos, thereby improving the quality of financial risk control and health care services.
[0004] Traditional recording methods in the industry have certain limitations when dealing with the complexity of the above scenarios. When a new recording task request arrives, there is no guarantee that the residual operations of the old recording task will be effectively discarded, nor can it ensure that the new recording task will be effectively executed within the specified time interval. As a result, when multiple recording tasks overlap, the recording conflicts in the overlapping time periods cannot be effectively handled, resulting in duplicate or incomplete recording files. Summary of the Invention
[0005] The present application provides an asynchronous task scheduling method, system, device and storage medium, which can promptly discard invalid execution tasks, ensure the accurate execution of current task requests, and avoid task execution conflicts caused by invalid tasks continuously occupying resources.
[0006] In order to solve the above technical problems, in a first aspect, the present application provides an asynchronous task scheduling method, comprising the following steps:
[0007] Receive at least one asynchronous task request to be executed;
[0008] Encapsulate the asynchronous task request to generate a corresponding entity task object;
[0009] Determine the task category of the entity task object, and query whether there is an executing task in the execution queue corresponding to the task category;
[0010] When there is an ongoing task, retain the temporary data generated during the execution of the ongoing task, mark the ongoing task in the task queue as invalid, and clear the execution queue;
[0011] The currently generated entity task object is marked as being in a valid state and then moved into the execution queue, and the entity task object marked as being in a valid state is executed.
[0012] As a further improvement of the present application, the step of encapsulating the asynchronous task request to generate a corresponding entity task object includes:
[0013] Obtaining task parameters of the asynchronous task request, and generating the entity task object including the task parameters;
[0014] The task parameters include at least the start time and end time of the asynchronous task request.
[0015] As a further improvement of the present application, marking the executing task in the task queue as an invalid state includes:
[0016] When there is an executing task in the execution queue corresponding to the task category, all executing tasks in the task queue are sequentially traversed and all executing tasks in the current task queue are marked as invalid; wherein the executing tasks include unexecuted tasks and the executing tasks;
[0017] The execution task marked as invalid is discarded.
[0018] As a further improvement of the present application, after marking the currently generated entity task object as valid and moving it into the execution queue, the method further includes:
[0019] Reset the execution end time of the current execution queue according to the start time and end time of the asynchronous task request.
[0020] As a further improvement of the present application, executing the entity task object marked as being in a valid state includes:
[0021] Executing the entity task object marked as valid in the execution queue, and determining in real time during the execution whether the current entity task object is in a valid state;
[0022] If so, based on the reset execution end time of the current execution queue, after the execution of the current entity task object is completed, the current entity task object is terminated;
[0023] If not, the current data generated during the execution of the current entity task object is retained, and the current entity task object is discarded.
[0024] As a further improvement of the present application, the step of ending the current entity task object includes:
[0025] The current data generated during the execution of the current entity task and the temporary data generated during the execution of the ongoing task are integrated and output.
[0026] As a further improvement of the present application, the task categories include at least one or more task categories among a recording task category, a collection task category and a computing task category.
[0027] In a second aspect, the present application provides an asynchronous task scheduling system, which includes:
[0028] A task receiving unit, configured to receive at least one asynchronous task request to be executed;
[0029] An encapsulation unit, configured to encapsulate the asynchronous task request to generate a corresponding entity task object;
[0030] A query unit, configured to determine a task category of the entity task object and query whether there is an executing task in the execution queue corresponding to the task category;
[0031] a marking unit configured to, when there is an ongoing task, retain temporary data generated during the execution of the ongoing task, mark the ongoing task in the task queue as invalid, and clear the execution queue;
[0032] The execution unit is used to mark the currently generated entity task object as valid and then move it into the execution queue, and execute the entity task object marked as valid.
[0033] In a third aspect, the present application provides a computer device comprising a processor and a memory coupled to the processor, wherein a computing program is stored in the memory. When the computer program is executed by the processor, the processor executes the steps of any one of the above-mentioned asynchronous task scheduling methods.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement any of the above-mentioned asynchronous task scheduling methods.
[0035] Compared with the prior art, the asynchronous task scheduling method, system, device and storage medium provided by the application encapsulate the asynchronous task request as an entity task object, realize standardized processing of the asynchronous task request, determine the task category of the current entity task object, and query whether there is an executing task in the corresponding execution queue. The executing task in the task category is detected in advance, when there is an executing task, the temporary data thereof is reserved to prevent loss, the executing task is marked as invalid and the queue is emptied, the residual operation of the old executing task is thoroughly cleaned up, the current entity task object is marked as an effective state and moved into the queue for execution, and the exclusive execution resource during execution is ensured. The time conflict problem caused by the superposition of multiple tasks is effectively handled, repeated or damaged video recording files are avoided, the integrity and correctness of the video recording file are ensured, the application can discard the invalid state task in time, ensure the accurate execution of the current task request, and avoid the task execution conflict caused by the continuous occupation of resources by invalid tasks. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0037] Figure 1 The flowchart of the asynchronous task scheduling method provided by the embodiment of the present application;
[0038] Figure 2 The structure diagram of the execution queue in the asynchronous task scheduling method provided by the embodiment of the present application;
[0039] Figure 3 The first embodiment diagram of the asynchronous task scheduling method provided by the embodiment of the present application;
[0040] Figure 4 The flowchart of the invalid state executing task discard processing in the asynchronous task scheduling method provided by the embodiment of the present application;
[0041] Figure 5 The flowchart of the end processing of the entity task object in the asynchronous task scheduling method provided by the embodiment of the present application;
[0042] Figure 6 The second embodiment diagram of the asynchronous task scheduling method provided by the embodiment of the present application;
[0043] Figure 7 The structure diagram of the asynchronous task scheduling system provided by the embodiment of the present application;
[0044] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;
[0045] Figure 9 A schematic diagram of the structure of the storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clearly understood, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present application and are not intended to limit the embodiments of the present application.
[0047] In the description of the embodiments of the present application, the meaning of "plurality" is at least two, for example, two, three, etc., unless otherwise clearly and specifically limited. In the embodiments of the present application, all directional indications (such as up, down, left, right, front, back...) are only used to explain the relative position relationship, movement, etc. between the components under a specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0048] To provide a more detailed and complete description of the present disclosure, the following provides illustrative descriptions of implementation methods and specific embodiments of the present disclosure; however, these descriptions are not intended to be the only way to implement or use the embodiments of the present disclosure. The implementation methods cover features of various specific embodiments, as well as the method steps and sequences for constructing and operating these specific embodiments. However, other specific embodiments may also be used to achieve the same or equivalent functionality and step sequences.
[0049] In the embodiments of this application, the terms "exemplary," "in some embodiments," and "in another embodiment" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner.
[0050] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0051] With the advancement of medical technology and the popularization of digital medicine, the recording scenarios of medical videos such as surgical video recording and remote consultation image acquisition are increasing. They can not only provide intuitive video materials for medical teaching, but also help medical staff to review problems in the operation process by reviewing the surgical video after surgery. In some remote consultations, they can also help doctors in other places to provide imaging surgery guidance, effectively improving the quality of medical diagnosis.
[0052] At the same time, scenarios such as remote account opening face-to-face signing, high-risk transaction review video record in the field of financial technology, as well as remote nursing interaction and health management guidance in elderly care and health-related businesses have also generated a large number of video recording needs. By recording videos, relevant personnel after the service can review problems in the operation process through retrospective videos, thereby improving the quality of financial risk control and health care services.
[0053] However, traditional recording methods in the industry have certain limitations when dealing with the various complex recording scenarios mentioned above. When a new recording task request arrives, it cannot guarantee that the residual operations of the old recording task are effectively discarded, nor can it ensure that the new recording task is effectively executed within the specified time interval. As a result, when multiple recording tasks overlap, the recording conflicts in the overlapping time periods cannot be effectively handled, resulting in duplicate or incomplete recording files.
[0054] In view of this, please refer to Figures 1-9 The embodiments of the present application provide an asynchronous task scheduling method, system, device and storage medium, which are applied to the field of video recording technology. They can promptly discard invalid tasks, ensure the accurate execution of current task requests, and avoid task execution conflicts caused by invalid tasks continuously occupying resources.
[0055] In the medical field, in order to deeply analyze the key links in the surgical process, optimize the surgical process, and improve the overall collaboration level of the medical team, relevant surgical videos are usually recorded to facilitate medical researchers to conduct subsequent review and teaching, thereby promoting the development of medical research; similarly, in the field of financial technology business, remote business account opening requires a dual recording mechanism of audio and video recording to ensure customer identity verification, avoid financial risks such as opening accounts on behalf of others and signing contracts in violation of regulations.
[0056] Next, we will use medical video recording and remote business account opening as examples to illustrate the asynchronous task scheduling method provided by this application. Please refer to Figure 1 , is a flow chart of the asynchronous task scheduling method provided in an embodiment of the present application, the detection method includes the following steps:
[0057] Step S1: receiving at least one asynchronous task request to be executed;
[0058] In the embodiment of the present application, a single or multiple asynchronous task requests may be received in parallel by a multi-source task processor to implement the reception of the asynchronous task request.
[0059] In the field of medical video recording, the asynchronous task request can be a single or multiple video recording requests; for example, please refer to Figure 3 , which is the first embodiment diagram of the asynchronous task scheduling method provided in the embodiment of the present application, a 5-minute recording request was initially scheduled during a certain surgical recording process. When the recording reached the 3rd minute, because the surgical operation steps that needed to be recorded in detail were about to appear, the remaining 2 minutes were not enough for a complete recording, and the critical stage of the operation would begin after 2 minutes. It was not convenient for the operator to re-initiate the recording request after 2 minutes, and there was no guarantee that some important pictures would be missed during the time gap of re-initiating the recording request. Therefore, the operator chose to initiate a recording request to extend the recording by 8 minutes at the current moment. At this time, the multi-source task processor received the asynchronous task request to adjust the recording time, and performed corresponding asynchronous task scheduling processing according to the asynchronous task request.
[0060] In an optional embodiment, the above-mentioned asynchronous task request can also be a dual recording request for remote business account opening in the financial technology field. For example, when a customer opens a remote business account, the system presets a 5-minute dual recording time according to the standardized process. The preset 5 minutes is sufficient to complete the conventional type of remote business account opening needs. After the ID card verification is completed in the 3rd minute of recording, since the remote business connected to the customer is a high-risk variety, it is necessary to add risk-specific notification links. At this time, the remaining 2 minutes are not enough to confirm the information with the customer item by item. At this time, if the recording is interrupted and restarted, the customer’s completed ID card verification video and the subsequent risk disclosure link will have a timestamp gap, which violates the China Securities Regulatory Commission’s compliance requirement that "the dual recording process shall not be edited or spliced". Therefore, the operator needs to promptly initiate an 8-minute extension recording request to generate a dual recording file with continuous duration and complete elements, and avoid the waste of resources caused by directly presetting 15 minutes.
[0061] Step S2: Encapsulate the asynchronous task request to generate a corresponding entity task object;
[0062] As an optional implementation, the above encapsulation of the asynchronous task request to generate a corresponding entity task object includes:
[0063] Obtaining task parameters of the asynchronous task request, and generating the entity task object including the task parameters;
[0064] The task parameters include at least the start time and end time of the asynchronous task request.
[0065] In an embodiment of the present application, after the multi-source task processor obtains an asynchronous task request, it will parse the task parameters contained in the asynchronous task request, such as parsing the start time startT, end time endT, duration loopT and corresponding task category of the asynchronous task request, and provide a time benchmark for subsequent task scheduling by obtaining the above task parameters.
[0066] Furthermore, the received asynchronous task request is standardized, and the above task parameters are encapsulated into an entity task object. The standard entity task object can be recognized by the system for subsequent scheduling processing.
[0067] In an optional embodiment, please continue to refer to Figure 3 Since a 5-minute recording request was initially scheduled during the surgical recording process or the dual-recording process of remote business account opening, the corresponding start time startT1 is 0 minutes, the end time endT1 is 5 minutes, and the duration loopT1 is 5 minutes; when the recording reaches the 3rd minute, the operator chooses to initiate a recording request to extend the recording by 8 minutes. At this time, the corresponding start time of the asynchronous task request is startT2, which is 3 minutes, the end time endT2 is 3+8=11 minutes, and the duration loopT2 is 8 minutes.
[0068] After receiving the asynchronous task request, the multi-source task processor parses the specific parameters of startT2, endT2 and loopT2, encapsulates "startT2, endT2 and loopT2" with the specific task category corresponding to the asynchronous task request, such as the recording task category, and generates the entity task object corresponding to the asynchronous task request.
[0069] Step S3: determining the task category of the entity task object, and querying whether there is an executing task in the execution queue corresponding to the task category;
[0070] As an optional implementation manner, the above-mentioned task categories include at least one or more task categories of a recording task category, a collection task category, and a computing task category.
[0071] In an embodiment of the present application, after the asynchronous task request is encapsulated to generate the corresponding entity task object, it is necessary to determine the task category corresponding to the entity task object. For example, the recording of medical videos belongs to the recording task category in the medical and health field, and the dual recording process of remote business account opening belongs to the recording task category in the financial technology business field.
[0072] It can be understood that each task category is provided with a corresponding execution queue, which can be provided with an execution-in-progress task belonging to the same task category as the current asynchronous task request, can be provided with no execution-in-progress task, or can be provided with not only an execution-in-progress task but also an unexecuted task, and the unexecuted task is executed in sequence after the execution-in-progress task ends.
[0073] In the embodiments provided above, when it is queried whether there is an execution-in-progress task in the execution queue corresponding to the task category, it is found that there is an original execution-in-progress recording task in the execution queue, that is, the start time startT1 is 0 minutes, the end time endT1 is 5 minutes, and the duration loopT1 is 5 minutes.
[0074] It should be noted that the original recording task is still in an execution state when the query is performed at the third minute, and does not have any effect on the recording data of the original recording task in the first 3 minutes. In actual applications, the task category corresponding to the entity task can also be a collection task category or a calculation task category, and is not limited to the above-mentioned several task categories. The specific task category form is not limited further in the present application.
[0075] Step S4: When there is an execution-in-progress task, temporary data generated in the execution process of the execution-in-progress task is retained, the execution-in-progress task in the task queue is marked as invalid, and the execution queue is emptied.
[0076] As an optional embodiment, please refer to Figure 4 The flowchart of the invalid execution task discarding process in the asynchronous task scheduling method provided in the embodiments of the present application is shown above, and the execution-in-progress task in the task queue is marked as invalid, which includes:
[0077] Step S40: When there is an execution-in-progress task in the execution queue corresponding to the task category, sequentially traverse all execution tasks of the task queue, and mark all execution tasks in the current task queue as invalid. The execution tasks include unexecuted tasks and execution-in-progress tasks.
[0078] Step S41: Discard the execution tasks marked as invalid.
[0079] In the embodiments of the present application, when the task category corresponding to the entity task object is queried and there is an execution-in-progress task in the execution queue corresponding to the task category, temporary data generated in the execution process of the execution-in-progress task needs to be saved first to ensure the integrity of data collection.
[0080] If temporary data is not retained, when all executing tasks are abandoned, the temporary data of the executed part, such as the medical video of the first 3 minutes of the surgery recording, or the identity verification video of the first 3 minutes of the recording, will be lost due to abandonment. When subsequent entity task objects are executed, they cannot be executed based on the previously recorded historical video, and the data integrity cannot be guaranteed.
[0081] Preferably, the present application first saves the temporary data generated during the execution of the task in progress, and then sequentially traverses all the execution tasks in the task queue to avoid the temporary data being immediately discarded due to being marked as invalid, thereby saving the residual data of the task in progress.
[0082] Please refer to Figure 2 , which is a structural diagram of the execution queue in the asynchronous task scheduling method provided in an embodiment of the present application. The execution task mentioned above may be an executing task that is already being executed, or it may be an unexecuted task waiting in the queue. It is necessary to mark all the executing tasks in the task queue as invalid to avoid marking only the executing tasks, and then executing the unexecuted tasks in the execution queue in sequence before executing the current entity task object.
[0083] Furthermore, after the temporary data is saved, all execution tasks in the execution queue will be traversed one by one in order, and each execution task in the task queue will be marked as invalid. After being marked as invalid, the corresponding execution task will no longer continue to be executed, but will be directly discarded to avoid execution conflicts caused by the execution tasks in the execution queue still occupying the recording data when the current entity task object is executed.
[0084] After marking all tasks in the task queue as invalid, the queue needs to be cleared. It's understandable that the queue typically processes tasks sequentially. If old tasks are not removed from the queue, the system may continue to process tasks marked as invalid in order, resulting in wasted resources and confusing execution logic.
[0085] This application preferably clears the execution queue to ensure that the current entity task object can be executed uniquely and immediately after the execution queue is cleared, eliminating resource occupation and time overlap conflicts caused by old execution tasks on the current entity task object.
[0086] In the above embodiment provided in the present application, it is found that there is an original recording task in the execution queue corresponding to the query task category, that is, a recording request with startT1 of 0 minutes, end time endT1 of 5 minutes, and duration loopT1 of 5 minutes. Since the operator chooses to initiate a recording request to extend the recording by 8 minutes when recording to the 3rd minute, the original recording task is an executing task and is in a valid state during the period of 0-3 minutes.
[0087] When recording reaches the third minute, the system receives a new recording request and detects that there is an original recording task being executed in the execution queue. Therefore, it will retain the temporary data recorded in the first three minutes, mark the original recording task as invalid and discard it, and clear the execution queue to avoid resource occupation caused by the original recording task, thus solving the problem of multi-task overlapping recording conflicts.
[0088] As an optional implementation, after marking the currently generated entity task object as valid and moving it into the execution queue, the method further includes:
[0089] Reset the execution end time of the current execution queue according to the start time and end time of the asynchronous task request.
[0090] In an embodiment of the present application, it is necessary to obtain the task parameters corresponding to the asynchronous task request, such as the start time and the end time, from the entity task object encapsulated in step S2, so as to obtain the execution time boundary of the current entity task object.
[0091] At the same time, the execution queue may still maintain the end time of the old execution task. For example, the end time of the execution queue may still be endT1, which is 5 minutes. Through this step, the execution end time of the execution queue can be updated from 5 minutes of endT1 to 11 minutes of endT2, ensuring that the execution time boundary of the execution queue is synchronized with the current entity task object.
[0092] If the execution end time of the execution queue is not reset, the system may automatically terminate the current entity task object in the execution queue at 5 minutes, resulting in actual recording of only 5 minutes instead of the expected 11 minutes, resulting in incomplete recorded video; this application can ensure that the execution time boundary of the execution queue is synchronized with the time parameters of the current entity task object by resetting the execution end time of the execution queue, solving the problem of the new task being unable to be effectively executed within the specified time interval, and ensuring the time integrity of the recorded video.
[0093] Step S5: Mark the currently generated entity task object as valid and move it into the execution queue, and execute the entity task object marked as valid.
[0094] As an optional implementation, please refer to Figure 5 , which is a flowchart of the end processing of the entity task object in the asynchronous task scheduling method provided in an embodiment of the present application, wherein the execution of the entity task object marked as valid includes:
[0095] Step S50: executing the entity task object marked as valid in the execution queue, and determining in real time whether the current entity task object is valid during the execution process;
[0096] Step S51: If yes, based on the reset execution end time of the current execution queue, after the execution of the current entity task object is completed, end processing is performed on the current entity task object;
[0097] If not, the current data generated during the execution of the current entity task object is retained, and the current entity task object is discarded.
[0098] As an optional implementation manner, the ending processing of the current entity task object includes:
[0099] Step S52: Integrate the current data generated during the execution of the current physical task and the temporary data generated during the execution of the ongoing task and output them.
[0100] In an embodiment of the present application, after the execution queue is cleared, the current entity task object needs to be marked as valid, the current entity task object needs to be moved into the execution queue of the corresponding task category, and the reset execution end time is used as the new time base for execution to avoid the recording task from ending early or late.
[0101] Furthermore, during the execution of the current entity task object, it is necessary to determine in real time whether the current entity task is still in a valid state to avoid new asynchronous task requests from occurring during the execution process.
[0102] If a new asynchronous task request is received during the execution process, the system will retain the current data generated by the current entity task object, mark the current entity task object as invalid and discard it through steps S2-S4, and clear the execution queue corresponding to the current entity task object to avoid resource waste caused by the complete execution of the current entity task object.
[0103] If during the execution process, the current entity task object has been in a valid state, that is, the system has not received a new asynchronous task request, then based on the reset execution end time, the time after the entity task object is fully executed is set as the reset execution end time, and then the current data generated during the execution of the current entity task object and the temporary data generated during the execution of the executing task are integrated and output, thereby outputting the completed data file.
[0104] It can be understood that the size of the serial numbers of the steps in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0105] In one embodiment provided in the present application, if the current entity task object is always in a valid state within the time range of 3 minutes to 11 minutes, the recorded video of 3 minutes to 11 minutes will be integrated with the recorded video of 0 minutes to 3 minutes generated by the old executing task, thereby generating a complete recorded video of 0 minutes to 11 minutes, meeting the needs of continuous recording in medical scenarios, financial technology scenarios, or medical, health and elderly care business scenarios.
[0106] Of course, it is also possible that the current entity task object receives a new asynchronous task request within the time range of 3 minutes to 11 minutes. For example, 5 minutes after the current entity task object is executed, the system receives a request to extend the recording by 10 minutes.
[0107] For details, please refer to Figure 6 , which is a second embodiment diagram of the asynchronous task scheduling method provided in an embodiment of the present application, assuming that the task request for the first recording of a certain video is a recording request with startT1 of 0 minutes, end time endT1 of 5 minutes, and duration loopT1 of 5 minutes. 3 minutes after the first recording task, a second task request is received requesting to extend the recording by 8 minutes. At this time, startT2 is 3 minutes, end time endT2 is 11 minutes, and duration loopT2 is 8 minutes. 5 minutes after the second recording task request, a third task request is received requesting to extend the recording by 10 minutes. At this time, startT3 is 8 minutes, end time endT3 is 18 minutes, and duration loopT3 is 10 minutes.
[0108] After 3 minutes of the first recording, the system receives the second task request, and saves the video file of the first recording from 0 minutes to 3 minutes, marks the first task request as invalid and discards it, clears the execution queue, marks the second task request as valid, and moves it into the execution queue for execution. After 5 minutes of the second recording, the system receives the third task request, saves the video file of the second recording from 3 minutes to 8 minutes, marks the second task request as invalid and discards it, clears the execution queue, marks the third task request as valid, and moves it into the execution queue for execution. Assuming that no new task request appears during the execution of the third task request, the video files of 0 minutes to 3 minutes, 3 minutes to 8 minutes, and 8 minutes to 18 minutes will be integrated and output after the recording is completed to ensure that the key links in the operation process are fully recorded.
[0109] It can be understood that the above-mentioned asynchronous task request can be a recording request for medical videos in the medical field, a dual recording request in remote business account opening in the financial technology field, an underwriting video recording request in the medical, health and elderly care business field, or a task scheduling processing request in Internet services. The above-mentioned embodiments are only explanations of this application using medical scenarios and financial scenarios as examples, and do not constitute any limitations on actual application fields and application scenarios. Those skilled in the art should be aware of this.
[0110] It should be noted that the task categories provided above can be, for example, recording task categories for video recording, resource scheduling categories for storage allocation, computing task categories for image calculation, or collection task categories for data collection. This application also does not impose too many restrictions on the specific forms of task categories.
[0111] The asynchronous task scheduling method provided by the present application receives asynchronous task requests to be executed, encapsulates the asynchronous task requests into entity task objects, implements standardized processing of asynchronous task requests, determines the task category of the current entity task object, and queries whether there are any executing tasks in the corresponding execution queue, detects the executing tasks in the task category in advance, and when there are executing tasks, retains their temporary data to prevent loss, marks the executing tasks as invalid and clears the queue, thoroughly cleans up the remaining residual operations of the old executing tasks, marks the current entity task object as valid and moves it into the queue for execution, ensures that it has exclusive execution resources during the execution period, effectively handles the time conflict problem caused by the superposition of multiple tasks, avoids the generation of duplicate or damaged video recording files, and ensures the integrity and correctness of the video recording files. The present application can promptly discard invalid tasks, ensure the accurate execution of the current task request, and avoid task execution conflicts caused by the continuous occupation of resources by invalid tasks.
[0112] Based on the above asynchronous task scheduling method, this application provides an asynchronous task scheduling system, please refer to Figure 7 , is a schematic diagram of the structure of an asynchronous task scheduling system provided in an embodiment of the present application, wherein the asynchronous task scheduling system includes a task receiving unit, configured to receive at least one asynchronous task request to be executed;
[0113] An encapsulation unit, configured to encapsulate the asynchronous task request to generate a corresponding entity task object;
[0114] A query unit, configured to determine a task category of the entity task object and query whether there is an executing task in the execution queue corresponding to the task category;
[0115] a marking unit configured to, when there is an ongoing task, retain temporary data generated during the execution of the ongoing task, mark the ongoing task in the task queue as invalid, and clear the execution queue;
[0116] The execution unit is used to mark the currently generated entity task object as valid and then move it into the execution queue, and execute the entity task object marked as valid.
[0117] As an optional implementation, the above encapsulation of the asynchronous task request to generate a corresponding entity task object includes:
[0118] Obtaining task parameters of the asynchronous task request, and generating the entity task object including the task parameters;
[0119] The task parameters include at least the start time and end time of the asynchronous task request.
[0120] As an optional implementation manner, marking the executing task in the task queue as invalid includes:
[0121] When there is an executing task in the execution queue corresponding to the task category, all executing tasks in the task queue are sequentially traversed and all executing tasks in the current task queue are marked as invalid; wherein the executing tasks include unexecuted tasks and the executing tasks;
[0122] The execution task marked as invalid is discarded.
[0123] As an optional implementation, after marking the currently generated entity task object as valid and moving it into the execution queue, the method further includes:
[0124] Reset the execution end time of the current execution queue according to the start time and end time of the asynchronous task request.
[0125] As an optional implementation, the execution of the entity task object marked as the valid state includes:
[0126] The execution of the entity task object marked as the valid state in the execution queue is executed, and whether the current entity task object is in the valid state is determined in real time during the execution;
[0127] If yes, based on the execution end time of the current execution queue after the reset, the current entity task object is processed after the current entity task object is executed;
[0128] If no, the current data generated in the execution process of the current entity task object is retained, and the current entity task object is discarded.
[0129] As an optional implementation, the processing of the current entity task object includes:
[0130] The current data generated in the execution process of the current entity task object and the temporary data generated in the execution process of the execution task are integrated and output.
[0131] As an optional implementation, the task category includes at least one or more of a recording task category, a collection task category, and a calculation task category.
[0132] For other details of the technical solutions of the units in the asynchronous task scheduling system provided in the above embodiments, refer to the description in the asynchronous task scheduling method in the above embodiments, which will not be repeated here.
[0133] It should be noted that each of the embodiments in the specification adopts a progressive manner for description, and each embodiment focuses on the difference from other embodiments. The same and similar parts of each embodiment can be referred to each other. For system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.
[0134] Please refer to Figure 8 The computer device 80 provided in the embodiment of the present application includes a processor 81 and a memory 82 coupled with the processor 81.
[0135] The memory 82 stores a computing program, and the computer program is executed by the processor 81, so that the processor 81 executes the steps of the asynchronous task scheduling method in the above embodiment.
[0136] The processor 81 may also be referred to as a CPU (Central Processing Unit). The processor 81 may be an integrated circuit chip having signal processing capabilities. The processor 81 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor may be a microprocessor or any conventional processor.
[0137] Please refer to Figure 9 , a structural diagram of the storage medium provided in an embodiment of the present application, the computer-readable storage medium of the embodiment of the present application stores a computer program 90, and the computer program 90 is executed by the processor 81 to implement the artificial intelligence-based actuarial classification method in the above embodiment, wherein the computer program 90 can be stored in the above storage medium in the form of a software product, including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or a computer device such as a computer, a server, a mobile phone, or a tablet. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDNs), and big data and artificial intelligence platforms.
[0138] In the several embodiments provided in this application, it should be understood that the disclosed terminals, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0139] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. The above is only an implementation method of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
[0140] The above embodiments are merely exemplary embodiments for illustrating the principles of the embodiments of the present application, but the embodiments of the present application are not limited thereto. Those skilled in the art may make various modifications and improvements without departing from the spirit and essence of the embodiments of the present application, and such modifications and improvements are also considered to be within the scope of protection of the embodiments of the present application.
Claims
1. An asynchronous task scheduling method, characterized in that: The following steps are involved: Receive at least one asynchronous task request to be executed; Encapsulate the asynchronous task request to generate a corresponding entity task object; Determine the task category of the entity task object, and query whether there is an executing task in the execution queue corresponding to the task category; When there is an ongoing task, retain the temporary data generated during the execution of the ongoing task, mark the ongoing task in the task queue as invalid, and clear the execution queue; The currently generated entity task object is marked as being in a valid state and then moved into the execution queue, and the entity task object marked as being in a valid state is executed.
2. The asynchronous task scheduling method according to claim 1, wherein: The step of encapsulating the asynchronous task request to generate a corresponding entity task object includes: Obtaining task parameters of the asynchronous task request, and generating the entity task object including the task parameters; The task parameters include at least the start time and end time of the asynchronous task request.
3. The asynchronous task scheduling method according to claim 1, wherein: The step of marking the executing task in the task queue as an invalid state includes: When there is an executing task in the execution queue corresponding to the task category, all executing tasks in the task queue are sequentially traversed and all executing tasks in the current task queue are marked as invalid; wherein the executing tasks include unexecuted tasks and the executing tasks; The execution task marked as invalid is discarded.
4. The asynchronous task scheduling method according to claim 2, wherein: After marking the currently generated entity task object as valid and moving it into the execution queue, the method further includes: Reset the execution end time of the current execution queue according to the start time and end time of the asynchronous task request.
5. The asynchronous task scheduling method according to claim 4, wherein: The executing the entity task object marked as being in a valid state includes: Executing the entity task object marked as valid in the execution queue, and determining in real time during the execution whether the current entity task object is in a valid state; If so, based on the reset execution end time of the current execution queue, after the execution of the current entity task object is completed, the current entity task object is terminated; If not, the current data generated during the execution of the current entity task object is retained, and the current entity task object is discarded.
6. The asynchronous task scheduling method according to claim 5, wherein: The step of ending the current entity task object includes: The current data generated during the execution of the current entity task and the temporary data generated during the execution of the ongoing task are integrated and output.
7. The asynchronous task scheduling method according to claim 1, wherein: The task categories include at least one or more task categories among a recording task category, a collection task category, and a computing task category.
8. An asynchronous task scheduling system, characterized in that: include: A task receiving unit, configured to receive at least one asynchronous task request to be executed; An encapsulation unit, configured to encapsulate the asynchronous task request to generate a corresponding entity task object; A query unit, configured to determine a task category of the entity task object and query whether there is an executing task in the execution queue corresponding to the task category; a marking unit configured to, when there is an ongoing task, retain temporary data generated during the execution of the ongoing task, mark the ongoing task in the task queue as invalid, and clear the execution queue; The execution unit is used to mark the currently generated entity task object as valid and then move it into the execution queue, and execute the entity task object marked as valid.
9. A computer device, characterized in that: The computer device includes a processor and a memory coupled to the processor, wherein a computing program is stored in the memory. When the computer program is executed by the processor, the processor executes the steps of the asynchronous task scheduling method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the asynchronous task scheduling method according to any one of claims 1 to 7.