CN115543565A - Task processing method and device, computer equipment and storage medium - Google Patents

Task processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115543565A
CN115543565A CN202211160222.0A CN202211160222A CN115543565A CN 115543565 A CN115543565 A CN 115543565A CN 202211160222 A CN202211160222 A CN 202211160222A CN 115543565 A CN115543565 A CN 115543565A
Authority
CN
China
Prior art keywords
task
processing
retry
processed
tasks
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.)
Pending
Application number
CN202211160222.0A
Other languages
Chinese (zh)
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.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202211160222.0A priority Critical patent/CN115543565A/en
Publication of CN115543565A publication Critical patent/CN115543565A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • 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 embodiment of the application belongs to the field of big data, and relates to a task processing method, which comprises the following steps: acquiring a preset number of tasks to be processed; calling a preset task frame to perform execution processing on all the tasks to be processed to obtain an execution result of each task to be processed; judging whether a target execution result with execution failure exists in all the execution results; if yes, screening out a first task corresponding to the target execution result from all the tasks to be processed; acquiring a processing strategy which is pre-configured in a configuration file of the task framework and corresponds to a failed task; and performing corresponding retry processing on the first task based on the processing strategy. The application also provides a task processing device, computer equipment and a storage medium. Further, the present application relates to a blockchain technique, where the first task may be stored in a blockchain. The method and the device can quickly retry the task which fails to be executed, and realize real-time monitoring and task retry of the execution result of the task.

Description

Task processing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of big data technologies, and in particular, to a task processing method and apparatus, a computer device, and a storage medium.
Background
In a project developed in a front-end for a transaction system or an e-commerce system, it is often encountered that certain tasks, such as timing statistics, updating data, checking data, etc., need to be performed regularly.
Usually, the timed task is maintained by creating a thread pool in the project, but there are many problems with this approach. For example, since the execution result of the task is not monitored, timely task retry compensation cannot be performed. At present, some open-source task scheduling tools exist in the market, but the task scheduling tools are also very invasive to business, and have no monitoring mechanism for the execution result of the task, so that the task can not be retried. Therefore, the prior art has not provided an effective solution to the problem that the execution result of the task cannot be monitored and the task retry cannot be realized.
Disclosure of Invention
An embodiment of the present application aims to provide a task processing method, a task processing device, a computer device, and a storage medium, so as to solve the technical problems that in the prior art, the execution result of a task cannot be monitored and task retry cannot be achieved, and an effective solution is not provided yet.
In order to solve the foregoing technical problem, an embodiment of the present application provides a task processing method, which adopts the following technical solutions:
acquiring a preset number of tasks to be processed;
calling a preset task frame to perform execution processing on all the tasks to be processed to obtain an execution result of each task to be processed;
judging whether a target execution result with execution failure exists in all the execution results;
if yes, screening out a first task corresponding to the target execution result from all the tasks to be processed;
acquiring a processing strategy which is pre-configured in a configuration file of the task framework and corresponds to a failed task;
and performing corresponding retry processing on the first task based on the processing strategy.
Further, the step of performing a corresponding retry process on the first task based on the processing policy specifically includes:
obtaining the retry times and retry intervals corresponding to the failed tasks from the processing strategy;
re-executing the first task by using the task frame according to the retry times and the retry intervals to obtain a corresponding first retry result;
judging whether all the first retry results are execution failures or not;
if so, stopping re-executing the first task;
and generating a task failure record corresponding to the first task.
Further, before the step of stopping the re-execution of the processing result on the first task, the method further includes:
acquiring initial timeout time of the first task;
adjusting the initial timeout time based on the retry times to obtain a target timeout time;
calling a specified task frame; the specified task frame and the task frame are different frames;
based on the target overtime, the first task is re-executed within the target overtime through the specified task frame, and a corresponding second retry result is obtained;
and if the second retry result is that the execution fails, marking the first task as an abnormal task with failed execution.
Further, the step of adjusting the initial timeout period based on the retry number to obtain a target timeout period specifically includes:
acquiring a preset weight coefficient;
calculating the product of the weight coefficient and the retry times to obtain a first numerical value;
calculating the sum of the designated numerical value and the initial timeout time to obtain a second numerical value;
taking the second value as the target timeout time.
Further, after the step of generating the task failure record corresponding to the first task, the method further includes:
acquiring contact information of a designated user;
acquiring task identification information of the first task;
and sending the task failure record and the task identification information to a target terminal corresponding to the contact information so as to carry out alarm reminding on the target user.
Further, before the step of calling a preset task frame to execute all the tasks to be processed to obtain the execution result of each task to be processed, the method further includes:
judging whether a processing strategy generation request corresponding to a failed task and input by a target user is received or not;
if so, responding to the processing strategy generation request and displaying a preset configuration interface;
receiving configuration parameters corresponding to the failed task, which are input by the target user on the configuration interface;
generating a processing strategy corresponding to the failed task based on the configuration parameters;
calling a preset task scheduling tool to build an initial task frame;
and inputting the processing strategy into a configuration file of the initial task frame to obtain the task frame.
Further, after the step of screening out the first task corresponding to the target execution result from all the tasks to be processed, the method further includes:
screening out second tasks except the first task from all the tasks to be processed;
storing the second task into a preset successful task table;
and storing the first task into a preset failure task table.
In order to solve the above technical problem, an embodiment of the present application further provides a task processing device, which adopts the following technical solutions:
the first acquisition module is used for acquiring a preset number of tasks to be processed;
the first processing module is used for calling a preset task frame to execute all the tasks to be processed to obtain the execution result of each task to be processed;
the first judgment module is used for judging whether a target execution result with execution failure exists in all the execution results;
the first screening module is used for screening out a first task corresponding to the target execution result from all the tasks to be processed if the first task is the first task;
the second acquisition module is used for acquiring a processing strategy which is pre-configured in a configuration file of the task framework and corresponds to the failed task;
and the second processing module is used for carrying out corresponding retry processing on the first task based on the processing strategy.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
acquiring a preset number of tasks to be processed;
calling a preset task frame to perform execution processing on all the tasks to be processed to obtain an execution result of each task to be processed;
judging whether a target execution result with execution failure exists in all the execution results;
if yes, screening out a first task corresponding to the target execution result from all the tasks to be processed;
acquiring a processing strategy which is pre-configured in a configuration file of the task framework and corresponds to a failed task;
and performing corresponding retry processing on the first task based on the processing strategy.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
acquiring a preset number of tasks to be processed;
calling a preset task frame to perform execution processing on all the tasks to be processed to obtain an execution result of each task to be processed;
judging whether a target execution result with execution failure exists in all the execution results;
if yes, screening out a first task corresponding to the target execution result from all the tasks to be processed;
acquiring a processing strategy which is pre-configured in a configuration file of the task framework and corresponds to a failed task;
and performing corresponding retry processing on the first task based on the processing strategy.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
according to the method and the device, after a preset number of tasks to be processed are obtained, a preset task frame is called to execute all the tasks to be processed to obtain execution results of all the tasks to be processed, whether target execution results with execution failure exist in all the execution results is judged, if yes, a first task corresponding to the target execution results is screened out from all the tasks to be processed, a processing strategy corresponding to the failed task and configured in a configuration file of the task frame in advance is obtained subsequently, and finally corresponding retry processing is carried out on the first task based on the processing strategy. According to the embodiment of the application, the task frame and the pre-configured processing strategy corresponding to the failed task are used, so that the corresponding retry processing can be rapidly and conveniently carried out on the task with execution failure in the tasks to be processed, and the real-time monitoring and task retry on the execution result of the task are effectively realized.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a task processing method according to the present application;
FIG. 3 is a schematic block diagram of one embodiment of a task processing device according to the present application;
FIG. 4 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the task processing method provided in the embodiments of the present application is generally executed by a server/terminal device, and accordingly, the task processing apparatus is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for an implementation.
With continuing reference to FIG. 2, a flowchart of one embodiment of a task processing method according to the present application is shown. The task processing method comprises the following steps:
step S201, a preset number of to-be-processed tasks are acquired.
In this embodiment, the electronic device (for example, the server/terminal device shown in fig. 1) on which the task processing method operates may obtain the task to be processed through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G/5G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, an UWB (ultra wideband) connection, and other wireless connection means now known or developed in the future. The preset number can be determined by querying a configuration file of the task framework, and the value of the preset number is not limited. In addition, the task to be processed may be an asynchronous task.
Step S202, a preset task frame is called to perform execution processing on all the to-be-processed tasks, so as to obtain an execution result of each to-be-processed task.
In this embodiment, the task framework may include an MQ message platform, a DSE remote scheduling platform, and the like.
Step S203, determining whether there is a target execution result with execution failure in all the execution results.
In this embodiment, the execution result may include an execution failure or an execution success.
And S204, if yes, screening out a first task corresponding to the target execution result from all the tasks to be processed.
In this embodiment, the first task corresponds to all tasks that fail to be executed in the pending task.
Step S205, acquiring a processing policy corresponding to the failed task, which is configured in advance in the configuration file of the task framework.
In this embodiment, the processing policy corresponding to the failed task may be a task retry policy that is pre-defined by the target user according to the actual service usage requirement and is input into the configuration file of the task framework.
And step S206, performing corresponding retry processing on the first task based on the processing strategy.
In this embodiment, the above-mentioned specific implementation process of performing the retry processing on the first task based on the processing policy is further described in detail in the following specific embodiments, and will not be described in detail herein.
After the preset number of tasks to be processed is obtained, the preset task frame is called to execute all the tasks to be processed to obtain the execution result of each task to be processed, whether the target execution result of execution failure exists in all the execution results is judged, if yes, a first task corresponding to the target execution result is screened out from all the tasks to be processed, a processing strategy which is configured in advance in a configuration file of the task frame and corresponds to the failed task is obtained subsequently, and finally corresponding retry processing is carried out on the first task based on the processing strategy. According to the task retry method and the task retry device, the task frame and the processing strategy which is configured in advance and corresponds to the failed task are used, so that the task which is to be processed and fails to be executed can be quickly and conveniently retried, and the real-time monitoring and the task retry of the execution result of the task are effectively realized.
In some optional implementations, step S206 includes the following steps:
and acquiring the retry times and the retry intervals corresponding to the failed tasks from the processing strategy.
In this embodiment, the processing strategies at least include: the number of the tasks to be processed in each grabbing process, the scheduling frequency of the tasks, the retry times, the retry interval and the like.
And re-executing the first task by using the task frame according to the retry times and the retry intervals to obtain a corresponding first retry result.
And judging whether all the first retry results are execution failures.
In this embodiment, the first retry result may include a success or a failure of the execution.
And if so, stopping the re-execution processing of the first task.
In this embodiment, if the task frame is used to perform re-execution processing on the first task according to the retry number and the retry interval, and the obtained corresponding first retry results are all execution failures, task retry is not performed on the first task any more, so that processing intelligence of task retry is improved, and processing cost of task retry is reduced.
And generating a task failure record corresponding to the first task.
In this embodiment, task identification information of the first task, such as a task name or a task ID, may be input into a preset recording template to generate the task failure record. The recording template can be generated by writing according to actual service requirements.
According to the method and the device, after the preset task frame is called to execute all the tasks to be processed and the execution results of all the tasks to be processed are obtained, if the first task which fails to execute exists in the tasks to be processed, the processing strategy which is configured in advance in the configuration file of the task frame and corresponds to the failed task can be obtained intelligently, so that the first task can be retried correspondingly, and the processing intelligence of task retry is improved. In addition, the condition that the task retry fails due to the task framework is effectively avoided, and the accuracy of the generated retry result of the first task is improved. In addition, when it is detected that the first retry results obtained after the re-execution of the first task by using the task framework according to the retry times and the retry intervals are all execution failures, the task retry is not executed on the first task any more subsequently, and the processing cost of the task retry is reduced.
In some optional implementation manners of this embodiment, before the step of stopping the re-executing of the processing result on the first task, the electronic device may further perform the following steps:
and acquiring the initial timeout time of the first task.
In this embodiment, each task has a timeout period corresponding to the task itself, and the first task corresponds to a first initial timeout period, which represents a period from the initial processing to the end of the processing of the task.
And adjusting the initial timeout time based on the retry times to obtain a target timeout time.
In this embodiment, the specific implementation process of adjusting the initial timeout period based on the retry number to obtain the target timeout period is described in further detail in the following specific embodiments, and will not be elaborated herein.
Calling a specified task frame; wherein the specified task frame and the task frame are different frames.
And based on the target overtime, re-executing the first task within the target overtime through the specified task frame to obtain a corresponding second retry result.
In this embodiment, the task execution process for re-executing the first task within the target timeout period through the specified task frame is the same as the task execution process for executing the to-be-processed task by calling the task frame, and will not be described herein.
And if the second retry result is that the execution fails, marking the first task as an abnormal task with failed execution.
In this embodiment, the first task may be word marked or color marked to identify the first task as an abnormal task that failed to execute.
When detecting that the first retry results obtained after the task frame is used for re-executing the first task according to the retry times and the retry intervals are all execution failures, the method further adjusts the initial timeout time based on the retry times, calls the specified task frame different from the task frame to re-execute the first task within the target timeout time, and finally determines whether the first task belongs to the abnormal task with execution failures or not based on the obtained second retry results. In addition, if the second retry based on the specified task frame also fails, the task retry can not be executed on the first task, so that the processing intelligence of the task retry is improved, and the processing cost of the task retry is reduced.
In some optional implementations, the adjusting the initial timeout time based on the retry number to obtain the target timeout time includes:
and acquiring a preset weight coefficient.
In this embodiment, the value of the weight coefficient is not particularly limited, and may be set according to actual use requirements, for example, may be set to 0.8.
And calculating the product of the weight coefficient and the retry times to obtain a first value.
And calculating the sum of the designated value and the initial timeout time to obtain a second value.
Taking the second value as the target timeout time.
In this embodiment, the obtained target timeout time is a time greater than the initial timeout time of the first task. After the execution of the processing by the first task fails, the timeout time of the first task is increased by using the target timeout time, and further retry processing is performed on the first task based on the target timeout time. The timeout time of the first task is increased, so that the first task can obtain more processed time and retry processing opportunities, namely, the processing success rate of the first task can be increased.
According to the method and the device, the first numerical value is obtained by obtaining the preset weight coefficient and then calculating the product of the weight coefficient and the retry times, the sum of the appointed numerical value and the initial overtime is calculated and used as the target overtime, the subsequent use of the target overtime is facilitated to increase the overtime of the first task, and further retry processing is carried out on the first task based on the target overtime. The overtime time of the first task can be increased to obtain more processed time and retry processing opportunities, so that the processing success rate of the first task is increased, and the processing intelligence of task retry is improved.
In some optional implementations, after the step of generating the task failure record corresponding to the first task, the electronic device may further perform the following steps:
contact information of a specified user is obtained.
In this embodiment, the contact information may include a telephone number or mail information.
And acquiring task identification information of the first task.
In this embodiment, the task identification information may be name information or task ID information of the task.
And sending the task failure record and the task identification information to a target terminal corresponding to the contact information so as to carry out alarm reminding on the target user.
After the first task is subjected to the corresponding retry processing based on the processing strategy corresponding to the failed task, if the obtained retry result is that the execution fails, the task identification information of the first task is acquired subsequently, and the task failure record and the task identification information are sent to the target terminal corresponding to the contact information to give an alarm to the target user for reminding, so that the target user can perform corresponding processing measures on the first task subjected to the execution failure according to the received task failure record, and the use experience of the target user is improved.
In some optional implementation manners of this embodiment, before step S202, the electronic device may further perform the following steps:
and judging whether a processing strategy generation request corresponding to the failed task and input by a target user is received.
In this embodiment, the target user may be a business person related to task processing management. The processing strategy generation request is a request triggered by a target user and used for generating a retry processing strategy corresponding to the task to be processed.
And if so, responding to the processing strategy generation request and displaying a preset configuration interface.
In this embodiment, the configuration page is a data configuration interface for generating configuration parameters required for a retry processing policy corresponding to a failed task. Wherein, the configuration parameters may include: the method comprises the steps of grabbing the number of tasks to be processed each time, the size of task scheduling frequency, retry times, retry intervals and the like.
And receiving the configuration parameters corresponding to the failed task, which are input by the target user on the configuration interface.
In this embodiment, taking the asynchronous task of configuring the insurance underwriting automatically as an example, the configuration parameters input by the target user may include: the task scheduling frequency is once every 20 seconds, the number of the tasks to be processed captured in each batch is 200, the retry number is 3, and the retry interval is 5 seconds.
And generating a processing strategy corresponding to the failed task based on the configuration parameters.
In this embodiment, the configuration parameters may be correspondingly filled into a preset policy template to obtain the processing policy corresponding to the failed task. The strategy template comprises fields corresponding to the configuration parameters and positions to be filled corresponding to the fields.
And calling a preset task scheduling tool to build an initial task framework.
In this embodiment, the task scheduling tool may include a Quartz or other existing open source asynchronous task scheduling tool, and the initial task framework may include an MQ message platform, a DSE remote scheduling platform, and the like.
And inputting the processing strategy into a configuration file of the initial task frame to obtain the task frame.
When a processing strategy generation request corresponding to a failed task and input by a target user is received, a corresponding processing strategy is generated based on configuration parameters corresponding to the failed task and input by the target user on a configuration interface, and then the processing strategy is input into a configuration file of a pre-constructed initial task frame, so that a task frame is generated quickly, execution processing can be performed on all tasks to be processed based on the generated task frame, execution results of all tasks to be processed are obtained, and generation efficiency of the execution results is guaranteed.
In some optional implementation manners of this embodiment, after step S204, the electronic device may further perform the following steps:
and screening out second tasks except the first task from all the tasks to be processed.
In this embodiment, the second task refers to all tasks that are executed successfully as a result of execution among all tasks to be processed.
And storing the second task into a preset successful task table.
In this embodiment, the successful task table is created in advance to store all tasks whose execution results are successful in execution among the tasks to be processed.
And storing the first task into a preset failure task table.
In this embodiment, the failed task table is created in advance to store all tasks whose execution results are execution failures in the tasks to be processed.
According to the method and the device, after the preset task frame is called to execute all the tasks to be processed and the execution results of all the tasks to be processed are obtained, the tasks which are successfully executed and the tasks which are failed to execute in the tasks to be processed can be intelligently and correspondingly stored in the successful task table and the failed task table respectively, so that the tasks with different execution results can be distinguished and stored, and the required tasks can be conveniently and quickly inquired from the task table in the follow-up process.
It is emphasized that, to further ensure the privacy and security of the first task, the first task may also be stored in a node of a blockchain.
The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application can acquire and process related data based on an artificial intelligence technology. Among them, artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence base technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the processes of the embodiments of the methods described above can be included. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of execution is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a task processing apparatus, which corresponds to the embodiment of the method shown in fig. 2, and which can be applied in various electronic devices.
As shown in fig. 3, the task processing device 300 according to the present embodiment includes: a first obtaining module 301, a first processing module 302, a first judging module 303, a first screening module 304, a second obtaining module 305, and a second processing module 306. Wherein:
a first obtaining module 301, configured to obtain a preset number of to-be-processed tasks;
the first processing module 302 is configured to invoke a preset task frame to perform execution processing on all the to-be-processed tasks, so as to obtain an execution result of each to-be-processed task;
a first determining module 303, configured to determine whether a target execution result of execution failure exists in all the execution results;
a first screening module 304, configured to screen out, if yes, a first task corresponding to the target execution result from all the to-be-processed tasks;
a second obtaining module 305, configured to obtain a processing policy corresponding to a failed task, where the processing policy is pre-configured in a configuration file of the task framework;
a second processing module 306, configured to perform a corresponding retry process on the first task based on the processing policy.
In this embodiment, the operations that the modules or units are respectively configured to execute correspond to the steps of the task processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the second processing module 306 includes:
the first obtaining submodule is used for obtaining the retry times and the retry intervals corresponding to the failed tasks from the processing strategies;
the first processing submodule is used for re-executing the first task by using the task frame according to the retry times and the retry intervals to obtain a corresponding first retry result;
the first judgment submodule is used for judging whether all the first retry results are execution failures or not;
the second processing submodule is used for stopping re-executing the first task if the first task is executed again;
and the generation submodule is used for generating a task failure record corresponding to the first task.
In this embodiment, the operations that the modules or units are respectively configured to execute correspond to the steps of the task processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the second processing module 306 includes:
the second acquisition submodule is used for acquiring the initial timeout time of the first task;
the adjusting submodule is used for adjusting the initial timeout time based on the retry times to obtain a target timeout time;
the calling submodule is used for calling the specified task framework; the specified task frame and the task frame are different frames;
the third processing submodule is used for re-executing the first task within the target overtime through the specified task frame based on the target overtime to obtain a corresponding second retry result;
and the marking sub-module is used for marking the first task as an abnormal task which fails to be executed if the second retry result is that the execution fails.
In this embodiment, the operations that the modules or units are respectively configured to execute correspond to the steps of the task processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the adjusting sub-module includes:
the acquiring unit is used for acquiring a preset weight coefficient;
a first calculating unit, configured to calculate a product of the weight coefficient and the retry number to obtain a first value;
the second calculating unit is used for calculating the sum of the specified numerical value and the initial timeout time to obtain a second numerical value;
a determining unit, configured to use the second value as the target timeout time.
In this embodiment, the operations that the modules or units are respectively configured to execute correspond to the steps of the task processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the second processing module 306 includes:
the third acquisition sub-module is used for acquiring the contact information of the specified user;
the fourth obtaining submodule is used for obtaining the task identification information of the first task;
and the sending submodule is used for sending the task failure record and the task identification information to a target terminal corresponding to the contact information so as to carry out alarm reminding on the target user.
In this embodiment, the operations that the modules or units are respectively configured to execute correspond to the steps of the task processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the task processing device further includes:
the second judgment module is used for judging whether a processing strategy generation request corresponding to the failed task and input by a target user is received or not;
the display module is used for responding to the processing strategy generation request and displaying a preset configuration interface if the processing strategy generation request is received;
the receiving module is used for receiving the configuration parameters which are input by the target user on the configuration interface and correspond to the failed tasks;
the generating module is used for generating a processing strategy corresponding to the failed task based on the configuration parameters;
the calling module is used for calling a preset task scheduling tool to build an initial task frame;
and the input module is used for inputting the processing strategy into the configuration file of the initial task frame to obtain the task frame.
In this embodiment, the operations that the modules or units are respectively configured to execute correspond to the steps of the task processing method in the foregoing embodiment one to one, and are not described herein again.
In some optional implementations of this embodiment, the task processing device further includes:
the second screening module is used for screening out second tasks except the first tasks from all the tasks to be processed;
the first storage module is used for storing the second task into a preset successful task table;
and the second storage module is used for storing the first task into a preset failure task table.
In this embodiment, the operations that the modules or units are respectively configured to execute correspond to the steps of the task processing method in the foregoing embodiment one to one, and are not described herein again.
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 4 in particular, fig. 4 is a block diagram of a basic structure of a computer device according to the embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only computer device 4 having components 41-43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system installed in the computer device 4 and various types of application software, such as computer readable instructions of a task processing method. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute computer readable instructions stored in the memory 41 or process data, for example, execute computer readable instructions of the task processing method.
The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
in the embodiment of the application, after a preset number of to-be-processed tasks are obtained, a preset task frame is called to execute all the to-be-processed tasks to obtain execution results of all the to-be-processed tasks, whether target execution results with execution failures exist in all the execution results is judged, if yes, a first task corresponding to the target execution results is screened out from all the to-be-processed tasks, a processing strategy corresponding to the failed tasks and pre-configured in a configuration file of the task frame is obtained subsequently, and finally corresponding retry processing is performed on the first task based on the processing strategy. According to the embodiment of the application, the task frame and the pre-configured processing strategy corresponding to the failed task are used, so that the corresponding retry processing can be rapidly and conveniently carried out on the task with execution failure in the tasks to be processed, and the real-time monitoring and task retry on the execution result of the task are effectively realized.
The present application further provides another embodiment, which is to provide a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the task processing method as described above.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects:
in the embodiment of the application, after a preset number of to-be-processed tasks are obtained, a preset task frame is called to execute all the to-be-processed tasks to obtain execution results of all the to-be-processed tasks, whether target execution results with execution failures exist in all the execution results is judged, if yes, a first task corresponding to the target execution results is screened out from all the to-be-processed tasks, a processing strategy corresponding to the failed tasks and pre-configured in a configuration file of the task frame is obtained subsequently, and finally corresponding retry processing is performed on the first task based on the processing strategy. According to the embodiment of the application, the task frame and the pre-configured processing strategy corresponding to the failed task are used, so that the corresponding retry processing can be rapidly and conveniently carried out on the task with execution failure in the tasks to be processed, and the real-time monitoring and task retry on the execution result of the task are effectively realized.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It should be understood that the above-described embodiments are merely exemplary of some, and not all, embodiments of the present application, and that the drawings illustrate preferred embodiments of the present application without limiting the scope of the claims appended hereto. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A task processing method, characterized by comprising the steps of:
acquiring a preset number of tasks to be processed;
calling a preset task frame to perform execution processing on all the tasks to be processed to obtain an execution result of each task to be processed;
judging whether a target execution result with execution failure exists in all the execution results;
if yes, screening out a first task corresponding to the target execution result from all the tasks to be processed;
acquiring a processing strategy which is pre-configured in a configuration file of the task framework and corresponds to a failed task;
and performing corresponding retry processing on the first task based on the processing strategy.
2. The task processing method according to claim 1, wherein the step of performing the corresponding retry processing on the first task based on the processing policy specifically includes:
obtaining the retry times and retry intervals corresponding to the failed tasks from the processing strategy;
re-executing the first task by using the task frame according to the retry times and the retry intervals to obtain a corresponding first retry result;
judging whether all the first retry results are execution failures or not;
if so, stopping re-executing the first task;
and generating a task failure record corresponding to the first task.
3. The task processing method according to claim 2, further comprising, before the step of stopping the re-execution of the processing result on the first task:
acquiring initial timeout time of the first task;
adjusting the initial timeout time based on the retry times to obtain a target timeout time;
calling a specified task frame; the specified task frame and the task frame are different frames;
based on the target overtime, the first task is re-executed within the target overtime through the specified task frame, and a corresponding second retry result is obtained;
and if the second retry result is that the execution fails, marking the first task as an abnormal task with failed execution.
4. The task processing method according to claim 3, wherein the step of adjusting the initial timeout period based on the number of retries to obtain a target timeout period specifically comprises:
acquiring a preset weight coefficient;
calculating the product of the weight coefficient and the retry times to obtain a first numerical value;
calculating the sum of the designated numerical value and the initial timeout time to obtain a second numerical value;
taking the second value as the target timeout time.
5. The task processing method according to claim 2, further comprising, after the step of generating a task failure record corresponding to the first task:
acquiring contact information of a designated user;
acquiring task identification information of the first task;
and sending the task failure record and the task identification information to a target terminal corresponding to the contact information so as to carry out alarm reminding on the target user.
6. The task processing method according to claim 1, wherein before the step of calling a preset task frame to execute all the tasks to be processed to obtain the execution result of each task to be processed, the method further comprises:
judging whether a processing strategy generation request corresponding to a failed task and input by a target user is received or not;
if so, responding to the processing strategy generation request, and displaying a preset configuration interface;
receiving configuration parameters corresponding to the failed task, which are input by the target user on the configuration interface;
generating a processing strategy corresponding to the failed task based on the configuration parameters;
calling a preset task scheduling tool to build an initial task frame;
and inputting the processing strategy into a configuration file of the initial task frame to obtain the task frame.
7. The task processing method according to claim 1, further comprising, after the step of screening out a first task corresponding to the target execution result from all the tasks to be processed:
screening out second tasks except the first task from all the tasks to be processed;
storing the second task into a preset successful task table;
and storing the first task into a preset failure task table.
8. A task processing apparatus, comprising:
the first acquisition module is used for acquiring a preset number of tasks to be processed;
the first processing module is used for calling a preset task frame to execute all the tasks to be processed to obtain the execution result of each task to be processed;
the first judgment module is used for judging whether a target execution result with execution failure exists in all the execution results;
the first screening module is used for screening out a first task corresponding to the target execution result from all the tasks to be processed if the first task is the first task;
the second acquisition module is used for acquiring a processing strategy which is pre-configured in a configuration file of the task framework and corresponds to the failed task;
and the second processing module is used for carrying out corresponding retry processing on the first task based on the processing strategy.
9. A computer device comprising a memory having computer readable instructions stored therein and a processor which when executed implements the steps of a task processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having computer-readable instructions stored thereon, which, when executed by a processor, implement the steps of the task processing method according to any one of claims 1 to 7.
CN202211160222.0A 2022-09-22 2022-09-22 Task processing method and device, computer equipment and storage medium Pending CN115543565A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211160222.0A CN115543565A (en) 2022-09-22 2022-09-22 Task processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211160222.0A CN115543565A (en) 2022-09-22 2022-09-22 Task processing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115543565A true CN115543565A (en) 2022-12-30

Family

ID=84728857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211160222.0A Pending CN115543565A (en) 2022-09-22 2022-09-22 Task processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115543565A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076096A (en) * 2023-10-17 2023-11-17 腾讯科技(深圳)有限公司 Task flow execution method and device, computer readable medium and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076096A (en) * 2023-10-17 2023-11-17 腾讯科技(深圳)有限公司 Task flow execution method and device, computer readable medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN112052111B (en) Processing method, device and equipment for server abnormity early warning and storage medium
CN112860662A (en) Data blood relationship establishing method and device, computer equipment and storage medium
CN115543565A (en) Task processing method and device, computer equipment and storage medium
CN116661936A (en) Page data processing method and device, computer equipment and storage medium
CN115757075A (en) Task abnormity detection method and device, computer equipment and storage medium
CN116932090A (en) Tool pack loading method, device, computer equipment and storage medium
CN117390119A (en) Task processing method, device, computer equipment and storage medium
CN115731057A (en) Information generation method and device, computer equipment and storage medium
CN115080045A (en) Link generation method and device, computer equipment and storage medium
CN117453536A (en) System abnormality analysis method, system abnormality analysis device, computer device and storage medium
CN117632331A (en) Data display method, device, computer equipment and storage medium
CN117278510A (en) Message sending method, device, computer equipment and storage medium
CN117395309A (en) Data reporting method, device, computer equipment and storage medium
CN117278263A (en) Authentication processing method, authentication processing device, computer equipment and storage medium
CN117390241A (en) Data display method, device, computer equipment and storage medium
CN116737437A (en) Data analysis method, device, computer equipment and storage medium
CN117395310A (en) Task processing method, device, computer equipment and storage medium
CN117034173A (en) Data processing method, device, computer equipment and storage medium
CN115905224A (en) Working hour data processing method and device, computer equipment and storage medium
CN117076781A (en) Policy data processing method and device, computer equipment and storage medium
CN115756640A (en) Method for automatically generating job scheduling configuration and related equipment thereof
CN117829897A (en) Data prediction method, device, computer equipment and storage medium
CN118227491A (en) Method and device for generating test cases, computer equipment and storage medium
CN115481889A (en) Application system capacity management method and device, computer equipment and storage medium
CN115904657A (en) Document generation method and device, computer 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