WO2019047565A1 - 任务处理方法、装置、计算机设备和存储介质 - Google Patents

任务处理方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2019047565A1
WO2019047565A1 PCT/CN2018/088617 CN2018088617W WO2019047565A1 WO 2019047565 A1 WO2019047565 A1 WO 2019047565A1 CN 2018088617 W CN2018088617 W CN 2018088617W WO 2019047565 A1 WO2019047565 A1 WO 2019047565A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
split
executed
thread
execution
Prior art date
Application number
PCT/CN2018/088617
Other languages
English (en)
French (fr)
Inventor
王燕
莫瑞海
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019047565A1 publication Critical patent/WO2019047565A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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
    • G06F9/4856Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration
    • G06F9/4862Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration the task being a mobile agent, i.e. specifically designed to migrate
    • G06F9/4868Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration the task being a mobile agent, i.e. specifically designed to migrate with creation or replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5017Task decomposition

Definitions

  • the present application relates to a task processing method, apparatus, computer device, and storage medium.
  • the traditional task processing method improves the execution efficiency of tasks by parallel processing batch operations of different business functions.
  • the inventors realized that as the amount of business increases, the execution time of batch tasks of the same business function is also increased. The longer it is, the less efficient the task is.
  • a task processing method, apparatus, computer device, and storage medium are provided.
  • a task processing method includes:
  • split task table If the split task is to be executed in the split task table, obtain the execution program identifier corresponding to the to-be-executed split task;
  • the executing each of the task threads includes:
  • a task processing device includes:
  • the split task detection module is configured to detect whether a split task is to be executed in the split task table.
  • the execution program identifier obtaining module is configured to acquire an execution program identifier corresponding to each of the to-be-executed split tasks if the split task to be executed in the split task table is detected;
  • the split task quantity statistics module is configured to: if the execution program identifiers are the same, the number of the split tasks to be executed is counted;
  • the task thread creation module is configured to create a task thread corresponding to the to-be-executed split task according to the number of the split tasks to be executed and the preset task processing quantity corresponding to the to-be-executed split task.
  • a task thread execution module synchronously executing each of the task threads
  • the task thread execution module is configured to acquire a program name and an operation parameter corresponding to the to-be-executed split task according to the execution program identifier corresponding to the to-be-executed split task; and execute the operation parameter according to the to-be-executed split task The execution program corresponding to the execution program name.
  • a computer apparatus comprising a memory and one or more processors having stored therein computer readable instructions that, when executed by a processor, implement the steps of the task processing method provided in any one of the embodiments of the present application.
  • One or more non-volatile storage media storing computer readable instructions, when executed by one or more processors, causing one or more processors to perform the tasks provided in any one embodiment of the present application The steps of the processing method.
  • FIG. 1 is an application environment diagram of a task processing method in accordance with one or more embodiments.
  • FIG. 2 is a block diagram of a computer device in accordance with one or more embodiments.
  • FIG. 3 is a flow diagram of a task processing method in accordance with one or more embodiments.
  • FIG. 4 is a flow diagram of a method of timeout task processing in accordance with one or more embodiments.
  • FIG. 5 is a flow diagram of an anomaly detection method in accordance with one or more embodiments.
  • FIG. 6 is a flow diagram of a batch processing method in accordance with one or more embodiments.
  • FIG. 7 is a block diagram of a task processing apparatus in accordance with one or more embodiments.
  • FIG. 8 is a block diagram of a timeout task processing apparatus in accordance with one or more embodiments.
  • FIG. 9 is a block diagram of an anomaly detection device in accordance with one or more embodiments.
  • FIG. 10 is a block diagram of a batch processing device in accordance with one or more embodiments.
  • the task processing method provided by the present application can be applied to an application environment as shown in FIG. 1.
  • the server 102 communicates with the terminal 104 via the network, and the server 102 transmits the detected abnormal behavior information of the task thread in which the abnormality has occurred to the terminal 104.
  • the server 102 detects whether there is a split task to be executed in the split task table. If a split task is to be executed in the split task table, the execution program identifier corresponding to each split task to be executed is obtained, and the execution program identifiers are the same.
  • the number of tasks to be executed is counted, and the task thread corresponding to the split task to be executed is created according to the number of split tasks to be executed and the number of preset tasks corresponding to the split task to be executed; each task is executed synchronously.
  • the thread detects whether an abnormality occurs in the execution of the task thread. If the task thread in which the abnormality is detected is detected, the abnormal behavior information of the task thread in which the abnormality occurs is acquired, and the abnormal behavior information is transmitted to the terminal 104.
  • the terminal 104 is operated by an operation manager for monitoring the execution of the split task, and the operation manager is a user with operation management authority.
  • Server 102 can be implemented as a standalone server or as a server cluster of multiple servers. Terminals 104 can be, but are not limited to, various personal computers, notebook computers, smart phones, tablets, and portable wearable devices.
  • a computer device is provided, the internal structure of which may be as shown in FIG. 2, which may be the server shown in FIG. 1.
  • the computer device includes a processor coupled through a system bus, a non-volatile storage medium, an internal memory, and a network connection.
  • the non-volatile storage medium can be a non-transitory computer readable storage medium.
  • An operating system and computer readable instructions are stored in the non-volatile storage medium for implementing the task processing method applicable to the computer device provided in the embodiments of the present application.
  • the processor is used to increase computing and control capabilities and support the operation of the entire computer device.
  • the internal memory is used to provide an environment for the operation of operating systems and computer readable instructions in a non-volatile storage medium.
  • the network interface is used for network communication with the terminal. It will be understood by those skilled in the art that the structure shown in FIG. 2 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied. Specifically, the server may include a ratio. More or fewer components are shown in the figures, or some components are combined, or have different component arrangements.
  • a task processing method is provided, which is applied to the server in FIG. 1 as an example, and includes the following steps:
  • Step 302 Detect whether there is a split task to be executed in the split task table.
  • the split task table is a pre-established database table for storing split tasks obtained by splitting a batch task that satisfies a preset rule.
  • the batch task that meets the preset rule may be a batch task whose average running time is greater than a preset running time threshold, or a batch task whose data amount is greater than a preset data amount threshold.
  • the method for detecting whether the split task is to be executed in the split task table may be: obtaining a scheduled start time of the task to be split, and comparing the planned start time with the current time, if the planned start time and current If the time is the same or the planned start time is earlier than the current time, the split task is the split task to be executed, or it may be: detecting the execution status of the split task in the split task table, and if the execution status is to be executed, the split is performed.
  • the split task is a split task to be executed, wherein the execution state is used to record the execution progress of the split task.
  • the execution status of the split task is to be executed; After the thread starts to execute the split task in parallel, the execution state of the split task is executed. When the split task is executed, the execution status of the split task is modified to be executed.
  • Step 304 If it is detected that the split task is to be executed in the split task table, obtain an execution program identifier corresponding to each split task to be executed.
  • the executor is program code for executing a split task; the executor identifier is used to uniquely identify the program code corresponding to the execution of the split task.
  • Step 306 If the execution program identifiers are the same, the number of the split tasks to be executed is counted.
  • the split task to be executed is split by the same batch task. Count the number of split tasks to be executed for subsequent creation of parallel task threads.
  • Step 308 Create a task thread corresponding to the to-be-executed split task according to the number of the split tasks to be executed and the preset task processing amount corresponding to the split task to be executed.
  • the preset task processing quantity corresponding to the split task to be executed is a preset maximum number of tasks allowed to be executed by the service module corresponding to the task to be split, and if the split task to be executed is a certification task of the Shanghai institution, the corresponding
  • the business module is a certificate making module, and the certificate making module sets the maximum number of tasks allowed to be performed according to the amount of data.
  • a task thread corresponding to the to-be-executed split task is created according to the number of the split tasks to be executed and the preset task processing amount corresponding to the split task to be executed, including: if the number of split tasks to be executed is smaller than the split task to be executed If the number of the preset task processing is the same, the number of the task threads to be executed is set to be the number of the task to be executed; if the number of the split tasks to be executed is greater than or equal to the number of preset task processes corresponding to the split task to be executed, the quantity is created.
  • the number of task threads that are processed for the scheduled task For example, if there are 14 tasks to be split in the split task table with the same program execution identifier, and the number of preset tasks to be split is 7, then 7 task threads are created, and each task is created.
  • the thread serially performs 2 split tasks.
  • the tasks to be split are classified according to the execution program identifier, and the number of each task to be executed is counted, and each of the tasks is acquired separately.
  • the number of preset tasks processed by the class to be split task is created according to the number of tasks to be executed and the number of preset task processes. For example, it is detected that the split tasks currently required to be executed in the split task table are a1, a2, a3, b1, b2, c1, c2, and c3.
  • a1, a2 and a3 have the same execution program identifier, belong to the same type (type a) to be executed split task; b1 and b2 have the same executable program identifier, belong to the same type (type b) to be executed split Tasks; c1, c2, and c3 have the same execution task identifier and belong to the same type (type c) to be executed.
  • the to-be-split task having the same executor identifier corresponds to the same service module. For example, the maximum number of tasks allowed by the service module corresponding to type a is 2, and the maximum task number allowed by the service module corresponding to type b is 3.
  • the maximum number of tasks allowed by the service module corresponding to type a is 4, then 7 task threads are created, where two task threads correspond to the tasks to be executed of type a (eg, a1 and a2 correspond to the same task thread 1, A3 corresponds to the task thread 2), two task threads correspond to the task to be executed of type b (b1 corresponds to task thread 3, b2 corresponds to task thread 4), and the remaining three task threads correspond to type c to be executed The task (c1 corresponds to task thread 5, c2 corresponds to task thread 6, and c2 corresponds to task thread 7).
  • step 310 each task thread is executed synchronously.
  • the steps to execute each task thread include:
  • Step 3102 Obtain a program name and an operation parameter corresponding to the to-be-executed split task according to the execution program identifier corresponding to the split task to be executed.
  • the split task information includes an execution program identifier corresponding to the split task, a split task identifier, and a schedule start time
  • the execution program information includes an execution program identifier, an execution program name, and an operation parameter.
  • Step 3104 Execute an execution program corresponding to the execution program name according to the running parameter of the split task to be executed.
  • the execution program corresponding to the split task to be executed may be invoked by executing the program name and the running parameter corresponding to the split task to be executed, thereby implementing the execution of the split task to be executed.
  • gbs_blacklist(region_code) gbs_blacklist is the program name corresponding to the blacklist identification task of the claim case
  • region_cod is the running parameter, indicating the organization to which the claim case belongs.
  • the acquired execution program identifiers corresponding to the to-be-executed split tasks are the same, it indicates that the split task to be executed is split by the same batch task, and then the splits are to be executed.
  • the task is executed in parallel, which effectively improves the execution efficiency of the batch task.
  • the task thread executed in parallel is determined according to the number of split tasks to be executed and the preset task processing amount corresponding to the split task to be executed, further improving the batch. Handle the execution efficiency of tasks.
  • the method further includes:
  • Step 402 When the execution time of the task thread reaches the preset execution time, it is detected whether there is a task thread.
  • the preset execution time is the maximum time value allowed by the execution program corresponding to the task to be split set in advance, for example, 5 hours; the execution task thread refers to the task thread in the running state.
  • Step 404 If it is detected that the task thread is executed, the execution task thread is terminated, and the to-be-executed split task corresponding to the execution task thread is marked as the to-be-executed timeout task.
  • the timeout task in the split task to be executed is determined according to the preset execution time, and the execution of the timeout task is terminated, and the timeout task is executed separately, which effectively improves the execution efficiency of the split task to be executed.
  • Step 406 Detect whether there is a timeout task to be executed.
  • the timeout tasks in the split task are processed separately.
  • Step 408 If it is detected that a timeout task is to be executed, acquire a task thread in an idle state.
  • the state of a thread has five states: new, ready, running, blocked, and dead. Specifically, when a thread is created using the new operator, such as new Thread(r), the thread has not yet started running, and the thread is in the new state; a newly created thread does not automatically start running. To execute the thread, it must Call the thread's start() method. When the thread object calls the start() method, the thread is started. The start() method creates the system resource that the thread runs, and the scheduling thread runs the run() method. When the start() method returns.
  • the thread is in the ready state; when the thread gets the CPU time, the thread enters the running state and actually starts to execute the run() method; the blocking state is that the running thread is not running, and the CPU is temporarily released, and the other is in the ready state.
  • the thread can get the CPU time and enter the running state; when the thread's run() method is completed, the thread is dead.
  • the idle state corresponds to a blocked state.
  • Step 410 Perform a timeout task to be executed by using a task thread in an idle state.
  • the idle task thread is used to execute the marked timeout task to be executed.
  • the execution time of the task to be executed is compared with the preset execution time to determine the timeout task in the split task to be executed, and then the execution of the timeout task is terminated, and the timeout task is executed separately, thereby effectively improving the execution of the split task to be executed. effectiveness.
  • the method further includes:
  • Step 502 Detect whether an abnormality occurs in execution of the task thread.
  • the execution of the split task can be monitored periodically by executing a preset database query, such as once an hour.
  • Step 504 If a task thread that has an abnormality is detected, obtain abnormal behavior information of the task thread that has an abnormality, and send the abnormal behavior information to the management terminal.
  • the abnormality information corresponding to the abnormality is obtained, and is sent to the management terminal, so that the management terminal performs subsequent processing on the to-be-executed split task that has an abnormality, such as finding an abnormality through continuous monitoring.
  • the reason thus solving the exception and so on.
  • the method further includes:
  • Step 602 Detect whether there is a batch task to be split in the batch task table.
  • a batch task is a task that can perform bulk data processing and needs to be split.
  • the state of the batch task to be written into the batch task table is determined by reading the state of the batch task; the initial state of the batch task to be written into the batch task table is to be split; when the split method corresponding to the task to be split is obtained, and according to When the split method is split, the status of the batch task is in the split; when the split of the batch is successfully completed and the split task obtained after the split is written into the split table, the batch task The status is split.
  • Step 604 If a batch processing task to be split in the batch task table is detected, obtain a splitting method corresponding to the batch processing task to be split.
  • the splitting method may be split according to the mechanism corresponding to the task (setting the mechanism parameters, such as: the type of operation of the mechanism, that is, running all the institutions, or running part of the mechanism; the running organization identification string, that is, when the operating type of the mechanism is a running part of the mechanism, Give the organization table identifier that needs to be run); it can also be split according to the amount of data corresponding to the task (set the number of split groups, and split according to the default split SQL statement template); Or products, such as the scheduled tasks of fund transactions, may be split according to fund holders or fund products.
  • the mechanism parameters such as: the type of operation of the mechanism, that is, running all the institutions, or running part of the mechanism; the running organization identification string, that is, when the operating type of the mechanism is a running part of the mechanism, Give the organization table identifier that needs to be run
  • it can also be split according to the amount of data corresponding to the task (set the number of split groups, and split according to the default split SQL statement template);
  • step 606 the batch task is split according to the split method.
  • the batch processing task to be split is split according to the splitting method.
  • Step 608 Write the split task obtained after splitting the batch task into the split task table, and set the execution program identifier corresponding to the batch task to the execution program identifier corresponding to each split task.
  • the split task obtained after splitting the batch task is written into the split task table, and the corresponding attribute is set for the split task, including: setting the execution program identifier corresponding to the batch task to the execution corresponding to each split task. Program identification, setting task execution schedule time and task priority.
  • FIGS. 3-6 are sequentially displayed as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these steps is not strictly limited, and the steps may be performed in other orders. Moreover, at least some of the steps in FIGS. 3-6 may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, these sub-steps or stages The order of execution is not necessarily performed sequentially, but may be performed alternately or alternately with at least a portion of other steps or sub-steps or stages of other steps.
  • a task processing apparatus including a split task detection module 702 to be executed, an execution program identifier acquisition module 704, a split task quantity statistics module 706 to be executed, and a task thread.
  • the split task detection module 702 is configured to detect whether a split task is to be executed in the split task table.
  • the execution program identifier obtaining module 704 is configured to obtain an execution program identifier corresponding to each to-be-executed split task if the split task to be executed in the split task table is detected.
  • the split task quantity statistics module 706 is configured to count the number of split tasks to be executed if the execution program identifiers are the same.
  • the task thread creation module 708 is configured to create a task thread corresponding to the to-be-executed split task according to the number of split tasks to be executed and the preset task processing amount corresponding to the split task to be executed.
  • the task thread execution module 710 executes each task thread synchronously.
  • the task thread execution module 710 is further configured to obtain a program name and an operation parameter corresponding to the to-be-executed split task according to the execution program identifier corresponding to the split task to be executed; and execute the program corresponding to the program name according to the running parameter of the split task to be executed.
  • the task thread creation module 708 is further configured to: if the number of the split tasks to be executed is smaller than the preset task processing amount corresponding to the split task to be executed, create a task whose number is the number of split tasks to be executed. The thread is created; and if the number of the split tasks to be executed is greater than or equal to the preset task processing amount corresponding to the split task to be executed, the task thread whose number is the preset task processing quantity is created.
  • the apparatus further includes a task thread detection module 802, a timeout task determination module 804, a timeout task detection module 806, an idle task thread acquisition module 808, and a timeout task execution module 810, where:
  • the task thread detection module 802 is configured to detect whether the task thread is executed when the execution time of the task thread reaches a preset execution time.
  • the timeout task determining module 804 is configured to terminate the execution of the task thread if the execution task thread is detected, and mark the to-be-executed split task corresponding to the execution task thread as the to-be-executed timeout task.
  • the timeout task detection module 806 is configured to detect whether a timeout task is to be executed.
  • the idle task thread obtaining module 808 is configured to acquire a task thread in an idle state if it detects that a timeout task is to be executed.
  • the timeout task execution module 810 is configured to execute a timeout task to be executed by using a task thread in an idle state.
  • the above apparatus further includes an abnormality detecting module 902 and an abnormality information transmitting module 904, wherein:
  • the abnormality detecting module 902 is configured to detect whether an abnormality occurs in execution of the task thread.
  • the abnormality information transmitting module 904 is configured to acquire abnormal behavior information of the task thread in which the abnormality occurs, and send the abnormal behavior information to the management terminal, if the task thread in which the abnormality is detected is detected.
  • the apparatus further includes a batch processing task detecting module 1002, a splitting method obtaining module 1004, a batch processing task splitting module 1006, and a splitting task writing module 1008, wherein:
  • the batch task detection module 1002 is configured to detect whether there is a batch task to be split in the batch task table.
  • the splitting method obtaining module 1004 is configured to obtain a splitting method corresponding to the batch processing task to be split if the batch processing task to be split in the batch processing task table is detected.
  • the batch task splitting module 1006 is configured to split the batch task according to the split method.
  • the split task write module 1008 is configured to write the split task obtained after the split batch task is written into the split task table, and set the execution program identifier corresponding to the batch task to the execution corresponding to each split task. Program identification.
  • Each of the above-described task processing devices may be implemented in whole or in part by software, hardware, and combinations thereof.
  • Each of the above modules may be embedded in or independent of the processor in the computer device, or may be stored in a memory in the computer device in a software form, so that the processor invokes the operations corresponding to the above modules.
  • a computer device comprising a memory and one or more processors having stored therein computer readable instructions, the computer readable instructions being executed by the processor such that the one or more processors perform the following steps:
  • Execute each task thread including:
  • the execution program corresponding to the program name is executed according to the running parameters of the split task to be executed.
  • the step of creating, by the processor, the task thread corresponding to the to-be-executed split task according to the number of the split tasks to be executed and the preset task processing amount corresponding to the split task to be executed including: If the number of the split tasks to be executed is smaller than the number of preset task processes corresponding to the split task to be executed, create a task thread whose number is the number of split tasks to be executed; and if the number of split tasks to be executed is greater than or equal to the number of tasks to be executed If the number of preset tasks processed by the split task is processed, a task thread whose number is the preset number of task processes is created.
  • the processor executes the computer readable instructions
  • the following steps are further performed: when the execution time of the task thread reaches the preset execution time, detecting whether the task thread is executed; if the execution task thread is detected, terminating Execute the task thread, and mark the to-be-executed split task corresponding to the execution task thread as the to-be-executed timeout task; detect whether there is a timeout task to be executed; if the timeout task is to be executed, obtain the task thread in the idle state; and use the idle task The task thread of the state executes the timeout task to be executed.
  • the processor executes the computer readable instructions, the following steps are further performed: detecting whether an execution of the task thread has an abnormality; detecting a task thread in which the abnormality is detected; and acquiring abnormal behavior information of the task thread in which the abnormality occurs And send abnormal behavior information to the management terminal.
  • the processor executes the computer readable instructions, the following steps are further performed: detecting whether there is a batch task to be split in the batch task table; if the batch task to be split in the batch task table is detected, Obtain a split method corresponding to the batch task to be split; split the batch task according to the split method; and write the split task obtained after splitting the batch task into the split task table, and the batch task
  • the corresponding executor identifier is set to the executor identifier corresponding to each split task.
  • One or more non-volatile storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the following steps:
  • Execute each task thread including:
  • the execution program corresponding to the program name is executed according to the running parameters of the split task to be executed.
  • the following steps are further implemented: if the number of split tasks to be executed is smaller than the number of preset task processes corresponding to the split task to be executed, the number of created tasks is to be executed.
  • the following steps are further performed: when the execution time of the task thread reaches a preset execution time, detecting whether the task thread is executed; if the execution task thread is detected, Terminating the execution task thread, and marking the to-be-executed split task corresponding to the execution task thread as the to-be-executed timeout task; detecting whether the timeout task is to be executed; if detecting the pending timeout task, acquiring the task thread in the idle state; The idle task thread executes the timeout task to be executed.
  • the following steps are further performed: detecting whether an execution of the task thread has an abnormality; detecting a task thread in which the exception occurs; and acquiring an abnormal behavior of the task thread in which the exception occurs Information and send abnormal behavior information to the management terminal.
  • the computer readable instructions are further executed by the processor to: detect whether there is a batch task to be split in the batch task table; if the batch task to be split in the batch task table is detected, Obtaining a splitting method corresponding to the batch processing task to be split; splitting the batch processing task according to the splitting method; and writing the splitting task obtained after splitting the batch processing task into the splitting task table, and batch processing
  • the executor ID corresponding to the task is set to the executor ID corresponding to each split task.
  • Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM) or external cache memory.
  • RAM is available in a variety of formats, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronization chain.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDRSDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • Synchlink DRAM SLDRAM
  • Memory Bus Radbus
  • RDRAM Direct RAM
  • DRAM Direct Memory Bus Dynamic RAM
  • RDRAM Memory Bus Dynamic RAM

Abstract

一种任务处理方法,包括:检测拆分任务表中是否有待执行拆分任务;若检测到拆分任务表中有待执行拆分任务,则获取所述待执行拆分任务对应的执行程序标识;若所述执行程序标识均相同,则统计所述待执行拆分任务的数量;根据所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程;同步执行每一个所述任务线程;所述执行每一个所述任务线程,包括:根据所述待执行拆分任务对应的执行程序标识获取所述待执行拆分任务对应的程序名和运行参数;及根据所述待执行拆分任务的运行参数执行所述执行程序名对应的执行程序。

Description

任务处理方法、装置、计算机设备和存储介质
本申请要求于2017年09月05日提交中国专利局,申请号为2017107928486,申请名称为“任务处理方法、装置、存储介质和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及一种任务处理方法、装置、计算机设备和存储介质。
背景技术
在业务系统中,随着业务量的不断增多,原有的一些批处理任务的执行时间变得越来越长,严重影响了任务的执行效率。
传统的任务处理方式通过将不同业务功能的批处理任务进行并行处理来提高任务的执行效率,然而,发明人意识到,随着业务量的增多,同一业务功能的批处理任务的执行时间也越来越长,使得任务的执行效率低下。
发明内容
根据本申请公开的各种实施例,提供一种任务处理方法、装置、计算机设备和存储介质。
一种任务处理方法,包括:
检测拆分任务表中是否有待执行拆分任务;
若检测到拆分任务表中有待执行拆分任务,则获取所述待执行拆分任务对应的执行程序标识;
若所述执行程序标识均相同,则统计所述待执行拆分任务的数量;
根据所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程;
同步执行每一个所述任务线程;
所述执行每一个所述任务线程,包括:
根据所述待执行拆分任务对应的执行程序标识获取所述待执行拆分任务对应的程序名和运行参数;及
根据所述待执行拆分任务的运行参数执行所述执行程序名对应的执行程序。
一种任务处理装置,包括:
待执行拆分任务检测模块,用于检测拆分任务表中是否有待执行拆分任务;
执行程序标识获取模块,用于若检测到拆分任务表中有待执行拆分任务,则获取每一个所述待执行拆分任务对应的执行程序标识;
待执行拆分任务数量统计模块,用于若所述执行程序标识均相同,则统计所述待执行拆分任务的数量;
任务线程创建模块,用于根据所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程。
任务线程执行模块,同步执行每一个所述任务线程;
所述任务线程执行模块,用于根据所述待执行拆分任务对应的执行程序标识获取所述待执行拆分任务对应的程序名和运行参数;及根据所述待执行拆分任务的运行参数执行所述执行程序名对应的执行程序。
一种计算机设备,包括存储器和一个或多个处理器,存储器中存储有计算机可读指令,计算机可读指令被处理器执行时实现本申请任意一个实施例中提供的任务处理方法的步骤。
一个或多个存储有计算机可读指令的非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器实现本申请任意一个实施例中提供的任务处理方法的步骤。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1为根据一个或多个实施例中任务处理方法的应用环境图。
图2为根据一个或多个实施例中计算机设备的框图。
图3为根据一个或多个实施例中任务处理方法的流程图。
图4为根据一个或多个实施例中超时任务处理方法的流程图。
图5为根据一个或多个实施例中异常检测方法的流程图。
图6为根据一个或多个实施例中批处理任务处理方法的流程图。
图7为根据一个或多个实施例中任务处理装置的框图。
图8为根据一个或多个实施例中超时任务处理装置的框图。
图9为根据一个或多个实施例中异常检测装置的框图。
图10为根据一个或多个实施例中批处理任务处理装置的框图。
具体实施方式
为了使本申请的技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供的任务处理方法,可应用于如图1所示的应用环境中。服务器102通过网络与终端104进行通信,服务器102将检测到的发生异常的任务线程的异常行为信息发送给终端104。服务器102检测拆分任务表中是否有待执行拆分任务,若检测到拆分任务表中有待执行拆分任务,则获取每一个待执行拆分任务对应的执行程序标识,若执行程序标识均相同,则统计待执行拆分任务的数量,根据待执行拆分任务的数量和待执行拆分任务对应的预设任务处理数量,创建与待执行拆分任务对应的任务线程;同步执行每一个任务线程,检测任务线程的执行是否发生异常,若检测到发生异常的任务线程;则获取发生异常的任务线程的异常行为信息,并将异常行为信息发送给终端104。终端104由运营管理人员操作,用于对拆分任务的执行进行监控,运营管理人员是具有运营管理权限的用户。服务器102可以用独立的服务器或者是多个服务器组成的服务器集群来实现。终端104可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式穿戴设备。
在其中一个实施例中,提供了一种计算机设备,其内部结构图可以如图2所示,该计算机设备可以是图1中所示的服务器。该计算机设备包括通过系统总线连接的处理器、非易失性存储介质、内存储器和网络连接口。非易失性存储介质可以是非易失性计算机可读存储介质。非易失性存储介质中存储有操作系统和计算机可读指令,该计算机可读指令用于实现本申请实施例中提供的适用于计算机设备的任务处理方法。处理器用于提高计算和控制能力,支撑整个计算机设备的运行。内存储器用于为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。网络接口用于与终端进行网络通信。本领域技术人员可以理解,图2中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的服务器的限定,具体地服务器可以包括 比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在其中一个实施例中,如图3所示,提供了一种任务处理方法,以该方法应用于图1中的服务器为例进行说明,包括以下步骤:
步骤302,检测拆分任务表中是否有待执行拆分任务。
拆分任务表是预先建立的用于存储将满足预设规则的批处理任务进行拆分后得到的拆分任务的数据库表。其中,满足预设规则的批处理任务可以是历史运行时间的平均值大于预设运行时间阈值的批处理任务,也可以是数据量大于预设数据量阈值的批处理任务等。
具体地,检测拆分任务表中是否有待执行拆分任务的实现方式,可以是:获取预先设置的待拆分任务的计划开始时间,将计划开始时间与当前时间对比,若计划开始时间与当前时间相同或计划开始时间早于当前时间,则该拆分任务为待执行拆分任务,也可以是:检测拆分任务表中拆分任务的执行状态,若执行状态为待执行,则该拆分任务为待执行拆分任务,其中,执行状态用于记录拆分任务的执行进度,当在拆分任务表中添加拆分任务时,该拆分任务的执行状态为是待执行;创建任务线程后,开始并行执行拆分任务,此时拆分任务的执行状态是执行中;当拆分任务执行完毕,修改该拆分任务的执行状态为已执行。
步骤304,若检测到拆分任务表中有待执行拆分任务,则获取每一个待执行拆分任务对应的执行程序标识。
执行程序是用于执行拆分任务的程序代码;执行程序标识用于唯一标识执行拆分任务对应的程序代码。
步骤306,若执行程序标识均相同,则统计待执行拆分任务的数量。
若待执行拆分任对应的执行程序标识均相同,则说明待执行拆分任务是由同一个批处理任务拆分而来的。统计待执行拆分任务的数量,用于后续的创建并行任务线程。
步骤308,根据待执行拆分任务的数量和待执行拆分任务对应的预设任务处理数量,创建与待执行拆分任务对应的任务线程。
待执行拆分任务对应的预设任务处理数量是预先设置的与待拆分任务对应的业务模块允许执行的最大任务数量值,如待执行拆分任务为上海机构的制证任务,则其对应的业务模块为制证模块,制证模块根据其数据量设置允许执行的最大任务数量值为7。
根据待执行拆分任务的数量和待执行拆分任务对应的预设任务处理数量, 创建与待执行拆分任务对应的任务线程,包括:若待执行拆分任务的数量小于待执行拆分任务对应的预设任务处理数量,则创建数量为待执行拆分任务的数量的任务线程;若待执行拆分任务的数量大于或等于待执行拆分任务对应的预设任务处理数量,则创建数量为预设任务处理数量的任务线程。例如,若拆分任务表中具有相同程序执行标识的待拆分任务的个数有14个,该待拆分任务的预设任务处理数量是7个,则创建7个任务线程,每个任务线程串行执行2个拆分任务。
在其中一个实施例中,若待执行拆分任对应的执行程序标识不相同,则根据执行程序标识将待拆分执行任务进行分类,统计每一类待执行任务的数量,再分别获取每一类待拆分任务对应的预设任务处理数量,根据每一类待执行任务的数量和预设任务处理数量创建任务线程。例如,检测到拆分任务表中当前需要执行的拆分任务有a1,a2,a3,b1,b2,c1,c2和c3。其中,a1,a2和a3具有相同的执行程序标识,属于同一类型(类型a)的待执行拆分任务;b1和b2具有相同的执行程序标识,属于同一类型(类型b)的待执行拆分任务;c1,c2和c3具有相同的执行任务标识,属于同一类型(类型c)的待执行拆分任务。又,具有相同执行程序标识的待拆分任务对应于同一个业务模块,如类型a对应的业务模块允许执行的最大任务数量值是2,类型b对应的业务模块允许执行的最大任务数量值是3,类型a对应的业务模块允许执行的最大任务数量值是4,则创建7个任务线程,其中两个任务线程对应于类型a的待执行任务(如a1和a2对应于同一任务线程1,a3对应于任务线程2),两个任务线程对应于类型b的待执行任务(b1对应于任务线程3,b2对应于任务线程4),剩下的三个任务线程对应于类型c的待执行任务(c1对应于任务线程5,c2对应于任务线程6,c2对应于任务线程7)。
步骤310,同步执行每一个任务线程。
在创建了与每一个待执行拆分任务对应的任务线程之后,并行执行每一个任务线程,以提高待拆分执行任务对应的批处理任务串行处理数据导致耗时久,影响任务执行效率。
执行每一个任务线程的步骤包括:
步骤3102,根据待执行拆分任务对应的执行程序标识获取待执行拆分任务对应的程序名和运行参数。
将批处理任务按照与之对应预设拆分方法拆分成拆分任务并保存拆分任务信息后,还需要设置拆分任务对应的执行程序信息。其中拆分任务信息包括拆 分任务对应的执行程序标识,拆分任务标识和计划开始时间等;执行程序信息包括执行程序标识,执行程序名以及运行参数等。
步骤3104,根据待执行拆分任务的运行参数执行执行程序名对应的执行程序。
可通过待执行拆分任务对应的执行程序名和运行参数,来调用待执行拆分任务对应的执行程序,从而实现待执行拆分任务的执行。如“gbs_blacklist(region_code)”,gbs_blacklist是理赔案件黑名单识别任务对应的程序名,region_cod是运行参数,表示理赔案件所属机构。
上述任务处理方法中,由于获取到的待执行拆分任务对应的执行程序标识均相同,则说明待执行拆分任务是由同一个批处理任务拆分而来的,再将这些待执行拆分任务进行并行执行,有效提高了批处理任务的执行效率;同时并行执行的任务线程是根据待执行拆分任务的数量和待执行拆分任务对应的预设任务处理数量确定的,进一步提高了批处理任务的执行效率。
在其中一个实施例中,如图4所示,在步骤310之后,还包括:
步骤402,当任务线程的执行时间达到预设执行时长时,检测是否有执行任务线程。
预设执行时长是预先设置的待拆分任务对应的执行程序所允许执行的最长时间值,例如5小时;执行任务线程是指处于运行状态的任务线程。
步骤404,若检测到有执行任务线程,则终止执行任务线程,并标记执行任务线程对应的待执行拆分任务为待执行超时任务。
根据预设执行时长确定待执行拆分任务中的超时任务,再终止超时任务的执行,将超时任务单独执行,有效提高了待执行拆分任务的执行效率。
步骤406,检测是否有待执行超时任务。
在完成待执行拆分任务的其他非超时任务顺利执行后,对待执行拆分任务中的超时任务进行单独处理。
步骤408,若检测到有待执行超时任务,则获取处于空闲状态的任务线程。
线程的状态有新建、就绪、运行、阻塞和死亡五种状态。具体地,当使用new操作符创建一个线程时,例如new Thread(r),线程还没有开始运行,此时线程处在新建状态;一个新创建的线程并不自动开始运行,要执行线程,必须调用线程的start()方法,当线程对象调用start()方法时,即启动了线程,start()方法创建线程运行的系统资源,并调度线程运行run()方法,当start()方法返回后,线程就处于就绪状态;当线程获得CPU时间后,线程进入运行状态,真正开始 执行run()方法;阻塞状态是正在运行的线程没有运行结束,暂时让出CPU,这时其他处于就绪状态的线程就可以获得CPU时间,进入运行状态;当线程的run()方法完成时,则线程为死亡态。本实施例中,空闲状态对应于阻塞状态。
步骤410,利用处于空闲状态的任务线程执行待执行超时任务。
在成功获取到空闲任务线程后,利用该空闲任务线程执行被标记的待执行超时任务。通过将待执行任务的执行时间和预设执行时长进行对比,确定待执行拆分任务中的超时任务,再终止超时任务的执行,将超时任务单独执行,有效提高了待执行拆分任务的执行效率。
在其中一个实施例中,如图5所示,在步骤310之后,还包括:
步骤502,检测任务线程的执行是否发生异常。
可通过执行预设数据库查询语句,对待执行拆分任务的执行情况进行定期监控,如每小时一次。
步骤504,若检测到发生异常的任务线程;则获取发生异常的任务线程的异常行为信息,并将异常行为信息发送给管理终端。
当检测到待执行拆分任务发生异常时,获取该异常对应的异常信息,并发送给管理终端,以使管理终端对发生异常的待执行拆分任务进行后续处理,如通过持续监控找出异常原因,从而解决异常等。通过对待执行拆分任务的执行过程进行监控,从而减少了执行待拆分任务所带来的事件风险,提高了待拆分任务执行的效率。
在其中一个实施例中,如图6所示,在步骤302之前,还包括:
步骤602,检测批处理任务表中是否有待拆分批处理任务。
批处理任务是可进行批量数据处理且需要拆分的任务。本实施例中,可通过读取批处理任务的状态来确定,写入批处理任务表的批处理任务的初始状态为待拆分;当获取与待拆分任务对应的拆分方法,并按照该拆分方法进行拆分时,批处理任务的状态为拆分中;当成功完成批处理的拆分并将拆分后的得到的拆分任务写入拆分任表时,批处理任务的状态为已拆分。
步骤604,若检测到批处理任务表中有待拆分批处理任务,则获取与待拆分批处理任务对应的拆分方法。
拆分方法可以是按照任务对应的机构进行拆分(设置机构参数,如:机构运行类型,即运行全部机构,还是运行部分机构;运行的机构标识串,即机构运行类型为运行部分机构时,给出需要运行的机构表标识);也可以是按照任务对应的数据量进行拆分(设置拆分组数,并按照预设拆分SQL语句模板进行拆 分);还可以按照任务对应的客户或产品,如基金交易的定时任务,可按照基金持有人或基金产品进行拆分等。
步骤606,按照拆分方法拆分批处理任务。
在获取了与待拆分批处理任务对应的拆分方法后,按照该拆分方法对该待拆分批处理任务进行拆分。
步骤608,将拆分批处理任务后得到的拆分任务写入拆分任务表中,并将批处理任务对应的执行程序标识设置为每一个拆分任务对应的执行程序标识。
将拆分批处理任务后得到的拆分任务写入拆分任务表中,并对拆分任务设置相应属性,包括:将批处理任务对应的执行程序标识设置为每一个拆分任务对应的执行程序标识,设置任务执行计划时间和任务优先级等。通过对批处理任务进行拆分,为后续同一个批处理任务对应的拆分任务的并行处理提供了先决条件。
应该理解的是,虽然图3-6的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图3-6中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。
在其中一个实施例中,如图7所示,提供了一种任务处理装置,包括待执行拆分任务检测模块702、执行程序标识获取模块704、待执行拆分任务数量统计模块706、任务线程创建模块708和任务线程执行模块710,其中:
待执行拆分任务检测模块702,用于检测拆分任务表中是否有待执行拆分任务。
执行程序标识获取模块704,用于若检测到拆分任务表中有待执行拆分任务,则获取每一个待执行拆分任务对应的执行程序标识。
待执行拆分任务数量统计模块706,用于若执行程序标识均相同,则统计待执行拆分任务的数量。
任务线程创建模块708,用于根据待执行拆分任务的数量和待执行拆分任务对应的预设任务处理数量,创建与待执行拆分任务对应的任务线程。及
任务线程执行模块710,同步执行每一个任务线程。任务线程执行模块710还用于根据待执行拆分任务对应的执行程序标识获取待执行拆分任务对应的程 序名和运行参数;根据待执行拆分任务的运行参数执行程序名对应的执行程序。
在其中一个实施例中,任务线程创建模块708还用于若待执行拆分任务的数量小于待执行拆分任务对应的预设任务处理数量,则创建数量为待执行拆分任务的数量的任务线程;及若待执行拆分任务的数量大于或等于待执行拆分任务对应的预设任务处理数量,则创建数量为预设任务处理数量的任务线程。
在其中一个实施例中,如图8所示,上述装置还包括任务线程检测模块802、超时任务确定模块804、超时任务检测模块806、空闲任务线程获取模块808和超时任务执行模块810,其中:
任务线程检测模块802,用于当任务线程的执行时间达到预设执行时长时,检测是否有执行任务线程。
超时任务确定模块804,用于若检测到有执行任务线程,则终止执行任务线程,并标记执行任务线程对应的待执行拆分任务为待执行超时任务。
超时任务检测模块806,用于检测是否有待执行超时任务。
空闲任务线程获取模块808,用于若检测到有待执行超时任务,则获取处于空闲状态的任务线程。及
超时任务执行模块810,用于利用处于空闲状态的任务线程执行待执行超时任务。
在其中一个实施例中,如图9所示,上述装置还包括异常检测模块902和异常信息发送模块904,其中:
异常检测模块902,用于检测任务线程的执行是否发生异常。
异常信息发送模块904,用于若检测到发生异常的任务线程,则获取发生异常的任务线程的异常行为信息,并将异常行为信息发送给管理终端。
在其中一个实施例中,如图10所示,上述装置还包括批处理任务检测模块1002、拆分方法获取模块1004、批处理任务拆分模块1006和拆分任务写入模块1008,其中:
批处理任务检测模块1002,用于检测批处理任务表中是否有待拆分批处理任务。
拆分方法获取模块1004,用于若检测到批处理任务表中待拆分批处理任务,则获取与待拆分批处理任务对应的拆分方法。
批处理任务拆分模块1006,用于按照拆分方法拆分批处理任务。
拆分任务写入模块1008,用于将拆分批处理任务后得到的拆分任务写入拆分任务表中,并将批处理任务对应的执行程序标识设置为每一个拆分任务对应 的执行程序标识。
关于任务处理装置的具体限定可以参见上文中对于任务处理方法的限定,在此不再赘述。上述任务处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
一种计算机设备,包括存储器和一个或多个处理器,存储器中储存有计算机可读指令,计算机可读指令被处理器执行时,使得一个或多个处理器执行以下步骤:
检测拆分任务表中是否有待执行拆分任务;
若检测到拆分任务表中有待执行拆分任务,则获取每一个待执行拆分任务对应的执行程序标识;
若执行程序标识均相同,则统计待执行拆分任务的数量;
根据待执行拆分任务的数量和待执行拆分任务对应的预设任务处理数量,创建与待执行拆分任务对应的任务线程;
同步执行每一个任务线程;
执行每一个任务线程,包括:
根据待执行拆分任务对应的执行程序标识获取待执行拆分任务对应的程序名和运行参数;及
根据待执行拆分任务的运行参数执行程序名对应的执行程序。
在其中一个实施例中,处理器执行的根据待执行拆分任务的数量和待执行拆分任务对应的预设任务处理数量,创建与待执行拆分任务对应的任务线程的步骤,包括:若待执行拆分任务的数量小于待执行拆分任务对应的预设任务处理数量,则创建数量为待执行拆分任务的数量的任务线程;及若待执行拆分任务的数量大于或等于待执行拆分任务对应的预设任务处理数量,则创建数量为预设任务处理数量的任务线程。
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:当任务线程的执行时间达到预设执行时长时,检测是否有执行任务线程;若检测到有执行任务线程,则终止执行任务线程,并标记执行任务线程对应的待执行拆分任务为待执行超时任务;检测是否有待执行超时任务;若检测到有待执行超时任务,则获取处于空闲状态的任务线程;及利用处于空闲状态的任务线程执行待执行超时任务。
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:检测任务线程的执行是否发生异常;若检测到发生异常的任务线程;及则获取发生异常的任务线程的异常行为信息,并将异常行为信息发送给管理终端。
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:检测批处理任务表中是否有待拆分批处理任务;若检测到批处理任务表中待拆分批处理任务,则获取与待拆分批处理任务对应的拆分方法;按照拆分方法拆分批处理任务;及将拆分批处理任务后得到的拆分任务写入拆分任务表中,并将批处理任务对应的执行程序标识设置为每一个拆分任务对应的执行程序标识。
一个或多个存储有计算机可读指令的非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
检测拆分任务表中是否有待执行拆分任务;
若检测到拆分任务表中有待执行拆分任务,则获取每一个待执行拆分任务对应的执行程序标识;
若执行程序标识均相同,则统计待执行拆分任务的数量;
根据待执行拆分任务的数量和待执行拆分任务对应的预设任务处理数量,创建与待执行拆分任务对应的任务线程;
同步执行每一个任务线程;
执行每一个任务线程,包括:
根据待执行拆分任务对应的执行程序标识获取待执行拆分任务对应的程序名和运行参数;及
根据待执行拆分任务的运行参数执行程序名对应的执行程序。
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:若待执行拆分任务的数量小于待执行拆分任务对应的预设任务处理数量,则创建数量为待执行拆分任务的数量的任务线程;及若待执行拆分任务的数量大于或等于待执行拆分任务对应的预设任务处理数量,则创建数量为预设任务处理数量的任务线程。
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:当任务线程的执行时间达到预设执行时长时,检测是否有执行任务线程;若检测到有执行任务线程,则终止执行任务线程,并标记执行任务线程对应的待执行拆分任务为待执行超时任务;检测是否有待执行超时任务;若检测到有待执行超时任务,则获取处于空闲状态的任务线程;及利用处于空闲状态的任务线程执行待执行超时任务。
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:检测任务线程的执行是否发生异常;若检测到发生异常的任务线程;及则获取发生异常的任务线程的异常行为信息,并将异常行为信息发送给管理终端。
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:检测批处理任务表中是否有待拆分批处理任务;若检测到批处理任务表中待拆分批处理任务,则获取与待拆分批处理任务对应的拆分方法;按照拆分方法拆分批处理任务;及将拆分批处理任务后得到的拆分任务写入拆分任务表中,并将批处理任务对应的执行程序标识设置为每一个拆分任务对应的执行程序标识。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种任务处理方法,包括:
    检测拆分任务表中是否有待执行拆分任务;
    若检测到拆分任务表中有待执行拆分任务,则获取所述待执行拆分任务对应的执行程序标识;
    若所述执行程序标识均相同,则统计所述待执行拆分任务的数量;
    根据所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程;
    同步执行每一个所述任务线程;
    所述执行每一个所述任务线程,包括:
    根据所述待执行拆分任务对应的执行程序标识获取所述待执行拆分任务对应的程序名和运行参数;及
    根据所述待执行拆分任务的运行参数执行所述执行程序名对应的执行程序。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程,包括:
    若所述待执行拆分任务的数量小于所述待执行拆分任务对应的预设任务处理数量,则创建数量为所述待执行拆分任务的数量的任务线程;及
    若所述待执行拆分任务的数量大于或等于所述待执行拆分任务对应的预设任务处理数量,则创建数量为所述预设任务处理数量的任务线程。
  3. 根据权利要求1所述的方法,其特征在于,在所述同步执行每一个所述任务线程之后,还包括:
    当所述任务线程的执行时间达到预设执行时长时,检测是否有执行任务线程;
    若检测到有执行任务线程,则终止所述执行任务线程,并标记所述执行任务线程对应的待执行拆分任务为待执行超时任务;
    检测是否有待执行超时任务;
    若检测到有待执行超时任务,则获取处于空闲状态的任务线程;及
    利用所述处于空闲状态的任务线程执行所述待执行超时任务。
  4. 根据权利要求1所述的方法,其特征在于,在所述同步执行每一个所述任务线程之后,还包括:
    检测所述任务线程的执行是否发生异常;及
    若检测到发生异常的任务线程;则获取所述发生异常的任务线程的异常行为信息,并将所述异常行为信息发送给管理终端。
  5. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    检测批处理任务表中是否有待拆分批处理任务;
    若检测到批处理任务表中待拆分批处理任务,则获取与所述待拆分批处理任务对应的拆分方法;
    按照所述拆分方法拆分所述批处理任务;及
    将拆分所述批处理任务后得到的拆分任务写入所述拆分任务表中,并将所述批处理任务对应的执行程序标识设置为每一个所述拆分任务对应的执行程序标识。
  6. 一种任务处理装置,包括:
    待执行拆分任务检测模块,用于检测拆分任务表中是否有待执行拆分任务;
    执行程序标识获取模块,用于若检测到拆分任务表中有待执行拆分任务,则获取每一个所述待执行拆分任务对应的执行程序标识;
    待执行拆分任务数量统计模块,用于若所述执行程序标识均相同,则统计所述待执行拆分任务的数量;
    任务线程创建模块,用于根据所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程;
    任务线程执行模块,同步执行每一个所述任务线程;
    所述任务线程执行模块还用于根据所述待执行拆分任务对应的执行程序标识获取所述待执行拆分任务对应的程序名和运行参数;及根据所述待执行拆分任务的运行参数执行所述执行程序名对应的执行程序。
  7. 根据权利要求6所述的批处理任务处理装置,其特征在于,所述任务线程创建模块还用于若所述待执行拆分任务的数量小于所述待执行拆分任务对应的预设任务处理数量,则创建数量为所述待执行拆分任务的数量的任务线程;及若所述待执行拆分任务的数量大于或等于所述待执行拆分任务对应的预设任务处理数量,则创建数量为所述预设任务处理数量的任务线程。
  8. 根据权利要求6所述的装置,其特征在于,所述装置还包括:
    任务线程检测模块,用于当所述任务线程的执行时间达到预设执行时长时,检测是否有执行任务线程;
    超时任务确定模块,用于若检测到有执行任务线程,则终止所述执行任务 线程,并标记所述执行任务线程对应的待执行拆分任务为待执行超时任务;
    超时任务检测模块,用于检测是否有待执行超时任务;
    空闲任务线程获取模块,用于若检测到有待执行超时任务,则获取处于空闲状态的任务线程;及
    超时任务执行模块,用于利用所述处于空闲状态的任务线程执行所述待执行超时任务。
  9. 根据权利要求6所述的装置,其特征在于,所述装置还包括:
    异常检测模块,用于检测所述任务线程的执行是否发生异常;及
    异常信息发送模块,用于若检测到发生异常的任务线程;则获取所述发生异常的任务线程的异常行为信息,并将所述异常行为信息发送给管理终端。
  10. 根据权利要求6所述的装置,其特征在于,所述装置还包括:
    批处理任务检测模块,用于检测批处理任务表中是否有待拆分批处理任务;
    拆分方法获取模块,用于若检测到批处理任务表中待拆分批处理任务,则获取与所述待拆分批处理任务对应的拆分方法;
    批处理任务拆分模块,用于按照所述拆分方法拆分所述批处理任务;及
    拆分任务写入模块,用于将拆分所述批处理任务后得到的拆分任务写入拆分任务表中,并将所述批处理任务对应的执行程序标识设置为每一个所述拆分任务对应的执行程序标识。
  11. 一种计算机设备,包括存储器及一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:
    检测拆分任务表中是否有待执行拆分任务;
    若检测到拆分任务表中有待执行拆分任务,则获取所述待执行拆分任务对应的执行程序标识;
    若所述执行程序标识均相同,则统计所述待执行拆分任务的数量;
    根据所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程;
    同步执行每一个所述任务线程;
    所述执行每一个所述任务线程,包括:
    根据所述待执行拆分任务对应的执行程序标识获取所述待执行拆分任务对应的程序名和运行参数;及
    根据所述待执行拆分任务的运行参数执行所述执行程序名对应的执行程 序。
  12. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程的步骤,包括:
    若所述待执行拆分任务的数量小于所述待执行拆分任务对应的预设任务处理数量,则创建数量为所述待执行拆分任务的数量的任务线程;及
    若所述待执行拆分任务的数量大于或等于所述待执行拆分任务对应的预设任务处理数量,则创建数量为所述预设任务处理数量的任务线程。
  13. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:
    当所述任务线程的执行时间达到预设执行时长时,检测是否有执行任务线程;
    若检测到有执行任务线程,则终止所述执行任务线程,并标记所述执行任务线程对应的待执行拆分任务为待执行超时任务;
    检测是否有待执行超时任务;
    若检测到有待执行超时任务,则获取处于空闲状态的任务线程;及
    利用所述处于空闲状态的任务线程执行所述待执行超时任务。
  14. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:
    检测所述任务线程的执行是否发生异常;及
    若检测到发生异常的任务线程;则获取所述发生异常的任务线程的异常行为信息,并将所述异常行为信息发送给管理终端。
  15. 根据权利要求10所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时还执行以下步骤:
    检测批处理任务表中是否有待拆分批处理任务;
    若检测到批处理任务表中待拆分批处理任务,则获取与所述待拆分批处理任务对应的拆分方法;
    按照所述拆分方法拆分所述批处理任务;及
    将拆分所述批处理任务后得到的拆分任务写入所述拆分任务表中,并将所述批处理任务对应的执行程序标识设置为每一个所述拆分任务对应的执行程序标识。
  16. 一个或多个存储有计算机可读指令的非易失性计算机可读存储介质, 所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:
    检测拆分任务表中是否有待执行拆分任务;
    若检测到拆分任务表中有待执行拆分任务,则获取所述待执行拆分任务对应的执行程序标识;
    若所述执行程序标识均相同,则统计所述待执行拆分任务的数量;
    根据所述待执行拆分任务的数量和所述待执行拆分任务对应的预设任务处理数量,创建与所述待执行拆分任务对应的任务线程;
    同步执行每一个所述任务线程;
    所述执行每一个所述任务线程,包括:
    根据所述待执行拆分任务对应的执行程序标识获取所述待执行拆分任务对应的程序名和运行参数;及
    根据所述待执行拆分任务的运行参数执行所述执行程序名对应的执行程序。
  17. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    若所述待执行拆分任务的数量小于所述待执行拆分任务对应的预设任务处理数量,则创建数量为所述待执行拆分任务的数量的任务线程;及
    若所述待执行拆分任务的数量大于或等于所述待执行拆分任务对应的预设任务处理数量,则创建数量为所述预设任务处理数量的任务线程。
  18. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    当所述任务线程的执行时间达到预设执行时长时,检测是否有执行任务线程;
    若检测到有执行任务线程,则终止所述执行任务线程,并标记所述执行任务线程对应的待执行拆分任务为待执行超时任务;
    检测是否有待执行超时任务;
    若检测到有待执行超时任务,则获取处于空闲状态的任务线程;及
    利用所述处于空闲状态的任务线程执行所述待执行超时任务。
  19. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    检测所述任务线程的执行是否发生异常;及
    若检测到发生异常的任务线程;则获取所述发生异常的任务线程的异常行为信息,并将所述异常行为信息发送给管理终端。
  20. 根据权利要求16所述的存储介质,其特征在于,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    检测批处理任务表中是否有待拆分批处理任务;
    若检测到批处理任务表中待拆分批处理任务,则获取与所述待拆分批处理任务对应的拆分方法;
    按照所述拆分方法拆分所述批处理任务;及
    将拆分所述批处理任务后得到的拆分任务写入所述拆分任务表中,并将所述批处理任务对应的执行程序标识设置为每一个所述拆分任务对应的执行程序标识。
PCT/CN2018/088617 2017-09-05 2018-05-28 任务处理方法、装置、计算机设备和存储介质 WO2019047565A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710792848.6 2017-09-05
CN201710792848.6A CN107783829B (zh) 2017-09-05 2017-09-05 任务处理方法、装置、存储介质和计算机设备

Publications (1)

Publication Number Publication Date
WO2019047565A1 true WO2019047565A1 (zh) 2019-03-14

Family

ID=61437827

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/088617 WO2019047565A1 (zh) 2017-09-05 2018-05-28 任务处理方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN107783829B (zh)
WO (1) WO2019047565A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107783829B (zh) * 2017-09-05 2020-04-24 平安科技(深圳)有限公司 任务处理方法、装置、存储介质和计算机设备
CN109725996B (zh) * 2018-06-15 2023-07-21 中国平安人寿保险股份有限公司 任务模式选择与任务执行方法、装置、设备及存储介质
CN109120679B (zh) * 2018-07-27 2021-09-28 平安科技(深圳)有限公司 任务分配方法及装置
CN109254768B (zh) * 2018-08-16 2024-04-12 中国平安人寿保险股份有限公司 制证信息的获取方法、终端设备及介质
CN109670932B (zh) * 2018-09-25 2024-02-20 平安科技(深圳)有限公司 信贷数据核算方法、装置、系统和计算机存储介质
CN109658043A (zh) * 2018-10-16 2019-04-19 深圳壹账通智能科技有限公司 催收数据处理方法、装置、设备和存储介质
CN110162392B (zh) * 2019-05-29 2022-10-25 北京达佳互联信息技术有限公司 周期性任务的执行方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103279331A (zh) * 2013-05-31 2013-09-04 中国电子科技集团公司第十五研究所 Android系统多任务并发处理方法及装置
CN103810048A (zh) * 2014-03-11 2014-05-21 国家电网公司 一种面向资源利用最优的线程数量自动调整方法及装置
CN105718243A (zh) * 2014-12-01 2016-06-29 金蝶软件(中国)有限公司 Erp系统中数据批量操作的方法和系统
CN107783829A (zh) * 2017-09-05 2018-03-09 平安科技(深圳)有限公司 任务处理方法、装置、存储介质和计算机设备

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106897203A (zh) * 2017-03-29 2017-06-27 北京经纬恒润科技有限公司 一种cpu负载率计算方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103279331A (zh) * 2013-05-31 2013-09-04 中国电子科技集团公司第十五研究所 Android系统多任务并发处理方法及装置
CN103810048A (zh) * 2014-03-11 2014-05-21 国家电网公司 一种面向资源利用最优的线程数量自动调整方法及装置
CN105718243A (zh) * 2014-12-01 2016-06-29 金蝶软件(中国)有限公司 Erp系统中数据批量操作的方法和系统
CN107783829A (zh) * 2017-09-05 2018-03-09 平安科技(深圳)有限公司 任务处理方法、装置、存储介质和计算机设备

Also Published As

Publication number Publication date
CN107783829B (zh) 2020-04-24
CN107783829A (zh) 2018-03-09

Similar Documents

Publication Publication Date Title
WO2019047565A1 (zh) 任务处理方法、装置、计算机设备和存储介质
US10073683B2 (en) System and method for providing software build violation detection and self-healing
US10430332B2 (en) System and method for performance tuning of garbage collection algorithms
EP2557503B1 (en) Application performance measurement and reporting
WO2019041914A1 (zh) 任务时效预警方法、装置、计算机设备和存储介质
CN109992350B (zh) 云计算系统的资源池中虚拟机的迁移方法及装置
WO2019148727A1 (zh) 电子装置、基于redis的异常预警方法及存储介质
CN102200941A (zh) 进程状态监控方法及单元
US9838332B1 (en) Dynamically meeting slas without provisioning static capacity
WO2021174696A1 (zh) 数据更新方法、装置、计算机设备及存储介质
CN109324959B (zh) 一种自动转移数据的方法、服务器及计算机可读存储介质
WO2019148728A1 (zh) 电子装置、分布式系统执行任务分配方法及存储介质
WO2021082104A1 (zh) 数据迁移方法、装置、计算机设备和存储介质
CN109634802B (zh) 进程监控方法及终端设备
CN108763046B (zh) 线程运行监控方法、装置、计算机设备和存储介质
CN110765162A (zh) 数据比对方法、装置、计算机设备和存储介质
US10248544B2 (en) System and method for automatic root cause detection
CN111190753A (zh) 分布式任务处理方法、装置、存储介质和计算机设备
WO2019210578A1 (zh) Cognos进程的监控方法、装置、计算机设备和存储介质
CN112202628A (zh) 一种WiFi模块串口协议自动化测试系统及方法
WO2020253045A1 (zh) 配置化的数据转发异常补处理方法、装置及可读存储介质
CN104780062A (zh) 一种快速获取bmc管理网口ip地址的方法
WO2017157111A1 (zh) 防止内存数据丢失的的方法、装置和系统
US11782753B2 (en) Node-local-unscheduler for scheduling remediation
CN114201511A (zh) 一种项目管控的方法、装置、计算机设备和存储介质

Legal Events

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

Ref document number: 18853102

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

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

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 28/09/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18853102

Country of ref document: EP

Kind code of ref document: A1