CN117591260A - Task execution method, device, equipment, storage medium and program product - Google Patents

Task execution method, device, equipment, storage medium and program product Download PDF

Info

Publication number
CN117591260A
CN117591260A CN202311572242.3A CN202311572242A CN117591260A CN 117591260 A CN117591260 A CN 117591260A CN 202311572242 A CN202311572242 A CN 202311572242A CN 117591260 A CN117591260 A CN 117591260A
Authority
CN
China
Prior art keywords
task
execution
target task
information
target
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
CN202311572242.3A
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.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202311572242.3A priority Critical patent/CN117591260A/en
Publication of CN117591260A publication Critical patent/CN117591260A/en
Pending legal-status Critical Current

Links

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a task execution method, a task execution device, a task execution storage medium and a task execution program product, and is applied to the technical field of computers. The method comprises the following steps: invoking task thread to scan task configuration information of a target task in a database, wherein the task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task; determining a trigger result of the target task according to the trigger condition of the target task; if the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task so as to realize business operation corresponding to the target task; and recording task execution information of the target task, wherein the task execution information comprises a system running state when executing the task code, an execution result of the task code and abnormal information of the task code. By adopting the method, the task execution efficiency can be improved.

Description

Task execution method, device, equipment, storage medium and program product
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, a storage medium, and a program product for executing a task.
Background
With the development of information technology, more and more services are completed through online systems. In the network system of various types of institutions, execution of the day-end task is necessary to ensure normal operation of the business of the various types of institutions.
In the related art, the day-end task is mainly configured and executed by manually writing a script or program code. Since setting of task parameters, dependency relationships and execution rules is required in the process of manually writing scripts or codes, problems such as exception handling and log recording are required to be considered. This results in cumbersome operations, which in turn makes the task execution less efficient.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a task execution method, apparatus, device, storage medium, and program product that can improve task execution efficiency.
In a first aspect, the present application provides a task execution method. The method comprises the following steps:
invoking task configuration information of a target task in a task thread scanning database, wherein the task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task;
Determining a trigger result of the target task according to the trigger condition of the target task;
if the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task so as to realize business operation corresponding to the target task;
and recording task execution information of the target task, wherein the task execution information comprises a system running state when the task code is executed, an execution result of the task code and abnormal information of the task code.
In one embodiment, the determining the trigger result of the target task according to the trigger condition of the target task includes:
if the trigger condition of the target task is always trigger, determining that the trigger result of the target task is that the target task meets the trigger condition;
if the trigger condition of the target task is not always triggered, determining a trigger result of the target task by detecting a trigger time point or a trigger operation in the trigger condition.
In one embodiment, the information of the execution class includes a name string of the execution class; the executing the task code corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameter of the target task includes:
Determining a task code corresponding to the execution class through reflection according to a name character string of the execution class corresponding to the target task;
and executing task codes corresponding to the execution classes according to the execution parameters of the target tasks.
In one embodiment, after the recording of the task execution information of the target task, the method further includes:
if the abnormal information of the task code indicates that the task code is abnormal in the execution process, positioning key error information in a log file according to the abnormal information indication;
and generating an abnormal analysis result of the execution process of the task code by detecting the key error information.
In one embodiment, the task configuration information further includes restart indication information of the target task and restart times information of the target task;
after the recording of the task execution information of the target task, the method further includes:
determining whether to restart execution of task codes corresponding to the execution class according to the restart indication information of the target task;
if yes, re-executing the task code corresponding to the execution class according to the restarting time information of the target task.
In one embodiment, before the invoking task thread scans the task configuration information of the target task in the database, the method:
receiving task configuration information of the target task, which is sent by a terminal device, wherein the task configuration information is information configured for the target task in a task configuration page by a user;
and storing the task configuration information of the target task in the database.
In a second aspect, the present application provides a task execution method apparatus. The device comprises:
the scanning module is used for calling task configuration information of a target task in a task thread scanning database, wherein the task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task;
the judging module is used for determining a trigger result of the target task according to the trigger condition of the target task;
the execution module is used for executing task codes corresponding to the execution classes according to the information of the execution classes corresponding to the target task and the execution parameters of the target task if the trigger result is that the target task meets the trigger condition, so as to realize business operation corresponding to the target task;
The recording module is used for recording task execution information of the target task, wherein the task execution information comprises a system running state when the task code is executed, an execution result of the task code and abnormal information of the task code.
In one embodiment, the judging module is specifically configured to determine that the trigger result of the target task is that the target task meets the trigger condition if the trigger condition of the target task is always trigger; if the trigger condition of the target task is not always triggered, determining a trigger result of the target task by detecting a trigger time point or a trigger operation in the trigger condition.
In one embodiment, the information of the execution class includes a name string of the execution class; the execution module is specifically configured to determine, by reflection, a task code corresponding to the execution class according to a name string of the execution class corresponding to the target task; and executing task codes corresponding to the execution classes according to the execution parameters of the target tasks.
In one embodiment, the apparatus further comprises:
the exception module is used for positioning key error information in the log file according to the exception information indication if the exception information of the task code indicates that the task code is abnormal in the execution process; and generating an abnormal analysis result of the execution process of the task code by detecting the key error information.
In one embodiment, the task configuration information further includes restart indication information of the target task and restart times information of the target task;
the exception module is further configured to determine whether to restart execution of a task code corresponding to the execution class according to restart instruction information of the target task; if yes, re-executing the task code corresponding to the execution class according to the restarting time information of the target task.
In one embodiment, the apparatus further comprises:
the configuration module is used for receiving task configuration information of the target task sent by the terminal equipment, wherein the task configuration information is information configured for the target task in a task configuration page by a user; and storing the task configuration information of the target task in the database.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the task execution method of the first aspect described above when executing the computer program.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the task execution method of the first aspect described above.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the task execution method of the first aspect described above.
The task execution method, the device, the computer equipment, the storage medium and the computer program product firstly call task configuration information of a target task in a task thread scanning database, wherein the task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task. And then, determining a trigger result of the target task according to the trigger condition of the target task. And if the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task so as to realize business operation corresponding to the target task. And finally, recording task execution information of the target task, wherein the task execution information comprises a system running state when the task code is executed, an execution result of the task code and abnormal information of the task code. In the application, when the trigger condition is met, the task code of the corresponding trigger execution class of the target task is automatically executed so as to realize the business operation corresponding to the target task, thereby realizing the automatic scheduling and execution of the task, and writing a script or program corresponding to the task without means, thereby improving the task execution efficiency.
Drawings
Fig. 1 is an application environment diagram of a task execution method provided in an embodiment of the present application;
fig. 2 is a flow chart of a task execution method according to an embodiment of the present application;
FIG. 3 is a flowchart of another task execution method according to an embodiment of the present application;
FIG. 4 is an interface schematic diagram of a timing task list according to an embodiment of the present disclosure;
FIG. 5 is a flowchart of another task execution method according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of an interface of task execution information according to an embodiment of the present application;
FIG. 7 is a flowchart of another task execution method according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a configuration interface according to an embodiment of the present application;
FIG. 9 is a schematic illustration of task execution provided in an embodiment of the present application;
fig. 10 is a block diagram of a task execution device according to an embodiment of the present application;
fig. 11 is an internal structure diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The task execution method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server.
The terminal 102 may send task configuration information of the target task to the server 104, where the task configuration information includes a trigger condition of the target task, an execution parameter of the target task, and information of an execution class corresponding to the target task. The server 104 stores task configuration information for the target task in a database. The server 104 may invoke the task configuration information of the target task in the task thread scan database. Then, the server 104 determines a trigger result of the target task according to the trigger condition of the target task. If the trigger result is that the target task meets the trigger condition, the server 104 executes the task code corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameter of the target task, so as to realize the business operation corresponding to the target task. Finally, the server 104 records task execution information of the target task, where the task execution information includes a system running state when executing the task code, an execution result of the task code, and exception information of the task code.
The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a task execution method is provided, and an example of application of the method to the server in fig. 1 is described, including S201-S204:
s201, calling task thread to scan task configuration information of a target task in a database.
The task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task.
In the application, the server can trigger the execution of the target task by calling task configuration information of the target task in the task thread scanning database.
It should be understood that the embodiments of the present application do not limit the target task, and may be a day-end task, and exemplary tasks may include data processing, reconciliation, report generation, and the like.
The triggering condition of the target task may include a triggering time point, a triggering operation, etc., or may directly indicate to trigger all the time, which is not limited in the embodiment of the present application. For example, the triggering time point may be zero point of each day, and the triggering operation may be that the user clicks a control on the page.
The execution class may include a member method, a member variable and a constructor, which are used for executing corresponding functions, the execution parameters of the target task may be member variables in the execution class, and values of different execution parameters may be set for different target tasks.
It should be understood that the embodiments of the present application do not limit how the server invokes the task configuration information of the target task in the task thread scan database, and in some embodiments, the server may scan the task configuration information of the target task in the database at preset time intervals, for example, every 5 minutes or every 10 minutes. In other embodiments, the server may periodically scan the task configuration information for the target task in the database, e.g., once every full scan.
S202, determining a trigger result of the target task according to the trigger condition of the target task.
In this step, after the server invokes the task thread to scan the task configuration information of the target task in the database, the trigger result of the target task may be determined according to the trigger condition of the target task.
It should be understood that the embodiment of the present application does not limit how to determine the trigger result of the target task according to the trigger condition of the target task.
In some embodiments, if the trigger condition of the target task is always trigger, determining that the trigger result of the target task is that the target task meets the trigger condition. If the trigger condition of the target task is not always triggered, determining a trigger result of the target task by detecting a trigger time point or a trigger operation in the trigger condition.
For example, if the trigger condition indicates that the trigger is always triggered, the trigger result of the target task is determined to be that the trigger condition is satisfied. If the trigger condition indicates that the trigger is not always triggered, the trigger time point or the trigger operation in the trigger condition can be further confirmed.
For example, the trigger time point or the trigger operation in the trigger condition may be confirmed, for example, if the current time point reaches or exceeds the trigger time point, the trigger result of the target task is determined to satisfy the trigger condition, or if the trigger operation is detected, the trigger result of the target task is determined to satisfy the trigger condition. If the trigger operation is not always triggered and the current time point does not reach or exceed the trigger time point, the trigger result of the target task can be determined to be not met with the trigger condition, and accordingly, execution of the target task is not performed, and judgment is performed again after the task thread scans task configuration information of the target task next time.
It should be understood that the embodiment of the present application is not limited to the trigger time point, and may be, for example, a zero point on a daily basis. It should be understood that the embodiment of the present application is not limited to triggering operation, and may be, for example, a clicking operation of a control.
In some embodiments, the determining the trigger result of the target task according to the trigger condition of the target task may be performed by a task scheduler in the server. The task scheduler can determine the trigger result of the target task according to the task configuration information, and further automatically trigger the execution of the target task. In other embodiments, the task scheduler may also schedule and coordinate the target tasks according to predetermined rules.
And S203, if the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task so as to realize business operation corresponding to the target task.
In the step, when the server determines that the trigger result is that the target task meets the trigger condition, the task code corresponding to the execution class can be executed according to the information of the execution class corresponding to the target task and the execution parameter of the target task, so as to realize the business operation corresponding to the target task.
It should be understood that the embodiments of the present application are limited to executing task codes corresponding to the execution class, and in some embodiments, the information of the execution class includes a name string of the execution class. Correspondingly, the server may determine, by reflection, the task code corresponding to the execution class according to the name string of the execution class corresponding to the target task. Then, the server can execute the task code corresponding to the execution class according to the execution parameters of the target task.
It should be appreciated that by the above-described reflection, information of the execution class, including attributes, methods, and task code, may be dynamically obtained and used at runtime. By reflection, it is possible to create objects, calling methods and access attributes from class name strings without knowing the specific class name.
In some embodiments, the member variables in the execution class may be changed using the values of the execution parameters of the target task, so that after the member variables are changed, the corresponding task codes are executed to implement the corresponding business operations.
It should be understood that, in the embodiment of the present application, the business operation implemented by executing the task code corresponding to the execution class is not limited, and may include, for example, operations such as data processing, reconciliation processing, report generation, and the like.
In some embodiments, the execution of the task code corresponding to the execution class may be performed by an execution engine, where the execution engine may be responsible for actually executing the business logic of the business operation corresponding to the target task by executing the task code.
S204, recording task execution information of the target task.
In this step, when the server executes the task code corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameter of the target task, the task execution information of the target task may be recorded.
The task execution information comprises a system running state when executing the task code, an execution result of the task code and abnormal information of the task code.
In the application, by recording the task execution information of the target task, a corresponding processing mechanism can be provided for the situation occurring in the execution process of the log code. For example, mechanisms such as error alerting, logging, and automatic retry may be included.
In some embodiments, after recording the task execution information of the target task, if the exception information of the task code indicates that the task code is abnormal in the execution process, the server locates the critical error information in the log file according to the exception information indication. Then, the server may generate an exception analysis result of the execution process of the task code by detecting the critical error information.
For example, during the execution of the target task, the server may record, in real time, critical error information of the abnormal execution of the task in the task log, and store the task log in the database. Then, after the execution of the target task is completed, the critical error information in the task log can be quickly positioned based on the exception information indication, so that the critical error information is detected, and an exception analysis result is obtained, wherein the exception analysis result can be used for indicating the reason of the exception triggering the task code. Illustratively, the detailed information of the target task process is also recorded in the log file.
It should be understood that the embodiments of the present application do not limit how to detect the critical error information, and a common log data analysis method may be used.
In some embodiments, the task configuration information further includes restart indication information of the target task and restart times information of the target task. After recording the task execution information of the target task, the server may determine whether to restart execution of the task code corresponding to the execution class according to the restart instruction information of the target task. If yes, the server re-executes the task code corresponding to the execution class according to the restart times information of the target task. If not, the server ends the re-execution of the task code.
For example, an automatic retry mechanism may be implemented based on the restart indication information of the target task and the restart times information of the target task. When the execution engine encounters a predictable abnormality in the task processing process during the task execution, whether retry is needed or not can be judged according to the task configuration information, and the retry can be indicated by restart indication information, for example, the retry can be performed when the task fails. In addition, when the retry is performed, the restart frequency information may be set, for example, the retry is performed 5 times, and when the number of retries exceeds 5 times, the execution of the task code corresponding to the execution class is stopped again.
According to the task execution method, the automatic configuration and the automatic execution of the target log are realized, the operation flow is simplified, and the configuration accuracy and the execution efficiency are improved. The automatic configuration and automatic execution of the target log can be realized through the task scheduler and the execution engine, so that manual operation is reduced, and the execution efficiency and accuracy are improved. In addition, through the collocation design of the task collocation information, the system can flexibly adapt to different service demands and changes, has stronger expandability, can further manage and execute target tasks more efficiently, reduces human errors, and improves the stability and efficiency of service operation.
According to the task execution method, task configuration information of a target task in a task thread scanning database is called, wherein the task configuration information comprises trigger conditions of the target task, execution parameters of the target task and execution class information corresponding to the target task. And then, determining a trigger result of the target task according to the trigger condition of the target task. And if the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task so as to realize the business operation corresponding to the target task. Finally, task execution information of the target task is recorded, wherein the task execution information comprises a system running state when executing the task code, an execution result of the task code and abnormal information of the task code. In the application, when the trigger condition is met, the task code of the corresponding trigger execution class of the target task is automatically executed so as to realize the business operation corresponding to the target task, thereby realizing the automatic scheduling and execution of the task, and writing a script or program corresponding to the task without means, thereby improving the task execution efficiency.
The following describes how to determine the trigger result of the target task. Fig. 3 is a flow chart of another task execution method according to an embodiment of the present application. As shown in fig. 3, the task execution method includes S301 to S308:
s301, calling task thread to scan task configuration information of a target task in a database.
The task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task;
s302, determining that the triggering condition of the target task is always triggering.
If yes, executing S306, otherwise executing S303;
s303, determining whether a trigger time point in the trigger condition is reached.
If yes, executing S306, otherwise executing S304;
s304, determining whether a triggering operation is detected.
If yes, executing S306, otherwise executing S305;
s305, determining that the trigger result of the target task is that the target task does not meet the trigger condition.
S306, determining that the trigger result of the target task is that the target task meets the trigger condition.
S307, executing task codes corresponding to the execution classes according to the information of the execution classes corresponding to the target tasks and the execution parameters of the target tasks so as to realize business operations corresponding to the target tasks.
In some embodiments, the information of the execution class includes a name string of the execution class. The server can determine the task code corresponding to the execution class through reflection according to the name character string of the execution class corresponding to the target task. And then, the server executes the task codes corresponding to the execution classes according to the execution parameters of the target task.
S308, recording task execution information of the target task.
The task execution information comprises a system running state when executing the task code, an execution result of the task code and abnormal information of the task code.
Exemplary, fig. 4 is an interface schematic diagram of a timed task list provided in an embodiment of the present application. As shown in fig. 4, the timing task list is provided with a trigger time point and a control for triggering operation, and the user can execute the control task code once through triggering operation 'immediately' or can start the control task code to execute normally through triggering operation 'start'. Or when the trigger time point is set in the timing task list, the task can be automatically triggered. In addition, the user may also modify the trigger point in time.
In the method, the automatic execution of the target task is realized through triggering conditions such as a triggering time point, triggering operation and the like, the automatic execution of the target task is realized, and the execution efficiency of the target task is improved.
The following is how the server initiates execution of the task code corresponding to the execution class. An explanation is given. Fig. 5 is a flowchart of another task execution method according to an embodiment of the present application, as shown in fig. 5, where the task execution method includes S401-S407:
s401, calling task thread to scan task configuration information of a target task in a database.
The task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task.
S402, determining a trigger result of the target task according to the trigger condition of the target task.
S403, if the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task, so as to realize business operation corresponding to the target task.
S404, recording task execution information of the target task.
The task execution information comprises a system running state when executing the task code, an execution result of the task code and abnormal information of the task code.
S405, determining whether to restart execution of task codes corresponding to the execution class according to the restart instruction information of the target task.
If yes, S406 is executed, and if no, S407 is executed.
S406, re-executing task codes corresponding to the execution classes according to the restart times information of the target tasks.
S407, ending executing the task code corresponding to the execution class.
Fig. 6 is an interface schematic diagram of task execution information according to an embodiment of the present application. As shown in fig. 6, the interface of the task execution information includes the number of the target task and the information of the execution class corresponding to the target task, and also includes the execution result of the task code, for example, the task execution time and the task execution duration, and may also include the system running state, and may also include the exception information, for example, the failure number. After triggering corresponding operation, the related control can check details of the task execution information.
The following describes how the server saves the task configuration information of the target task in the database. Fig. 7 is a flowchart of another task execution method according to an embodiment of the present application, as shown in fig. 7, where the task execution method includes S501-S506:
s501, task configuration information of a target task sent by the terminal equipment is received, wherein the task configuration information is information configured for the target task in a task configuration page by a user.
In some embodiments, a task configuration page may be displayed on the terminal device, and the user may input information such as task parameters, dependency relationships, execution rules, and the like of the target task into the task configuration page, so that the terminal may obtain task configuration information of the target task from information of the task configuration page input by the user. The terminal device may then send task configuration information for the target task to the server.
Fig. 8 is a schematic diagram of a configuration interface according to an embodiment of the present application. As shown in fig. 8, the configuration interface may configure a trigger condition of the target task, an execution parameter of the target task, and information of an execution class corresponding to the target task, and may also configure restart information, for example, may include restart instruction information of the target task and restart frequency information of the target task.
S502, task configuration information of the target task is stored in a database.
S503, calling task thread to scan task configuration information of a target task in a database.
The task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task.
S504, determining a trigger result of the target task according to the trigger condition of the target task.
S505, if the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task, so as to realize business operation corresponding to the target task.
S506, recording task execution information of the target task.
The task execution information comprises a system running state when executing the task code, an execution result of the task code and abnormal information of the task code.
Fig. 9 is a schematic illustration of task execution according to an embodiment of the present application. As shown in fig. 9, task management may be performed in the terminal device, and each task is configured by the user, so as to obtain task configuration information of each task. Then, the terminal device can send the task configuration information of each task to the server, the server executes each task, and logs of each task are recorded. When the task is abnormally executed, the server can call back or retry each task.
According to the task execution method, task configuration information of a target task in a task thread scanning database is called, wherein the task configuration information comprises trigger conditions of the target task, execution parameters of the target task and execution class information corresponding to the target task. And then, determining a trigger result of the target task according to the trigger condition of the target task. And if the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task so as to realize the business operation corresponding to the target task. Finally, task execution information of the target task is recorded, wherein the task execution information comprises a system running state when executing the task code, an execution result of the task code and abnormal information of the task code. In the application, when the trigger condition is met, the task code of the corresponding trigger execution class of the target task is automatically executed so as to realize the business operation corresponding to the target task, thereby realizing the automatic scheduling and execution of the task, and writing a script or program corresponding to the task without means, thereby improving the task execution efficiency.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a task execution device for realizing the task execution method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the task execution device or task execution devices provided below may refer to the limitation of the task execution method hereinabove, and will not be repeated here.
In one embodiment, as shown in fig. 10, there is provided a task performing device 600 including: a scanning module 601, a judging module 602, an executing module 603, a recording module 604, an abnormality module 605 and a configuration module 606, wherein:
the scanning module 601 is configured to invoke task configuration information of a target task in the task thread scanning database, where the task configuration information includes a trigger condition of the target task, an execution parameter of the target task, and information of an execution class corresponding to the target task;
a judging module 602, configured to determine a trigger result of the target task according to a trigger condition of the target task;
the execution module 603 is configured to execute a task code corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameter of the target task if the trigger result indicates that the target task meets the trigger condition, so as to implement a service operation corresponding to the target task;
the recording module 604 is configured to record task execution information of the target task, where the task execution information includes a system running state when executing the task code, an execution result of the task code, and exception information of the task code.
In one embodiment, the judging module 602 is specifically configured to determine that the trigger result of the target task is that the target task meets the trigger condition if the trigger condition of the target task is always trigger; if the trigger condition of the target task is not always triggered, determining a trigger result of the target task by detecting a trigger time point or a trigger operation in the trigger condition.
In one embodiment, the information of the execution class includes a name string of the execution class; the execution module 603 is specifically configured to determine, by reflection, a task code corresponding to an execution class according to a name string of the execution class corresponding to the target task; and executing task codes corresponding to the execution classes according to the execution parameters of the target tasks.
In one embodiment, the task performing device 600 further includes:
the exception module 605 is configured to locate key error information in the log file according to the exception information indication if the exception information of the task code indicates that the task code is abnormal during execution; and generating an abnormal analysis result of the execution process of the task code by detecting the key error information.
In one embodiment, the task configuration information further includes restart indication information of the target task and restart times information of the target task;
the exception module 605 is further configured to determine whether to restart execution of the task code corresponding to the execution class according to the restart instruction information of the target task; if yes, executing the task code corresponding to the execution class again according to the restarting time information of the target task.
In one embodiment, the task performing device 600 further includes:
The configuration module 606 is configured to receive task configuration information of a target task sent by the terminal device, where the task configuration information is information configured for the target task in a task configuration page by a user; and storing task configuration information of the target task in a database.
Each of the modules in the task performing device may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 11. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a task execution method.
It will be appreciated by those skilled in the art that the structure shown in fig. 11 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the computer device to which the present application applies, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided that includes a memory having a computer program stored therein and a processor that implements the task execution method described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the task execution method described above.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, implements the task execution method described above.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to comply with the related laws and regulations and standards of the related countries and regions.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method of task execution, the method comprising:
invoking task configuration information of a target task in a task thread scanning database, wherein the task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task;
determining a trigger result of the target task according to the trigger condition of the target task;
If the trigger result is that the target task meets the trigger condition, executing task codes corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameters of the target task so as to realize business operation corresponding to the target task;
and recording task execution information of the target task, wherein the task execution information comprises a system running state when the task code is executed, an execution result of the task code and abnormal information of the task code.
2. The method according to claim 1, wherein determining the trigger result of the target task according to the trigger condition of the target task comprises:
if the trigger condition of the target task is always trigger, determining that the trigger result of the target task is that the target task meets the trigger condition;
if the trigger condition of the target task is not always triggered, determining a trigger result of the target task by detecting a trigger time point or a trigger operation in the trigger condition.
3. The method of claim 1, wherein the information of the execution class includes a name string of the execution class; the executing the task code corresponding to the execution class according to the information of the execution class corresponding to the target task and the execution parameter of the target task includes:
Determining a task code corresponding to the execution class through reflection according to a name character string of the execution class corresponding to the target task;
and executing task codes corresponding to the execution classes according to the execution parameters of the target tasks.
4. A method according to any one of claims 1-3, characterized in that after said recording of task execution information of said target task, the method further comprises:
if the abnormal information of the task code indicates that the task code is abnormal in the execution process, positioning key error information in a log file according to the abnormal information indication;
and generating an abnormal analysis result of the execution process of the task code by detecting the key error information.
5. A method according to any one of claims 1 to 3, wherein the task configuration information further includes restart indication information of the target task and restart times information of the target task;
after the recording of the task execution information of the target task, the method further includes:
determining whether to restart execution of task codes corresponding to the execution class according to the restart indication information of the target task;
If yes, re-executing the task code corresponding to the execution class according to the restarting time information of the target task.
6. A method according to any of claims 1-3, characterized in that before the invoking task thread scans the task configuration information of the target task in the database, the method:
receiving task configuration information of the target task, which is sent by a terminal device, wherein the task configuration information is information configured for the target task in a task configuration page by a user;
and storing the task configuration information of the target task in the database.
7. A task execution device, the device comprising:
the scanning module is used for calling task configuration information of a target task in a task thread scanning database, wherein the task configuration information comprises trigger conditions of the target task, execution parameters of the target task and information of an execution class corresponding to the target task;
the judging module is used for determining a trigger result of the target task according to the trigger condition of the target task;
the execution module is used for executing task codes corresponding to the execution classes according to the information of the execution classes corresponding to the target task and the execution parameters of the target task if the trigger result is that the target task meets the trigger condition, so as to realize business operation corresponding to the target task;
The recording module is used for recording task execution information of the target task, wherein the task execution information comprises a system running state when the task code is executed, an execution result of the task code and abnormal information of the task code.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311572242.3A 2023-11-22 2023-11-22 Task execution method, device, equipment, storage medium and program product Pending CN117591260A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311572242.3A CN117591260A (en) 2023-11-22 2023-11-22 Task execution method, device, equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311572242.3A CN117591260A (en) 2023-11-22 2023-11-22 Task execution method, device, equipment, storage medium and program product

Publications (1)

Publication Number Publication Date
CN117591260A true CN117591260A (en) 2024-02-23

Family

ID=89916153

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311572242.3A Pending CN117591260A (en) 2023-11-22 2023-11-22 Task execution method, device, equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN117591260A (en)

Similar Documents

Publication Publication Date Title
US20140208169A1 (en) Domain scripting language framework for service and system integration
CN110716878B (en) Automatic interface testing method, device and system
US20140208294A1 (en) Domain scripting language framework for service and system integration
US11567756B2 (en) Causality determination of upgrade regressions via comparisons of telemetry data
CN113220540B (en) Service management method, device, computer equipment and storage medium
CN103679390A (en) Background testing method and device of configuration system
CN111538659B (en) Interface testing method, system, electronic equipment and storage medium of business scene
WO2020253045A1 (en) Configured supplementary processing method and device for data of which forwarding has abnormality, and readable storage medium
CN113742224A (en) Test system, method, device, computer equipment and storage medium
CN112445860B (en) Method and device for processing distributed transaction
CN113760491A (en) Task scheduling system, method, equipment and storage medium
CN111913804A (en) Pre-visit report generation method and device, electronic equipment and storage medium
CN116185774A (en) Log monitoring installation method, device, computer equipment and storage medium
CN117591260A (en) Task execution method, device, equipment, storage medium and program product
WO2019062087A1 (en) Attendance check data testing method, terminal and device, and computer readable storage medium
CN112732415B (en) Transaction processing method, device and equipment based on resource exchange proxy system
CN111008131B (en) Automated testing method, apparatus, computer device and storage medium
CN110990475B (en) Batch task inserting method and device, computer equipment and storage medium
CN116820558A (en) Application program development method, device, equipment, storage medium and program product
CN118113622A (en) Detection and repair method, device and equipment applied to batch operation scheduling
CN117331789A (en) Log generation method, device, computer equipment and storage medium
CN116339777A (en) System patch processing method, device, computer equipment and storage medium
CN114579464A (en) Dynamic information verification method and device based on tangent plane programming and computer equipment
CN116521546A (en) Interface performance adjusting method and device, computer equipment and storage medium
CN116582606A (en) Message idempotent method, 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