Distributed timed task execution method and system, electronic equipment and storage medium

By building a timing task switch management unit and automated configuration, the problem that the existing distributed timing task framework cannot respond to business needs in real time is solved, dynamic management and scheduling of tasks is realized, and the flexibility and user experience of the system are improved.

CN120492115APending Publication Date: 2025-08-15BEIJING ANZHENGTONG INFORMATION TECH HLDG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510568543.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing distributed timing task framework highly relies on manual operation and cannot perceive the dynamic changes of the business system in real time, resulting in time lag in task scheduling and actual business needs, affecting system flexibility and response speed.

Method used

Build a timing task switch management unit, configure dynamic real-time switch status through automated means, generate and send timing task parameters to a distributed timing execution task framework, and encapsulate the framework to realize dynamic management and scheduling of tasks.

Benefits of technology

It realizes close and flexible integration between the business system and the distributed timed execution task framework, reduces the risk of human error, improves the stability and reliability of the system, can quickly respond to business changes and user needs, and simplifies the integration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492115A_ABST
    Figure CN120492115A_ABST
Patent Text Reader

Abstract

The invention provides a distributed timed task execution method and system, electronic equipment and a storage medium, and relates to the technical field of computers.The method comprises the steps that a timed task switch management unit is constructed according to service requirements, and the timed task switch management unit is used for setting the execution state of a timed task; a dynamic real-time switch state is configured according to the timed task switch management unit; obtaining timed task parameters according to the dynamic real-time on-off state, and sending the timed task parameters to a distributed timed execution task framework; and packaging the distributed timed task execution framework and the timed task parameters, and executing a timed task according to the timed task parameters. Through technical innovation and secondary packaging, closer and more flexible integration between the service system and the distributed timed task execution framework is achieved, interaction between the service system and the distributed timed task execution framework is more efficient and accurate through dynamic connection, timed tasks are allowed to be dynamically opened and closed in real time in the service system, and user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a distributed timed task execution method, system, electronic device and storage medium. Background Art

[0002] Amidst the accelerating digital transformation, distributed system architectures have become the mainstream paradigm for enterprise application deployment. As a key component of this distributed architecture, distributed scheduled task frameworks play an irreplaceable role in timing business logic triggering and coordinating system resources. Current mainstream distributed scheduled task frameworks, including Quartz, Elastic-Job, and XXL-JOB, all utilize an architecture designed with independent backend management systems. However, as enterprise business complexity continues to increase, the limitations of this traditional model in practical applications are becoming increasingly apparent.

[0003] Under the existing framework, when adding a new business task, users must follow a standardized process: first, manually log in to the backend management system; second, access the designated task management interface; third, fill in the task information one by one according to the pre-set form fields, including key configuration parameters such as the execution time and the target business system interface address; and finally, click the action button to start the task. Notably, users must repeat this entire process to terminate the task. However, the operational status and needs of business systems are highly dynamic: during peak business periods, task execution frequency may need to be temporarily increased; during system maintenance, tasks may need to be suspended. Existing distributed scheduled task frameworks rely heavily on manual backend management, failing to perceive dynamic changes in the business system in real time. This results in a significant time lag between task scheduling and actual business needs. This lag not only reduces system flexibility and responsiveness but also potentially adversely impacts the normal operation of the business. Therefore, optimizing the tedious manual operation process and achieving real-time integration with business systems has become a critical issue that needs to be addressed. Summary of the Invention

[0004] In view of the above-mentioned deficiencies in the prior art, the present invention provides a distributed scheduled task execution method, system, electronic device and storage medium, which effectively solves the problem that the existing distributed scheduled task framework is highly dependent on manual operation processes, resulting in the inability to connect scheduled tasks with actual business needs in real time.

[0005] In a first aspect, the present invention provides a distributed scheduled task execution method, the method comprising:

[0006] Construct a scheduled task switch management unit according to business needs, which is used to set the execution status of the scheduled task;

[0007] Configuring a dynamic real-time switch state according to the timed task switch management unit;

[0008] Acquire scheduled task parameters according to the dynamic real-time switch state, and send the scheduled task parameters to a distributed scheduled task execution framework;

[0009] The distributed scheduled task execution framework and the scheduled task parameters are encapsulated, and the scheduled task is executed according to the scheduled task parameters.

[0010] In an optional implementation manner, the step of constructing a scheduled task switch management unit according to business requirements includes:

[0011] Determine the target development framework based on the business requirements and configure the target database;

[0012] Build a front-end interface based on the target development framework and set a back-end API interface based on the target database;

[0013] The front-end interface and the back-end API interface are integrated to obtain the scheduled task switch management unit.

[0014] In an optional embodiment, configuring the dynamic real-time switch state according to the scheduled task switch management unit includes:

[0015] Setting a switch component according to the front-end framework of the timed task switch unit and binding a state variable to the switch component;

[0016] Add an event listener to the switch component and set a state update function;

[0017] Send an API request to the backend server according to the status update function;

[0018] Verify the API request, update the database status, and push the switch status update message to the front end through the communication protocol;

[0019] The state of the switch component is updated according to the switch state update message.

[0020] In an optional embodiment, obtaining a scheduled task parameter according to the dynamic real-time switch state and sending the scheduled task parameter to a distributed scheduled task execution framework includes:

[0021] generating service parameters according to the dynamic real-time switch state;

[0022] Convert the business parameters into a target format recognizable by the distributed scheduled execution task framework to obtain a parameter file;

[0023] Obtain the registration address of the distributed scheduled task execution framework, and call the framework interface according to the registration address;

[0024] The parameter file is sent to the distributed scheduled task execution framework according to the framework interface.

[0025] In an optional embodiment, after sending the scheduled task parameters to the distributed scheduled task execution framework, the method further includes:

[0026] Determine the status of the scheduled task according to the parameter file and perform status and time verification;

[0027] If the verification is passed, the status synchronization is performed and the synchronization result is returned to the scheduled task switch management unit.

[0028] In an optional implementation, encapsulating the distributed scheduled task execution framework and the scheduled task parameters, and executing the scheduled task according to the scheduled task parameters, includes:

[0029] Decoupling the source code of the distributed scheduled execution task framework to obtain a task framework entity;

[0030] Setting the interface layer of the task framework entity and defining the calling logic of the interface layer;

[0031] Create a client according to the calling logic and set the dynamic task scheduling logic;

[0032] The scheduled task is executed according to the scheduled task parameters and the dynamic task scheduling logic.

[0033] In an optional embodiment, the method further comprises:

[0034] Perform source code transformation on the multiple distributed timed execution task frameworks to obtain microservice programs;

[0035] The service registration platform is used to perform service discovery and registration on the microservice program to obtain a microservice cluster.

[0036] In a second aspect, the present invention provides a distributed scheduled task execution system, the system comprising:

[0037] A unit construction module is used to construct a scheduled task switch management unit according to business needs, and the scheduled task switch management unit is used to set the execution status of the scheduled task;

[0038] A state configuration module, configured to configure a dynamic real-time switch state according to the timed task switch management unit;

[0039] A parameter acquisition module, configured to acquire the scheduled task parameters according to the dynamic real-time switch state, and send the scheduled task parameters to the distributed scheduled task execution framework;

[0040] The framework encapsulation module is used to encapsulate the distributed scheduled task execution framework and the scheduled task parameters, and execute the scheduled task according to the scheduled task parameters.

[0041] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the distributed timed task execution method as described in the first aspect of the present invention.

[0042] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the distributed scheduled task execution method as described in the first aspect of the present invention is implemented.

[0043] The distributed scheduled task execution method, system, electronic device and storage medium provided by the present invention achieve a tighter and more flexible integration between the business system and the distributed scheduled task execution framework through technological innovation and secondary packaging. The dynamic connection makes the interaction between the two more efficient and accurate, and the management and scheduling of tasks are achieved through automated means, which reduces the risk of human error and helps to improve the stability and reliability of the entire business system. The traditional manual operation method of distributed scheduled task execution is optimized, allowing scheduled tasks to be opened and closed dynamically in real time in the business system. This flexibility enables the business system to respond to business changes and user needs more quickly, thereby greatly improving the operating experience of platform users. At the same time, it simplifies the integration process of the business system and the distributed scheduled task execution framework, reducing the development difficulty and development cost of integrating the distributed scheduled task execution framework into the business system. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0045] Figure 1 This is a first schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention;

[0046] Figure 2 This is a second schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention;

[0047] Figure 3 This is a third schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention;

[0048] Figure 4 This is a fourth schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention;

[0049] Figure 5 This is a fifth schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention;

[0050] Figure 6 This is a schematic diagram of the distributed scheduled task execution system provided by an embodiment of the present invention;

[0051] Figure 7 It is a structural diagram of an electronic device provided by an embodiment of the present invention.

[0052] Description of main component symbols:

[0053] 600, distributed scheduled task execution system; 610, unit construction module; 620, state configuration module; 630, parameter acquisition module; 640, framework encapsulation module; 700, electronic device; 710, processor; 720, communication interface; 730, memory; 740, communication bus. DETAILED DESCRIPTION

[0054] To make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be further clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be noted that the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0055] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature identified as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, "plurality" means two or more, unless otherwise specifically defined.

[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs. The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit the present invention. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0057] In the existing distributed scheduled task execution framework, adding a new business task requires the user to follow a standardized process: first, manually log in to the backend management system; second, access the designated task management interface; third, fill in the task information, including key configuration parameters such as the execution time and the target business system interface address, using the pre-set form fields; and finally, click the action button to start the task. Notably, users must repeat this entire process to terminate the task. However, the operational status and demands of business systems are highly dynamic: during peak business periods, the frequency of task execution may need to be temporarily increased; during system maintenance, tasks may need to be suspended. Because the existing distributed scheduled task framework relies heavily on manual backend management, it lacks real-time awareness of dynamic changes in the business system. This results in a significant time lag between task scheduling and actual business needs. This lag not only reduces system flexibility and responsiveness but also potentially adversely impacts the normal operation of the business.

[0058] Example 1

[0059] The embodiment of the present invention provides a distributed scheduled task execution method, which effectively solves the problem that the existing distributed scheduled task framework cannot be connected with the actual business needs in real time due to its high reliance on manual operation processes. Figure 1 This is a first schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention. Figure 1 As shown, the method includes the following steps:

[0060] S100: Construct a scheduled task switch management unit according to business requirements. The scheduled task switch management unit is used to set the execution status of the scheduled task.

[0061] In an embodiment of the present invention, a corresponding timed task switch management unit is established in the business processing system. The timed task switch management unit is a configuration unit in the business processing system, allowing system administrators or users with corresponding permissions to easily enable, disable or modify the execution status of timed tasks. Figure 2 This is a second schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention. Figure 2 As shown, the specific steps for building a scheduled task switch management unit are as follows:

[0062] S110. Determine the target development framework based on business requirements and configure the target database.

[0063] In an embodiment of the present invention, business requirements include, but are not limited to, the types of scheduled tasks that need to be managed, enabling and disabling operations, execution status modification, and permission control. Based on the corresponding business requirements, the functional modules of the target development framework can be determined, such as the scheduled task list display, on / off status toggle button, execution time and frequency settings, task descriptions and notes, and permission verification mechanisms. Then, based on the technology stack of the business processing system, a suitable web development framework is selected as the target development framework. At the same time, a target database is configured to store the configuration information of the scheduled tasks, including but not limited to task ID, name, execution status, execution time, frequency, description, and other information.

[0064] S120. Build the front-end interface according to the target development framework and set the back-end API interface based on the target database.

[0065] In this embodiment of the present invention, a front-end interface is constructed using a selected front-end technology stack based on the target development framework. This interface includes rendering of a scheduled task list, visual representation of switch states (e.g., slide switches, checkboxes), and input controls for execution time and frequency. An API interface is developed based on the target database to handle front-end requests, enabling functions such as enabling and disabling scheduled tasks, modifying execution states, and querying information. Optionally, the interface can include permission verification logic to ensure data security.

[0066] S130: Integrate the front-end interface and the back-end API interface to obtain a scheduled task switch management unit.

[0067] Integrate the front-end interface with the back-end API to achieve two-way data transmission and interaction, thereby building a scheduled task switch management unit.

[0068] S200: Configure a dynamic real-time switch state according to a scheduled task switch management unit.

[0069] The timing task switch management unit performs dynamic real-time on and off switch operations, that is, when the switch needs to be dynamically turned on in real time, the switch is automatically turned on, and when the switch needs to be dynamically turned off in real time, the switch is automatically turned off. Figure 3 This is a third schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention. Figure 3 As shown in the figure, the specific steps to configure the dynamic real-time switch status are as follows:

[0070] S210: Setting a switch component according to the front-end framework of the timed task switch unit, and binding a state variable to the switch component.

[0071] In the embodiment of the present invention, the switch component provided by the front-end framework is bound to the local state variable to reflect the current switch state in real time. For example, the switch component can be <switch>and <el-switch>When the switch component is loaded, it requests the initial state of the switch stored in the backend through the API and updates the local variables.

[0072] S220. Add an event listener to the switch component and set a state update function.

[0073] In this embodiment of the present invention, an event listener can be added to the switch component to capture the user's switch operation. When the user changes the switch state, the event listener is triggered and the corresponding function is called to handle the state update. Therefore, a state update function is required to handle the switch state update.

[0074] S230: Send an API request to the backend server according to the status update function.

[0075] This status update function sends an API request to the backend service to update the switch status. It also receives a response from the backend service and updates the switch status on the frontend interface based on the response. The frontend interface should periodically or based on specific events send requests to the backend service to obtain the latest switch status. If the switch status returned by the backend service is inconsistent with the status on the frontend interface, the frontend interface status should be updated.

[0076] S240: Verify the API request, update the database status, and push the switch status update message to the front end through the communication protocol.

[0077] In an embodiment of the present invention, by receiving the switch status update request sent by the front-end interface at the back-end API, the interface should verify the validity of the switch status update request, such as checking user permissions and request format, etc. If the verification is passed, the switch status is updated and the update result is returned to the front-end interface.

[0078] Optionally, the backend service can set up a storage mechanism, such as a database or memory cache, to store the current state of the switch. When receiving a switch state update request, the backend service should read the current state from the storage mechanism, update it to the new state, and save it back to the storage mechanism. The backend service can also use communication protocols such as WebSocket to push switch state update messages to the front-end interface in real time. When the switch state changes, the backend service should send a WebSocket message to all front-end interfaces that have subscribed to the switch state.

[0079] S250: Update the status of the switch component according to the switch status update message.

[0080] In the embodiment of the present invention, after receiving the switch status update message, the front-end interface updates the status of the switch component.

[0081] In the embodiment of the present invention, business personnel no longer need to understand and learn the background management interface of the distributed scheduled execution task framework, as well as the relevant configuration parameters. The originally complex scheduled task configuration can be completed by simply specifying the filing cycle and filing time point through the scheduled task switch management unit, which greatly reduces the learning cost and configuration error rate. The scheduled task switch management unit can complete the configuration of the scheduled task through two switches plus a filing cycle and filing time selection. Business personnel can turn on or off the scheduled task in seconds for different periods or special circumstances, and can also modify the cycle or time point of the scheduled task. For the cycle, it provides day, week, month and other cycle options, and for the time point, it supports quick selection at the hour and minute levels. Business personnel can flexibly build their own scheduled task processing time, and are no longer limited by the background management interface of the complex distributed scheduled execution task framework that requires professional knowledge.

[0082] S300: Obtain scheduled task parameters according to the dynamic real-time switch status, and send the scheduled task parameters to the distributed scheduled task execution framework.

[0083] Figure 4 This is a fourth schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention. Figure 4 As shown, obtaining the scheduled task parameters specifically includes the following steps:

[0084] S310: Generate service parameters according to the dynamic real-time switch status.

[0085] After the business personnel successfully configure the scheduled task switch management unit, the backend service will automatically generate business parameters based on the dynamic real-time switch status.

[0086] S320: Convert the business parameters into a target format recognizable by the distributed scheduled task execution framework to obtain a parameter file.

[0087] In this embodiment of the present invention, the business parameters are converted to the format of a distributed scheduled task execution framework. For example, the business parameter "DAY" + "14:30" is converted to the CRON expression "0 30 14**?", and the validity of the cycle and time point combination is verified. After all business parameters are converted, a parameter file is assembled.

[0088] S330: Obtain the registration address of the distributed scheduled task execution framework, and call the framework interface according to the registration address.

[0089] In an embodiment of the present invention, the registration address of the distributed timed task framework is obtained through the open source platform Nacos, and the OpenFeign declarative HTTP client is used to call the framework interface to pass the assembled parameter file.

[0090] Specifically, Nacos serves as the service registration and discovery center. The distributed scheduled task execution framework needs to register its own services in Nacos. When the backend service needs to send data, it uses Nacos to find the service address of the distributed scheduled task execution framework. The backend service needs to configure OpenFeign so that it can send requests through OpenFeign's declarative HTTP client.

[0091] S340: Send the parameter file to the distributed scheduled task execution framework according to the framework interface.

[0092] In an embodiment of the present invention, the interface method of OpenFeign is used to send the assembled parameter file to the distributed scheduled execution task framework in the form of an HTTP request.

[0093] As a further implementation of the embodiment of the present invention, after the parameter file is sent to the distributed scheduled execution task framework, the following steps are further included:

[0094] S350: Determine the status of the scheduled task according to the parameter file, and perform status and time verification.

[0095] In the embodiment of the present invention, the distributed scheduled task execution framework determines whether the scheduled task exists through relevant business parameters, and if so, determines whether the scheduled task is started and whether the time point needs to be updated.

[0096] S360: If the verification is successful, the status is synchronized and the synchronization result is returned to the scheduled task switch management unit.

[0097] Optionally, if verification passes, the source code methods of the distributed scheduled task execution framework, such as load() and start(), are called to synchronize and start the scheduled task. The load() method is used to load a new task, which typically involves parsing the task configuration and initializing the task executor. Once the task is successfully loaded, the start() method is called to start the task. For periodic tasks, the start() method can set a timer or scheduler to trigger task execution at a specified time.

[0098] As a further implementation method of the embodiment of the present invention, a microservice cluster can also be set up to expand services and improve the robustness of services. Since the open source distributed scheduled execution task framework is a single application jar program, the single application can be transformed into a microservice jar program by modifying the source code and introducing technologies such as Spring-Cloud-Alibaba, Nacos, OpenFeign and Hystrix. By utilizing Nacos' service registration and discovery, a real-time heartbeat mechanism is implemented between the distributed scheduled execution task framework and other business system jar packages, and it can be easily expanded into a cluster mode. By simply starting the same modified distributed scheduled execution task framework on different servers, automatic service registration and discovery can be completed, thereby obtaining a microservice cluster.

[0099] S400: Encapsulate the distributed scheduled task execution framework and scheduled task parameters, and execute the scheduled task according to the scheduled task parameters.

[0100] Figure 5 This is a fifth schematic diagram of the distributed scheduled task execution method provided by an embodiment of the present invention. Figure 5 As shown, the framework encapsulation specifically includes the following steps:

[0101] S410: Decouple the source code of the distributed scheduled execution task framework to obtain a task framework entity.

[0102] In an embodiment of the present invention, scheduling task methods such as adding addTask, saving saveTask, modifying updateTask, starting startTask and stopping stopTask are decoupled from the source code of the distributed scheduled task framework, and the business logic of these scheduling task methods is reorganized and optimized to adapt to the desired dynamic opening and closing of scheduled tasks and obtain the task framework entity.

[0103] S420: Set the interface layer of the task framework entity and define the calling logic of the interface layer.

[0104] In an embodiment of the present invention, OpenFeign is used to set the interface layer of the task framework entity. OpenFeign is a declarative HTTP client that makes it easier to write Web service clients. It is part of Spring Cloud and aims to improve development efficiency by simplifying the way to communicate with service providers. OpenFeign is based on Java 8 annotations and generates client implementations through dynamic proxies, thereby simplifying the creation of REST clients. OpenFeign uses Java's dynamic proxy to create proxy instances of interfaces. When you define a Feign client interface, Feign automatically implements this interface and generates a proxy object. This proxy object intercepts these calls when calling methods and converts them into HTTP requests.

[0105] At the same time, call logic is set for the interface layer. This call logic is used to handle abnormal scenarios such as timeout or service unavailability, and return default results or error prompts.

[0106] S430: Create a client according to the calling logic and set the dynamic task scheduling logic.

[0107] In this embodiment of the present invention, a client is created to call methods in the interface layer. The client uses Hystrix technology to ensure the stability of the call logic and circuit-breaking measures. Dynamic task scheduling logic is also set up. Each microservice uses the RestTemplate in Openfeign technology to make HTTP calls between microservices, thereby realizing dynamic configuration of scheduled tasks.

[0108] S440: Execute the scheduled task according to the scheduled task parameters and the dynamic task scheduling logic.

[0109] For example, to dynamically add and start a scheduled task, the scheduled task parameters are first initialized and judged. Then, an entity that carries the scheduled task information is constructed. The passed parameters are copied to the scheduled task information entity through attribute replication. The task is then added and saved by calling the new method in the source code. At the same time, it is checked whether the same task already exists. After the save is successful, the start method provided by the source code is called to start the scheduled task. Finally, the result of the method execution is returned to the caller, thus realizing the dynamic execution of the scheduled task.

[0110] When the switch is turned on, the current task's open status is modified in real time to the distributed scheduled task execution framework, eliminating the need to manually enable the current task through the distributed scheduled task execution framework's background management. When the switch is turned off, the current task's closed status is modified in real time to the distributed scheduled task execution framework, eliminating the need to manually disable the current task through the distributed scheduled task execution framework's background management.

[0111] The distributed scheduled task execution method provided by the embodiment of the present invention achieves a tighter and more flexible integration between the business system and the distributed scheduled task execution framework through technological innovation and secondary packaging. The dynamic connection makes the interaction between the two more efficient and accurate. The management and scheduling of tasks are achieved through automated means, reducing the risk of human error and helping to improve the stability and reliability of the entire business system. The traditional manual operation method of distributed scheduled task execution has been optimized, allowing scheduled tasks to be turned on and off dynamically in real time in the business system. This flexibility enables the business system to respond to business changes and user needs more quickly, thereby greatly improving the operating experience of platform users.

[0112] Example 2

[0113] Based on the same technical concept as the above method embodiment 1, an embodiment of the present invention provides a distributed scheduled task execution system. Figure 6 This is a schematic diagram of the distributed scheduled task execution system structure provided by an embodiment of the present invention. Figure 6 As shown, the distributed scheduled task execution system 600 includes:

[0114] The unit construction module 610 is used to construct a scheduled task switch management unit according to business requirements. The scheduled task switch management unit is used to set the execution status of the scheduled task.

[0115] The state configuration module 620 is used to configure the dynamic real-time switch state according to the timed task switch management unit.

[0116] The parameter acquisition module 630 is used to acquire the scheduled task parameters according to the dynamic real-time switch status and send the scheduled task parameters to the distributed scheduled task execution framework.

[0117] The framework encapsulation module 640 is used to encapsulate the distributed scheduled task execution framework and scheduled task parameters, and execute the scheduled task according to the scheduled task parameters.

[0118] The distributed scheduled task execution system provided by the embodiment of the present invention simplifies the integration process of the business system and the distributed scheduled task execution framework, and reduces the development difficulty and development cost of integrating the business system with the distributed scheduled task execution framework.

[0119] It can be understood that the implementation method of the distributed scheduled task execution method described in the above embodiment 1 is also applicable to this embodiment and can achieve the same technical effect, so it will not be repeated here.

[0120] Example 3

[0121] Based on the same concept, an embodiment of the present invention further provides an electronic device, Figure 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention, such as Figure 7 As shown, the electronic device 700 may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the steps of the distributed scheduled task execution method described in the above embodiments. For example, it includes:

[0122] S100: Construct a scheduled task switch management unit according to business needs, where the scheduled task switch management unit is used to set the execution status of the scheduled task;

[0123] S200, configuring a dynamic real-time switch state according to a timed task switch management unit;

[0124] S300, obtaining the scheduled task parameters according to the dynamic real-time switch status, and sending the scheduled task parameters to the distributed scheduled task execution framework;

[0125] S400: Encapsulate the distributed scheduled task execution framework and scheduled task parameters, and execute the scheduled task according to the scheduled task parameters.

[0126] The processor 710 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0127] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0128] The memory 730 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely located relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0129] Example 4

[0130] Based on the same concept, an embodiment of the present invention further provides a computer-readable storage medium storing a computer program, the computer program including at least one code segment that can be executed by a master control device to control the master control device to implement the steps of the distributed scheduled task execution method described in the above embodiments. For example, the steps include:

[0131] S100: Construct a scheduled task switch management unit according to business needs, where the scheduled task switch management unit is used to set the execution status of the scheduled task;

[0132] S200, configuring a dynamic real-time switch state according to a timed task switch management unit;

[0133] S300, obtaining the scheduled task parameters according to the dynamic real-time switch status, and sending the scheduled task parameters to the distributed scheduled task execution framework;

[0134] S400: Encapsulate the distributed scheduled task execution framework and scheduled task parameters, and execute the scheduled task according to the scheduled task parameters.

[0135] Based on the same technical concept, an embodiment of the present invention further provides a computer program, which, when executed by a main control device, is used to implement the above method embodiment.

[0136] In summary, the distributed scheduled task execution method, system, electronic device and storage medium provided by the present invention, through technological innovation and secondary packaging, realize a tighter and more flexible integration between the business system and the distributed scheduled task execution framework. The dynamic connection makes the interaction between the two more efficient and accurate, and realizes the management and scheduling of tasks through automated means, reduces the risk of human error, and helps to improve the stability and reliability of the entire business system. The traditional manual operation method of distributed scheduled task execution is optimized, allowing the scheduled tasks to be opened and closed dynamically in real time in the business system. This flexibility enables the business system to respond to business changes and user needs more quickly, thereby greatly improving the operating experience of platform users. At the same time, it simplifies the integration process of the business system and the distributed scheduled task execution framework, reducing the development difficulty and development cost of the business system integrated with the distributed scheduled task execution framework.

[0137] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0138] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.

[0139] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention. < / switch>

Claims

1. A distributed scheduled task execution method, characterized in that: The method comprises: Construct a scheduled task switch management unit according to business needs, which is used to set the execution status of the scheduled task; Configuring a dynamic real-time switch state according to the timed task switch management unit; Acquire scheduled task parameters according to the dynamic real-time switch state, and send the scheduled task parameters to a distributed scheduled task execution framework; The distributed scheduled task execution framework and the scheduled task parameters are encapsulated, and the scheduled task is executed according to the scheduled task parameters.

2. The distributed scheduled task execution method according to claim 1, characterized in that: The timed task switch management unit is constructed according to business needs, including: Determine the target development framework based on the business requirements and configure the target database; Build a front-end interface based on the target development framework and set a back-end API interface based on the target database; The front-end interface and the back-end API interface are integrated to obtain the scheduled task switch management unit.

3. The distributed scheduled task execution method according to claim 1, characterized in that: The configuring of the dynamic real-time switch state according to the timed task switch management unit includes: Setting a switch component according to the front-end framework of the timed task switch unit and binding a state variable to the switch component; Add an event listener to the switch component and set a state update function; Send an API request to the backend server according to the status update function; Verify the API request, update the database status, and push the switch status update message to the front end through the communication protocol; The state of the switch component is updated according to the switch state update message.

4. The distributed scheduled task execution method according to claim 1, characterized in that: The acquiring of the scheduled task parameters according to the dynamic real-time switch state and sending the scheduled task parameters to the distributed scheduled task execution framework includes: generating service parameters according to the dynamic real-time switch state; Convert the business parameters into a target format recognizable by the distributed scheduled execution task framework to obtain a parameter file; Obtain the registration address of the distributed scheduled task execution framework, and call the framework interface according to the registration address; The parameter file is sent to the distributed scheduled task execution framework according to the framework interface.

5. The distributed scheduled task execution method according to claim 4, characterized in that: After sending the scheduled task parameters to the distributed scheduled task execution framework, the method further includes: Determine the status of the scheduled task according to the parameter file and perform status and time verification; If the verification is passed, the status synchronization is performed and the synchronization result is returned to the scheduled task switch management unit.

6. The distributed scheduled task execution method according to claim 1, characterized in that: Encapsulating the distributed scheduled task execution framework and the scheduled task parameters, and executing the scheduled task according to the scheduled task parameters, including: Decoupling the source code of the distributed scheduled execution task framework to obtain a task framework entity; Setting the interface layer of the task framework entity and defining the calling logic of the interface layer; Create a client according to the calling logic and set the dynamic task scheduling logic; The scheduled task is executed according to the scheduled task parameters and the dynamic task scheduling logic.

7. The distributed scheduled task execution method according to claim 1, characterized in that: The method further comprises: Perform source code transformation on the multiple distributed timed execution task frameworks to obtain microservice programs; The service registration platform is used to perform service discovery and registration on the microservice program to obtain a microservice cluster.

8. A distributed scheduled task execution system, characterized in that: The system comprises: A unit construction module is used to construct a scheduled task switch management unit according to business needs, and the scheduled task switch management unit is used to set the execution status of the scheduled task; A state configuration module, configured to configure a dynamic real-time switch state according to the timed task switch management unit; A parameter acquisition module, configured to acquire the scheduled task parameters according to the dynamic real-time switch state, and send the scheduled task parameters to the distributed scheduled task execution framework; The framework encapsulation module is used to encapsulate the distributed scheduled task execution framework and the scheduled task parameters, and execute the scheduled task according to the scheduled task parameters.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: The processor executes the computer program to implement the distributed scheduled task execution method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the distributed scheduled task execution method according to any one of claims 1 to 7 is implemented.