Data acquisition timing task scheduling method and device

By combining Redis locks and Java interface-based timed task scheduling methods, the distributed scheduling problem of rail transit operation data collection was solved, enabling more flexible and dynamic data collection, meeting the data collection needs of rail transit operations, and improving the efficiency and flexibility of task execution.

CN117632409BActive Publication Date: 2026-08-04TRAFFIC CONTROL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-06
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Traditional timed task scheduling schemes are difficult to meet the data collection needs of rail transit operations, especially in the vast and complex rail transit network where there are a large number of vehicles and the data collection and transmission are complex, making it impossible to flexibly and dynamically meet the data collection needs.

Method used

By combining the features of Redis locks with Java's ScheduledFuture interface and leveraging the Spring Cloud microservice framework, this system enables the scheduling of data collection timed tasks, including creating, deleting, viewing, starting, and manually executing tasks. It uses Redis locks to manage task threads, dynamically configures task cycles, and utilizes the ScheduledFuture interface and the ThreadPoolTaskScheduler scheduler to create task threads.

Benefits of technology

It enables simpler and more efficient addition and configuration of scheduled data acquisition tasks, allowing for more flexible and dynamic acquisition of rail transit operation data, meeting the data acquisition needs of rail transit operations, and improving the utilization of computing resources and the flexibility of task execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117632409B_ABST
    Figure CN117632409B_ABST
Patent Text Reader

Abstract

The application provides a data collection timing task scheduling method and device, the method comprises the following steps: in the case of determining that the timing task scheduling service is started, the task parameters of a newly-built data collection timing task are acquired; in the case of the number of existing data collection timing tasks in execution not exceeding a first preset value, the identification information of the newly-built data collection timing task is taken as a key value, and a Redis lock corresponding to the newly-built data collection timing task is created; in the case of determining that the Redis lock corresponding to the newly-built data collection timing task is successfully created, the execution of the newly-built data collection timing task is started. The data collection timing task scheduling method and device provided by the application can more simply and efficiently add a newly-built data collection timing task, can more flexibly configure the execution period of the newly-built data collection timing task, and can more flexibly dynamically collect rail transit operation data, thereby better meeting the collection requirements of rail transit operation data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of rail transit technology, and in particular to a method and apparatus for scheduling data acquisition timed tasks. Background Technology

[0002] Data collection is a crucial task in rail transit operations. By collecting and analyzing operational data generated during rail transit operations, it is possible to monitor vehicle operating status, passenger flow, ticketing information, and other data in real time, thereby providing data support and operational optimization suggestions to transportation management departments.

[0003] Among related technologies, operational data generated during rail transit operation can be collected based on a timed task scheduling scheme.

[0004] However, due to the vast and complex nature of the rail transit network and the large number of vehicles, the vehicle scheduling and data transmission involved in data collection are quite complex, making it difficult for traditional timed task scheduling schemes to meet the data collection needs of rail transit operations. Summary of the Invention

[0005] This invention provides a data acquisition timed task scheduling method and apparatus to address the shortcomings of traditional timed task scheduling schemes in the prior art, which are unable to meet the data acquisition needs of rail transit operations, and to better meet the data acquisition needs of rail transit operations.

[0006] This invention provides a data acquisition timed task scheduling method, comprising:

[0007] Once it is confirmed that the scheduled task service has been started and completed, the task parameters of the newly created data acquisition scheduled task are obtained. The task parameters include the task's identification information and execution cycle information.

[0008] If the number of existing data acquisition timed tasks in execution does not exceed a first preset value, a Redis lock corresponding to the newly created data acquisition timed task is created using the identifier information of the newly created data acquisition timed task as the key value.

[0009] If the Redis lock corresponding to the newly created data collection scheduled task is successfully created, the execution of the newly created data collection and location task will be started.

[0010] According to a data acquisition timed task scheduling method provided by the present invention, the specific steps for starting the task scheduling service include:

[0011] Load the task parameters of all existing data acquisition timed tasks that have not yet been executed;

[0012] Determine whether the number of existing data collection timed tasks in execution exceeds a second preset value. If the number of existing data collection timed tasks in execution does not exceed the second preset value, create a Redis lock corresponding to any unexecuted existing data collection timed task using the identifier information of any unexecuted existing data collection timed task as the key value.

[0013] If it is determined that the Redis lock corresponding to any of the existing unexecuted data collection timed tasks has been successfully created, then the execution of any of the existing unexecuted data collection timed tasks will be started.

[0014] Return to the step of determining whether the number of existing data acquisition timed tasks in execution exceeds the second preset value, until the number of existing data acquisition timed tasks in execution exceeds the second preset value, and confirm that the timed task scheduling service has been started successfully.

[0015] According to a data acquisition timed task scheduling method provided by the present invention, the step of initiating the execution of the newly created data acquisition and positioning task includes:

[0016] Based on the task parameters of the newly created data acquisition scheduled task, generate the cron expression corresponding to the newly created data acquisition scheduled task, and use the ScheduledFuture interface and ThreadPoolTaskScheduler scheduler to create the task thread corresponding to the newly created data acquisition scheduled task.

[0017] The task thread corresponding to the newly created data acquisition timed task is added to the target thread pool so that the target thread pool can execute the newly created data acquisition and positioning task at regular intervals based on the cron expression corresponding to the newly created data acquisition timed task.

[0018] The data acquisition timed task scheduling method provided by the present invention further includes:

[0019] Once it is determined that the scheduled task service has been started and completed, a modification instruction for the target data acquisition scheduled task is obtained. The target data acquisition scheduled task is an existing data acquisition scheduled task that needs to be modified. The modification instruction carries the task parameters of the modified data acquisition scheduled task.

[0020] If it is determined that a task thread corresponding to the target data acquisition timer task exists in the target thread pool, the task thread corresponding to the target data acquisition timer task is deleted, and a Redis lock corresponding to the modified data acquisition timer task is created using the identifier information of the modified data acquisition timer task as the key value.

[0021] If the Redis lock corresponding to the modified data collection scheduled task is successfully created, a cron expression corresponding to the modified data collection scheduled task is generated based on the task parameters of the modified data collection scheduled task. Then, the task thread corresponding to the modified data collection scheduled task is created using the ScheduledFuture interface and the ThreadPoolTaskScheduler scheduler. The task thread corresponding to the modified data collection scheduled task is then added to the target thread pool so that the target thread pool can periodically execute the newly created data collection and location task based on the cron expression corresponding to the modified data collection scheduled task.

[0022] According to a data acquisition scheduled task scheduling method provided by the present invention, when the number of existing data acquisition scheduled tasks in execution does not exceed a second preset value, after creating a Redis lock corresponding to any unexecuted existing data acquisition scheduled task using the identifier information of any unexecuted existing data acquisition scheduled task as the key value, the method further includes:

[0023] If the creation of the Redis lock corresponding to any unexecuted existing data collection scheduled task fails, remove the unexecuted existing data collection scheduled task from all unexecuted existing data collection scheduled tasks, and return to the step of determining whether the number of executed existing data collection scheduled tasks exceeds the second preset value, until the creation of the Redis lock corresponding to any unexecuted existing data collection scheduled task is successful.

[0024] The data acquisition timed task scheduling method provided by the present invention further includes:

[0025] If it is determined that the scheduled task scheduling service has been started and completed, a target instruction for the target data acquisition scheduled task is received. The target data acquisition scheduled task is an existing data acquisition scheduled task that is being executed. The target instruction includes any one of a delete instruction, a view instruction, and a stop instruction.

[0026] If it is determined that the target thread pool contains a task thread corresponding to the target data acquisition timed task, the target instruction is executed on the task thread corresponding to the target data acquisition timed task.

[0027] The data acquisition timed task scheduling method provided by the present invention further includes:

[0028] Once it is determined that the scheduled task service has been started and completed, a manual operation instruction for the target data acquisition scheduled task is received. The target data acquisition scheduled task is an existing data acquisition scheduled task that is currently being executed and requires manual operation.

[0029] If it is determined that the target thread pool contains a task thread corresponding to the target data acquisition timed task, the target data acquisition timed task is executed based on the execution command input by the user.

[0030] The present invention also provides a data acquisition timed task scheduling device, comprising:

[0031] The data acquisition module is used to acquire the task parameters of a newly created data acquisition scheduled task when it is determined that the scheduled task scheduling service has been started and completed. The task parameters include the task's identification information and execution cycle information.

[0032] The data processing module is used to create a Redis lock corresponding to the newly created data acquisition timed task, using the identifier information of the newly created data acquisition timed task as the key value, when the number of existing data acquisition timed tasks in execution does not exceed a first preset value.

[0033] The task startup module is used to start the execution of the newly created data collection and location task if it is determined that the Redis lock corresponding to the newly created data collection scheduled task has been successfully created.

[0034] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data acquisition timed task scheduling method described above.

[0035] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data acquisition timed task scheduling method as described above.

[0036] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the data acquisition timed task scheduling method described above.

[0037] The data acquisition timed task scheduling method and apparatus provided by this invention, upon confirming the completion of the timed task scheduling service, if the task parameters for a newly created data acquisition and positioning task are obtained, then it determines whether the number of existing data acquisition timed tasks in execution exceeds a first preset value. If the number of existing data acquisition timed tasks in execution does not exceed the first preset value, a Redis lock corresponding to the newly created data acquisition timed task is created using the identifier information of the newly created data acquisition timed task as the key value. Upon confirming the successful creation of the Redis lock corresponding to the newly created data acquisition timed task, the execution of the newly created data acquisition and positioning task is initiated. This allows for simpler and more efficient addition of new data acquisition timed tasks, more flexible configuration of the execution cycle of new data acquisition timed tasks, and thus more flexible dynamic collection of rail transit operation data, better meeting the data collection needs of rail transit operations. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0039] Figure 1 This is one of the flowcharts illustrating the data acquisition timed task scheduling method provided by the present invention;

[0040] Figure 2 This is the second flowchart illustrating the data acquisition timed task scheduling method provided by the present invention;

[0041] Figure 3 This is a schematic diagram of the process of starting the task scheduling service in the data acquisition timed task scheduling method provided by the present invention;

[0042] Figure 4 This is the third flowchart illustrating the data acquisition timed task scheduling method provided by the present invention;

[0043] Figure 5 This is a schematic diagram of the data acquisition timed task scheduling device provided by the present invention;

[0044] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0046] In the description of this application, the terms "first," "second," etc., are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, in the description of this application, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects have an "or" relationship.

[0047] It should be noted that a scheduled task scheduling scheme refers to a mechanism or system used to execute tasks on a planned basis. Traditional scheduled task scheduling schemes include: operating system-level schedulers, programming language-based scheduled task frameworks, and third-party scheduling services.

[0048] Most operating systems have a built-in scheduler, such as TaskScheduler in Windows and cron in Linux. These schedulers allow users to set scheduled tasks and specify the execution time and frequency of the tasks.

[0049] Many programming languages ​​provide frameworks for handling scheduled tasks, such as the Quartz framework in Java, the APScheduler framework in Python, the node-cron framework in Node.js, and distributed scheduled task platforms like ElasticJob and xxl-job. Developers can use these scheduled task frameworks to set up scheduled tasks and their execution logic.

[0050] There are also third-party services specifically designed for scheduled task management, such as AWS Lambda, Google Cloud Scheduler, and Azure Logic Apps. These third-party services help users easily set up and manage scheduled tasks and provide a highly reliable execution environment.

[0051] However, due to the vast and complex nature of the rail transit network and the large number of vehicles, the vehicle scheduling and data transmission involved in data collection are quite complex. The aforementioned scheduled task scheduling schemes face numerous problems when applied to data collection in rail transit operations. For example, the Quartz framework in the Java programming language is a standalone model and cannot be uniformly scheduled within a microservice architecture; distributed scheduled task scheduling platforms such as ElasticJob and XXL-job rely on numerous third-party applications, making deployment cumbersome and resulting in high usage costs; furthermore, none of the aforementioned traditional scheduled task scheduling schemes can dynamically configure task cycles, making it difficult to flexibly and dynamically collect rail transit operation data, thus failing to meet the data collection needs of rail transit operations.

[0052] To address this, the present invention provides a data acquisition timed task scheduling method for the field of rail transit technology. By combining the characteristics of Redis locks with the ScheduledFuture interface in Java, it can better solve the scheduling problem of distributed data acquisition timed task in rail transit operation data acquisition, thereby enabling more flexible and dynamic acquisition of rail transit operation data and better meeting the acquisition needs of rail transit operation data.

[0053] Figure 1 This is one of the flowcharts illustrating the data acquisition timed task scheduling method provided by this invention. The following is a combination of... Figure 1 This invention describes a data acquisition timed task scheduling method. For example... Figure 1 As shown, the method includes: Step 101, when it is determined that the scheduled task scheduling service has been started and completed, the task parameters of the newly created data acquisition scheduled task are obtained. The task parameters include the task identification information and execution cycle information.

[0054] It should be noted that the execution entity in this embodiment of the invention is a data acquisition timed task scheduling device.

[0055] Optionally, the data acquisition timed task scheduling device in this embodiment of the invention can be a coordinator for a timed task scheduling service. Here, a coordinator refers to a component or tool used to coordinate and manage various services in a distributed system. In a distributed system, due to the increasing number of services and the complex dependencies between them, a mechanism is needed to coordinate and manage these services to ensure the system can operate normally.

[0056] The coordinator of the scheduled task scheduling service can also be used to coordinate communication between the scheduled task scheduling service and other services.

[0057] Specifically, the data acquisition scheduled task scheduling method provided by this invention can schedule data acquisition scheduled tasks when the scheduled task scheduling service is already running. The scheduling can include any one of the following: adding a new data acquisition scheduled task, deleting an existing data acquisition scheduled task, viewing an existing data acquisition scheduled task, stopping an existing data acquisition scheduled task, starting an existing data acquisition scheduled task, and manually executing an existing data acquisition scheduled task.

[0058] It should be noted that the scheduled task service in this embodiment of the invention can use the Spring Cloud microservice framework. Spring Cloud is an open-source framework for building distributed systems and microservice architectures. Based on Spring Boot, Spring Cloud provides a set of tools and components to assist developers in building, deploying, and managing microservices in distributed systems.

[0059] Figure 2 This is the second flowchart illustrating the data acquisition timed task scheduling method provided by this invention. For example... Figure 2 As shown, when a user needs to add a new scheduled data acquisition task, the user can input the task parameters for the new scheduled data acquisition task through the web interface.

[0060] The task parameters mentioned above may include task identification information and execution cycle information; the task identification information can uniquely identify the task, and the task identification information can be the task's ID number (IdentityDocument, ID); the task parameters may also include the task's name information.

[0061] Users can input the task parameters for a newly created data acquisition scheduled task through the web interface. These task parameters can then be forwarded to the control center via the gateway as web request information.

[0062] The control center can verify the task parameters of newly created data acquisition timed tasks.

[0063] If the task parameters of a newly created data acquisition scheduled task fail to pass verification, the controller center can return a prompt message to the web interface indicating that the task parameter verification for the newly created data acquisition scheduled task has failed.

[0064] Once the task parameters of a newly created data acquisition scheduled task pass verification, the control center can broadcast these parameters to the data acquisition scheduled task scheduler (the coordinator of the scheduled task service) via RabbitMQ. RabbitMQ is an open-source message queue middleware that implements the Advanced Message Queuing Protocol (AMQP) and provides a reliable message delivery mechanism. Developed by RabbitTechnologies Ltd. and written in Erlang, RabbitMQ is characterized by its cross-platform compatibility, high performance, and scalability, and is widely used in distributed systems, microservice architectures, and asynchronous communication scenarios.

[0065] The data acquisition timed task scheduling device can receive task parameters for newly created data acquisition timed tasks.

[0066] It should be noted that after the control center can send the task parameters of the newly created data acquisition scheduled task to the data acquisition scheduled task scheduling device via RabbitMQ in the form of broadcast, the control center can also return a prompt message to the web interface to indicate that the task parameters of the newly created data acquisition scheduled task have been successfully verified.

[0067] Step 102: If the number of existing data acquisition timed tasks in execution does not exceed the first preset value, create a Redis lock corresponding to the new data acquisition timed task using the identifier information of the new data acquisition timed task as the key value.

[0068] like Figure 2 As shown, after receiving the task parameters for a newly created data acquisition timed task, the data acquisition timed task scheduling device can determine whether the number of existing data acquisition timed tasks in execution exceeds a first preset value.

[0069] It should be noted that the first preset value in the embodiments of the present invention may be determined based on prior knowledge and / or actual situation, and the value of the first preset value is not specifically limited in the embodiments of the present invention.

[0070] If the number of existing data acquisition scheduled tasks in execution exceeds the first preset value, it indicates that the number of data acquisition scheduled tasks in execution has reached the upper limit of computing resources, and no new data acquisition scheduled tasks can be added. Therefore, adding a data acquisition and positioning task will fail.

[0071] If the number of existing data collection scheduled tasks in execution does not exceed the first preset value, it means that a new data collection scheduled task can be added at this time. A Redis lock corresponding to the new data collection scheduled task can be created using the identifier information of the new data collection scheduled task as the key value.

[0072] It should be noted that Redis locks are a distributed lock mechanism implemented based on the Redis database. Redis locks can be used to implement mutual exclusion access to shared resources among multiple applications or threads, such as ensuring exclusive operations on a certain resource in a distributed environment, such as distributed task scheduling and cache updates.

[0073] Step 103: After confirming that the Redis lock corresponding to the newly created data collection scheduled task has been successfully created, start the execution of the newly created data collection and location task.

[0074] like Figure 2 As shown, if the creation of the Redis lock corresponding to the newly created data collection scheduled task fails, it indicates that the newly created data collection scheduled task has already been loaded by another scheduled task scheduling service, and the addition of the data collection and location task fails.

[0075] Once it is confirmed that the Redis lock corresponding to the newly created data collection scheduled task has been successfully created, the execution of the newly added data collection and location task will be started.

[0076] As an optional embodiment, initiating the execution of a newly created data acquisition and positioning task includes: generating a cron expression corresponding to the newly created data acquisition scheduled task based on the task parameters of the newly created data acquisition scheduled task, and creating a task thread corresponding to the newly created data acquisition scheduled task using the ScheduledFuture interface and the ThreadPoolTaskScheduler scheduler.

[0077] It's important to note that Corn expressions (also known as Quartz expressions) are a type of time expression used to specify when to execute a task or trigger an event. A Corn expression can consist of six fields, each representing a portion of time, including seconds, minutes, hours, day, month, and day of the week. The syntax of Corn expressions is very flexible, allowing for various complex time requirements, such as execution at a specific time on a specific day of the week, or execution at regular intervals. Corn expressions are widely used in task scheduling and timed event triggering scenarios.

[0078] It's important to note that ScheduledFuture is a Java interface used to represent delayed or scheduled tasks. The ScheduledFuture interface is an extension of the ScheduledExecutorService interface, defining a return value for each task. When using the ScheduledFuture interface for scheduled tasks, you can create scheduled tasks using the scheduleAtFixedRate or scheduleWithFixedDelay methods in ScheduledExecutorService, which also return a ScheduledFuture object. The ScheduledFuture interface can be used to view the task's status, result, and cancel its execution.

[0079] ThreadPoolTaskScheduler is a task scheduler in the Spring Framework used to execute asynchronous or scheduled tasks in a background thread pool. The ThreadPoolTaskScheduler scheduler is an implementation class of the TaskScheduler interface. The ThreadPoolTaskScheduler scheduler provides features such as asynchronous execution, scheduled tasks, and thread pool management.

[0080] In this embodiment of the invention, the ScheduledFuture interface and the ThreadPoolTaskScheduler scheduler can be used to create task threads corresponding to newly created data acquisition timed tasks.

[0081] Add the task thread corresponding to the newly created data acquisition scheduled task to the target thread pool, so that the target thread pool can execute the newly created data acquisition and positioning task on a scheduled basis based on the cron expression corresponding to the newly created data acquisition scheduled task.

[0082] It should be noted that the target thread pool in this embodiment of the invention can be a Runnable thread pool.

[0083] Java provides the `Executors` class for creating and managing thread pools. Different types of thread pools can be created using the `Executors` class, one of which is the `Runnable` thread pool. Using thread pools effectively manages the lifecycle of multiple threads, reuses thread resources, and controls the number of concurrently executing threads, preventing excessive threads from exhausting system resources. The `Runnable` thread pool is a thread pool used to execute `Runnable` tasks. `Runnable` is an interface in Java that represents a task that can be executed by a thread. `Runnable` has only one method, `run()`, which defines the specific logic of the task.

[0084] It should be noted that when determining whether the number of existing data acquisition timed tasks in execution exceeds the first preset value, it is possible to determine whether the number of task threads in the Runnable thread pool exceeds the first preset value.

[0085] This invention, upon confirming the completion of the scheduled task service, if the task parameters for a newly created data acquisition and positioning task are obtained, determines whether the number of existing data acquisition scheduled tasks in execution exceeds a first preset value. If the number of existing data acquisition scheduled tasks in execution does not exceed the first preset value, a Redis lock corresponding to the newly created data acquisition scheduled task is created using the identifier information of the newly created data acquisition scheduled task as the key value. Upon confirming the successful creation of the Redis lock corresponding to the newly created data acquisition scheduled task, the execution of the newly created data acquisition and positioning task is initiated. This allows for simpler and more efficient addition of new data acquisition scheduled tasks, more flexible configuration of the execution cycle of new data acquisition scheduled tasks, and more flexible dynamic collection of rail transit operation data, thus better meeting the data collection needs of rail transit operations.

[0086] This invention combines the features of Redis locks with the ScheduledFuture interface in Java to better solve the scheduling problem of distributed data collection timing in rail transit operation data acquisition.

[0087] Based on the above embodiments, the specific steps for starting the task scheduling service include: loading the task parameters of all existing data acquisition timed tasks that have not yet been executed;

[0088] Figure 3 This is a schematic diagram illustrating the process of starting the task scheduling service in the data acquisition timed task scheduling method provided by the present invention. For example... Figure 3 As shown, when starting the task scheduling service, the service signal of the task scheduling service can be registered with the open-source platform Nacos so that the task scheduling service can communicate with other microservices.

[0089] It should be noted that Nacos is an open-source distributed service discovery, configuration, and management platform that provides core functionalities such as a registry center, configuration center, and namespaces, which helps to quickly build microservice architectures.

[0090] Specifically, after registering the service signal of the task scheduling service to the open-source platform Nacos, the data acquisition timed task scheduling device (the coordinator of the timed task scheduling service) can be initialized.

[0091] After initializing the data acquisition timer task scheduler, the data acquisition timer task scheduler can load the task parameters of all existing data acquisition timers that have not yet been executed from the task_info table.

[0092] The data acquisition timed task scheduling device loads the task parameters of all existing data acquisition timed tasks that have not yet been executed, and can also initialize the task parameters of each existing data acquisition timed task that has not yet been executed on the server.

[0093] Determine whether the number of existing data collection timed tasks in execution exceeds the second preset value. If the number of existing data collection timed tasks in execution does not exceed the second preset value, create a Redis lock corresponding to any unexecuted existing data collection timed task using the identifier information of any unexecuted existing data collection timed task as the key value.

[0094] Specifically, the data acquisition timed task scheduling device loads the task parameters of all unexecuted existing data acquisition timed tasks, and can also determine whether the number of existing data acquisition timed tasks in execution exceeds a second preset value.

[0095] It should be noted that the second preset value in the embodiments of the present invention may be determined based on prior knowledge and / or actual situation, and the value of the second preset value is not specifically limited in the embodiments of the present invention.

[0096] It is understood that the first preset value and the second preset value in the embodiments of the present invention may be the same or different.

[0097] It should be noted that when determining whether the number of existing data acquisition timed tasks in execution exceeds the second preset value, it is possible to determine whether the number of task threads in the Runnable thread pool exceeds the second preset value.

[0098] If the number of existing data acquisition scheduled tasks in execution exceeds the second preset value, it indicates that the data acquisition scheduled tasks in execution have reached the upper limit of computing resources, and it can be confirmed that the task scheduling service has been started successfully.

[0099] If the number of existing data acquisition timed tasks in execution does not exceed the second preset value, a Redis lock corresponding to any of the aforementioned unexecuted existing data acquisition timed tasks can be created using the identifier information of any of the unstarted existing data acquisition and positioning tasks as the key value.

[0100] It should be noted that, in embodiments of the present invention, if the number of existing data collection timed tasks in execution does not exceed a second preset value, the identification information of an existing data collection location task that has not been started can be used as a key value to create a Redis lock corresponding to the aforementioned existing data collection timed task that has not been executed.

[0101] If it is confirmed that the Redis lock corresponding to any existing data collection scheduled task that has not yet been executed has been successfully created, start the execution of any existing data collection scheduled task that has not yet been executed.

[0102] Specifically, if it is confirmed that the Redis lock corresponding to any of the aforementioned unexecuted existing data collection scheduled tasks has been successfully created, a cron expression corresponding to any of the aforementioned unexecuted existing data collection scheduled tasks can be generated based on the task parameters of the aforementioned unexecuted existing data collection scheduled tasks. Then, using the ScheduledFuture interface and the ThreadPoolTaskScheduler scheduler, a task thread corresponding to any of the aforementioned unexecuted existing data collection scheduled tasks can be created. Subsequently, the task thread corresponding to any of the aforementioned unexecuted existing data collection scheduled tasks can be added to the Runnable thread pool, so that the target thread pool can periodically execute any of the aforementioned unexecuted existing data collection scheduled tasks based on the cron expression corresponding to any of the aforementioned unexecuted existing data collection scheduled tasks, thereby starting the execution of any of the aforementioned unexecuted existing data collection scheduled tasks.

[0103] As an optional embodiment, if the number of existing data acquisition timed tasks in execution does not exceed a second preset value, after creating a Redis lock corresponding to any unexecuted existing data acquisition timed task using the identifier information of any unexecuted existing data acquisition timed task as the key value, the method further includes: if the creation of the Redis lock corresponding to any unexecuted existing data acquisition timed task fails, removing any unexecuted existing data acquisition timed task from all unexecuted existing data acquisition timed tasks, and returning to the step of determining whether the number of existing data acquisition timed tasks in execution exceeds the second preset value, until the Redis lock corresponding to any unexecuted existing data acquisition timed task is successfully created.

[0104] Specifically, if it is determined that the Redis lock corresponding to any of the aforementioned unexecuted existing data collection scheduled tasks has failed to be created, it indicates that the aforementioned unexecuted existing data collection scheduled task has been loaded by other scheduled task scheduling services. The aforementioned unexecuted existing data collection scheduled task can be removed from all unexecuted existing data collection scheduled tasks, and the step of determining whether the number of existing data collection scheduled tasks in execution exceeds the second preset value is returned until it is determined that the Redis lock corresponding to any unstarted existing data collection location task has been successfully created.

[0105] Return to the step of determining whether the number of existing data acquisition timed tasks in execution exceeds the second preset value, until the number of existing data acquisition timed tasks in execution exceeds the second preset value, confirming that the timed task scheduling service has been started.

[0106] Specifically, after initiating the execution of any of the aforementioned unexecuted existing data acquisition scheduled tasks, that unexecuted existing data acquisition scheduled task becomes an executing existing data acquisition scheduled task. Correspondingly, the number of executing existing data acquisition scheduled tasks increases by 1.

[0107] like Figure 3 As shown, after starting the execution of any of the above-mentioned unexecuted existing data acquisition timed tasks, the process can return to the step of determining whether the number of existing data acquisition timed tasks in execution exceeds the second preset value, until the number of existing data acquisition timed tasks in execution exceeds the second preset value, confirming that the timed task scheduling service has been started.

[0108] This invention, in its embodiments, determines whether the number of existing data acquisition timed tasks in execution exceeds a second preset value. If the number of existing data acquisition timed tasks in execution does not exceed the second preset value, a Redis lock corresponding to any unexecuted existing data acquisition timed task is created using the identifier information of any unexecuted existing data acquisition timed task as the key value. If the Redis lock corresponding to any unexecuted existing data acquisition timed task is successfully created, the execution of any unexecuted existing data acquisition timed task is started. Then, the process returns to the step of determining whether the number of existing data acquisition timed tasks in execution exceeds the second preset value, until the number of existing data acquisition timed tasks in execution exceeds the second preset value, confirming that the timed task scheduling service has been started. This allows for more timely and efficient startup of existing data acquisition timed tasks, more full utilization of computing resources, and more effective avoidance of duplicate or missed execution of existing data acquisition timed tasks.

[0109] Based on the above embodiments, the data acquisition timed task scheduling method further includes: when it is determined that the timed task scheduling service has been started and completed, obtaining a modification instruction for the target data acquisition timed task, wherein the target data acquisition timed task is an existing data acquisition timed task that needs to be modified, and the modification instruction carries the task parameters of the modified data acquisition timed task.

[0110] Specifically, in this embodiment of the invention, the existing data acquisition timing task that needs to be modified can be identified as the target data acquisition timing task.

[0111] Figure 4 This is the third flowchart illustrating the data acquisition timed task scheduling method provided by this invention. Figure 4 As shown, when a user needs to modify the target data acquisition timer task, the user can input the modification command for the target data acquisition timer task, which carries the modified task parameters, through the web interface.

[0112] It should be noted that the data processing and forwarding process of the modification instruction for the target data acquisition timed task can be found in the data processing and forwarding process of the task parameters for the newly created data acquisition timed task, and will not be repeated in this embodiment of the invention.

[0113] The data acquisition timed task scheduling device can receive modification instructions for the target data acquisition timed task.

[0114] If it is determined that a task thread corresponding to the target data acquisition timer task exists in the target thread pool, delete the task thread corresponding to the target data acquisition timer task, and create a Redis lock corresponding to the modified data acquisition timer task using the identifier information of the modified data acquisition timer task as the key value.

[0115] Specifically, after receiving the modification instruction for the target data acquisition timed task, the data acquisition timed task scheduling device can determine whether there is a task thread corresponding to the target data acquisition timed task in the Runnable thread pool.

[0116] If the task thread corresponding to the above target data acquisition timed task does not exist in the Runnable thread pool, it indicates an error and the target data acquisition and location task modification has failed.

[0117] If a task thread corresponding to the aforementioned target data acquisition scheduled task exists in the Runnable thread pool, the task thread corresponding to the aforementioned target data acquisition scheduled task can be deleted from the Runnable thread pool, and a Redis lock corresponding to the modified data acquisition scheduled task can be created using the identifier information of the modified data acquisition scheduled task as the key value.

[0118] If the Redis lock corresponding to the modified data acquisition scheduled task is successfully created, a cron expression corresponding to the modified data acquisition scheduled task is generated based on the task parameters of the modified data acquisition scheduled task. Then, the scheduledFuture interface and the ThreadPoolTaskScheduler scheduler are used to create a task thread corresponding to the modified data acquisition scheduled task. The task thread corresponding to the modified data acquisition scheduled task is then added to the target thread pool so that the target thread pool can periodically execute the newly created data acquisition and location task based on the cron expression corresponding to the modified data acquisition scheduled task.

[0119] This invention, upon confirming the completion of the scheduled task service, if a modification instruction for a target data acquisition and positioning task is received, determines whether a task thread corresponding to the target data acquisition and positioning task exists in the target thread pool. If such a thread exists, it is removed from the target thread pool, and the modified data acquisition and positioning task is used as a new scheduled data acquisition task. The modified task is then initiated. This allows for the modification of an existing scheduled data acquisition task without restarting the scheduled task service, enabling more flexible dynamic configuration of the execution cycle of existing scheduled data acquisition tasks and further improving the flexibility of dynamically acquiring rail transit operation data.

[0120] Based on the above embodiments, the data acquisition timed task scheduling method further includes: when it is determined that the timed task scheduling service has been started and completed, receiving a target instruction for the target data acquisition timed task, wherein the target data acquisition timed task is an existing data acquisition timed task that is being executed, and the target instruction includes any one of a delete instruction, a view instruction, and a stop instruction.

[0121] If it is determined that there is a task thread in the target thread pool corresponding to the target data acquisition timed task, the target instruction is executed on the task thread corresponding to the target data acquisition timed task.

[0122] Specifically, in this embodiment of the invention, an existing data acquisition timed task that needs to be deleted, viewed, or stopped can be identified as the target data acquisition timed task.

[0123] like Figure 4 As shown, when a user needs to delete a target data acquisition scheduled task, the user can enter the deletion command for the target data acquisition scheduled task through the web interface.

[0124] It should be noted that the data processing and forwarding process of the stop command for the target data acquisition timed task can be found in the data processing and forwarding process of the task parameters for the newly created data acquisition timed task, and will not be repeated in this embodiment of the invention.

[0125] The data acquisition timed task scheduling device can receive deletion instructions for the target data acquisition timed task.

[0126] After receiving the deletion instruction for the target data acquisition timed task, the data acquisition timed task scheduling device can determine whether the task thread corresponding to the target data acquisition timed task exists in the Runnable thread pool.

[0127] If the task thread corresponding to the above target data acquisition timed task does not exist in the Runnable thread pool, it indicates an error and the deletion of the target data acquisition and location task has failed.

[0128] If a task thread corresponding to the aforementioned target data acquisition timed task exists in the Runnable thread pool, the task thread corresponding to the aforementioned target data acquisition timed task can be deleted from the Runnable thread pool.

[0129] Understandably, after deleting the task thread corresponding to the aforementioned target data acquisition scheduled task from the Runnable thread pool, the number of existing data acquisition scheduled tasks in execution will decrease by 1.

[0130] like Figure 4 As shown, when a user needs to view the target data acquisition scheduled task, the user can enter the viewing command for the target data acquisition scheduled task through the web interface.

[0131] It should be noted that the data processing and forwarding process of the viewing command for the target data acquisition timed task can be found in the data processing and forwarding process of the task parameters for the newly created data acquisition timed task, and will not be repeated in this embodiment of the invention.

[0132] The data acquisition timed task scheduling device can receive viewing instructions for the target data acquisition timed task.

[0133] After receiving the viewing instruction for the target data acquisition timed task, the data acquisition timed task scheduling device can determine whether the task thread corresponding to the target data acquisition timed task exists in the Runnable thread pool.

[0134] If the task thread corresponding to the above-mentioned target data acquisition scheduled task does not exist in the Runnable thread pool, it indicates an error, and the target data acquisition and location task viewing failed.

[0135] If the task thread corresponding to the target data acquisition timed task exists in the Runnable thread pool, the data acquisition timed task scheduling device can interact with the control center to enable the control center to load the task data of the target data acquisition timed task in the task_info table and return the task data of the target data acquisition timed task to the web interface for users to view.

[0136] like Figure 4 As shown, when a user needs to stop the target data acquisition timed task, the user can input a stop command for the target data acquisition timed task through the web interface.

[0137] It should be noted that the data processing and forwarding process of the stop command for the target data acquisition timed task can be found in the data processing and forwarding process of the task parameters for the newly created data acquisition timed task, and will not be repeated in this embodiment of the invention.

[0138] The data acquisition timed task scheduling device can receive stop commands for target data acquisition timed tasks.

[0139] After receiving the stop instruction for the target data acquisition timed task, the data acquisition timed task scheduling device can determine whether there is a task thread corresponding to the target data acquisition timed task in the Runnable thread pool.

[0140] If the task thread corresponding to the above target data acquisition timed task does not exist in the Runnable thread pool, it indicates an error, and the target data acquisition and positioning task has failed to stop.

[0141] If a task thread corresponding to the aforementioned target data acquisition timer task exists in the Runnable thread pool, then stop the task thread corresponding to the aforementioned target data acquisition timer task.

[0142] Understandably, after stopping the task thread corresponding to the aforementioned target data acquisition timer task from the Runnable thread pool, the number of existing data acquisition timer tasks in execution is reduced by 1.

[0143] Based on the above embodiments, the data acquisition timed task scheduling method further includes: when it is determined that the timed task scheduling service has been started and completed, receiving a manual operation instruction for the target data acquisition timed task, wherein the target data acquisition timed task is an existing data acquisition timed task that is being executed and requires manual operation.

[0144] If it is determined that there is a task thread in the target thread pool corresponding to the target data acquisition timed task, the target data acquisition timed task is executed based on the execution command input by the user.

[0145] Specifically, in this embodiment of the invention, an existing data acquisition timed task that requires manual operation can be identified as the target data acquisition timed task.

[0146] like Figure 4 As shown, when users need to manually operate the target data acquisition timed task, they can input manual operation commands for the target data acquisition timed task through the web interface.

[0147] It should be noted that the data processing and forwarding process of the manual operation instructions for the target data acquisition timed task can be found in the data processing and forwarding process of the task parameters for the newly created data acquisition timed task, and will not be repeated in this embodiment of the invention.

[0148] The data acquisition timed task scheduling device can receive manual operation instructions for the target data acquisition timed task.

[0149] After receiving the manual operation instruction for the target data acquisition timed task, the data acquisition timed task scheduling device can determine whether the task thread corresponding to the target data acquisition timed task exists in the Runnable thread pool.

[0150] If the task thread corresponding to the above target data acquisition timed task does not exist in the Runnable thread pool, it indicates an error and the manual operation of the target data acquisition and positioning task has failed.

[0151] If the target data acquisition timed task exists in the Runnable thread pool, the target data acquisition timed task can be executed based on the execution command input by the user.

[0152] Based on the above embodiments, the data acquisition timed task scheduling method further includes: when it is determined that the timed task scheduling service has been started, receiving a start execution instruction for a target data acquisition timed task, wherein the target data acquisition timed task is an existing data acquisition timed task that needs to be executed but has not yet been executed.

[0153] If it is determined that there is a task thread corresponding to the target data acquisition timed task in the target thread pool, a Redis lock corresponding to the modified data acquisition timed task is created using the identification information of the target data acquisition timed task as the key value.

[0154] If the Redis lock corresponding to the target data acquisition scheduled task is successfully created, the modified corn expression corresponding to the data acquisition scheduled task is generated based on the task parameters of the target data acquisition scheduled task. Then, the scheduledFuture interface and the ThreadPoolTaskScheduler scheduler are used to create the task thread corresponding to the target data acquisition scheduled task. The task thread corresponding to the target data acquisition scheduled task is then added to the target thread pool so that the target thread pool can execute the target data acquisition scheduled task on a scheduled basis based on the corn expression corresponding to the target data acquisition scheduled task.

[0155] Specifically, in this embodiment of the invention, an existing but unexecuted data acquisition timed task that needs to be executed can be determined as the target data acquisition timed task.

[0156] When a user needs to execute a scheduled task for target data acquisition, the user can input the start command for the scheduled task through the web interface.

[0157] It should be noted that the data processing and data forwarding process of the start execution instruction of the target data acquisition timed task can be found in the data processing and data forwarding process of the task parameters of the newly created data acquisition timed task, and will not be repeated in this embodiment of the invention.

[0158] The data acquisition timed task scheduling device can receive the start execution command for the target data acquisition timed task.

[0159] After receiving the start execution instruction of the target data acquisition timed task, the data acquisition timed task scheduling device can determine whether there is a task thread corresponding to the target data acquisition timed task in the Runnable thread pool.

[0160] If the task thread corresponding to the above target data acquisition timed task does not exist in the Runnable thread pool, it indicates an error and the target data acquisition and positioning task failed to start.

[0161] If the task thread corresponding to the aforementioned target data acquisition timed task exists in the Runnable thread pool, the specific steps to start and execute the target data acquisition timed task are as follows: Figure 2 As shown.

[0162] This invention, upon confirming the completion of the scheduled task service, if a target instruction for a target data acquisition and positioning task is obtained, determines whether a task thread corresponding to the target data acquisition and positioning task exists in the target thread pool. If such a task thread exists, the target instruction is executed on the task thread in the target thread pool. This allows for more flexible scheduling of existing scheduled data acquisition tasks and further improves the flexibility of dynamically acquiring rail transit operation data.

[0163] It's important to note that scheduled tasks generate corresponding logs during execution, recording the task's progress, including three states: failure, exception, and success, as well as the reasons for failure and exception. This information is stored in the database after the task is completed for user viewing.

[0164] When querying logs, you can use a single task as the aggregation condition and sort the logs in descending order of time. This makes the logs of each task clearer and allows users to quickly grasp the running status of the tasks.

[0165] Figure 5 This is a structural schematic diagram of the data acquisition timed task scheduling device provided by the present invention. The following is in conjunction with... Figure 5 The data acquisition timed task scheduling device provided by the present invention is described below. The data acquisition timed task scheduling device described below can be referred to in correspondence with the data acquisition timed task scheduling method provided by the present invention described above. For example... Figure 5 As shown, the device includes: a data acquisition module 501, a data processing module 502, and a task initiation module 503.

[0166] The data acquisition module 501 is used to acquire the task parameters of a newly created data acquisition timed task when it is determined that the timed task scheduling service has been started and completed. The task parameters include the task's identification information and execution cycle information.

[0167] The data processing module 502 is used to create a Redis lock corresponding to the newly created data acquisition timed task, using the identifier information of the newly created data acquisition timed task as the key value, when the number of existing data acquisition timed tasks in execution does not exceed a first preset value.

[0168] The task startup module 503 is used to start the execution of the new data collection and location task when it is determined that the Redis lock corresponding to the new data collection scheduled task has been successfully created.

[0169] Specifically, the data acquisition module 501, the data processing module 502, and the task initiation module 503 are electrically connected.

[0170] The data acquisition timed task scheduling device in this embodiment of the invention, upon determining that the timed task scheduling service has been started and completed, if the task parameters for a newly created data acquisition and positioning task are obtained, then determines whether the number of existing data acquisition timed tasks being executed exceeds a first preset value. If the number of existing data acquisition timed tasks being executed does not exceed the first preset value, a Redis lock corresponding to the newly created data acquisition timed task is created using the identifier information of the newly created data acquisition timed task as the key value. Upon determining that the Redis lock corresponding to the newly created data acquisition timed task has been successfully created, the execution of the newly created data acquisition and positioning task is started. This allows for simpler and more efficient addition of new data acquisition timed tasks, more flexible configuration of the execution cycle of new data acquisition timed tasks, and more flexible dynamic collection of rail transit operation data, thus better meeting the data collection needs of rail transit operation.

[0171] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include a processor 610, a communication interface 620, a memory 630, and a communication bus 640. The processor 610, communication interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute a data acquisition timed task scheduling method. This method includes: if the timed task scheduling service has been successfully started, obtaining task parameters for a newly created data acquisition timed task, including task identification information and execution cycle information; if the number of existing data acquisition timed tasks in execution does not exceed a first preset value, creating a Redis lock corresponding to the newly created data acquisition timed task using the identification information of the newly created data acquisition timed task as the key; and if the Redis lock corresponding to the newly created data acquisition timed task has been successfully created, starting the execution of the newly created data acquisition location task.

[0172] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0173] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the data acquisition timed task scheduling method provided by the above methods. The method includes: when it is determined that the timed task scheduling service has been started and completed, obtaining the task parameters of a newly created data acquisition timed task, the task parameters including task identification information and execution cycle information; when the number of existing data acquisition timed tasks in execution does not exceed a first preset value, creating a Redis lock corresponding to the newly created data acquisition timed task using the identification information of the newly created data acquisition timed task as the key value; and when it is determined that the Redis lock corresponding to the newly created data acquisition timed task has been successfully created, starting the execution of the newly created data acquisition location task.

[0174] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a data acquisition timed task scheduling method provided by the above methods. The method includes: when it is determined that the timed task scheduling service has been started and completed, obtaining task parameters for a newly created data acquisition timed task, the task parameters including task identification information and execution cycle information; when the number of existing data acquisition timed tasks in execution does not exceed a first preset value, creating a Redis lock corresponding to the newly created data acquisition timed task using the identification information of the newly created data acquisition timed task as the key value; and when it is determined that the Redis lock corresponding to the newly created data acquisition timed task has been successfully created, starting the execution of the newly created data acquisition location task.

[0175] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0176] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0177] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data acquisition timed task scheduling method, characterized in that, include: Once it is confirmed that the scheduled task service has been started and completed, the task parameters of the newly created data acquisition scheduled task are obtained. The task parameters include the task's identification information and execution cycle information. If the number of existing data acquisition timed tasks in execution does not exceed a first preset value, a Redis lock corresponding to the newly created data acquisition timed task is created using the identifier information of the newly created data acquisition timed task as the key value. If it is confirmed that the Redis lock corresponding to the newly created data collection scheduled task has been successfully created, the execution of the newly created data collection scheduled task will be started. The initiation of the execution of the newly created data acquisition scheduled task includes: Based on the task parameters of the newly created data acquisition scheduled task, generate the cron expression corresponding to the newly created data acquisition scheduled task, and use the ScheduledFuture interface and ThreadPoolTaskScheduler scheduler to create the task thread corresponding to the newly created data acquisition scheduled task. Add the task thread corresponding to the newly created data acquisition timed task to the target thread pool so that the target thread pool can execute the newly created data acquisition timed task on a timed basis based on the cr expression corresponding to the newly created data acquisition timed task. The method further includes: Once it is determined that the scheduled task service has been started and completed, a modification instruction for the target data acquisition scheduled task is obtained. The target data acquisition scheduled task is an existing data acquisition scheduled task that needs to be modified. The modification instruction carries the task parameters of the modified data acquisition scheduled task. If it is determined that a task thread corresponding to the target data acquisition timer task exists in the target thread pool, the task thread corresponding to the target data acquisition timer task is deleted, and a Redis lock corresponding to the modified data acquisition timer task is created using the identifier information of the modified data acquisition timer task as the key value. If the Redis lock corresponding to the modified data collection scheduled task is successfully created, a cron expression corresponding to the modified data collection scheduled task is generated based on the task parameters of the modified data collection scheduled task. Then, the task thread corresponding to the modified data collection scheduled task is created using the ScheduledFuture interface and the ThreadPoolTaskScheduler scheduler. The task thread corresponding to the modified data collection scheduled task is then added to the target thread pool so that the target thread pool can execute the newly created data collection scheduled task on a regular basis based on the cron expression corresponding to the modified data collection scheduled task.

2. The data acquisition timed task scheduling method according to claim 1, characterized in that, The specific steps for starting the task scheduling service include: Load the task parameters of all existing data acquisition timed tasks that have not yet been executed; Determine whether the number of existing data collection timed tasks in execution exceeds a second preset value. If the number of existing data collection timed tasks in execution does not exceed the second preset value, create a Redis lock corresponding to any unexecuted existing data collection timed task using the identifier information of any unexecuted existing data collection timed task as the key value. If it is determined that the Redis lock corresponding to any of the existing unexecuted data collection timed tasks has been successfully created, then the execution of any of the existing unexecuted data collection timed tasks will be started. Return to the step of determining whether the number of existing data acquisition timed tasks in execution exceeds the second preset value, until the number of existing data acquisition timed tasks in execution exceeds the second preset value, and confirm that the timed task scheduling service has been started successfully.

3. The data acquisition timed task scheduling method according to claim 2, characterized in that, If the number of existing data collection scheduled tasks in execution does not exceed the second preset value, after creating a Redis lock corresponding to any unexecuted existing data collection scheduled task using the identifier information of any unexecuted existing data collection scheduled task as the key, the method further includes: If the creation of the Redis lock corresponding to any unexecuted existing data collection scheduled task fails, remove the unexecuted existing data collection scheduled task from all unexecuted existing data collection scheduled tasks, and return to the step of determining whether the number of executed existing data collection scheduled tasks exceeds the second preset value, until the creation of the Redis lock corresponding to any unexecuted existing data collection scheduled task is successful.

4. The data acquisition timed task scheduling method according to claim 1, characterized in that, Also includes: If it is determined that the scheduled task scheduling service has been started and completed, a target instruction for the target data acquisition scheduled task is received. The target data acquisition scheduled task is an existing data acquisition scheduled task that is being executed. The target instruction includes any one of a delete instruction, a view instruction, and a stop instruction. If it is determined that the target thread pool contains a task thread corresponding to the target data acquisition timed task, the target instruction is executed on the task thread corresponding to the target data acquisition timed task.

5. The data acquisition timed task scheduling method according to claim 1, characterized in that, Also includes: Once it is determined that the scheduled task service has been started and completed, a manual operation instruction for the target data acquisition scheduled task is received. The target data acquisition scheduled task is an existing data acquisition scheduled task that is currently being executed and requires manual operation. If it is determined that the target thread pool contains a task thread corresponding to the target data acquisition timed task, the target data acquisition timed task is executed based on the execution command input by the user.

6. A data acquisition timed task scheduling device, characterized in that, include: The data acquisition module is used to acquire the task parameters of a newly created data acquisition scheduled task when it is determined that the scheduled task scheduling service has been started and completed. The task parameters include the task's identification information and execution cycle information. The data processing module is used to create a Redis lock corresponding to the newly created data acquisition timed task, using the identifier information of the newly created data acquisition timed task as the key value, when the number of existing data acquisition timed tasks in execution does not exceed a first preset value. The task startup module is used to start the execution of the newly created data collection scheduled task if it is determined that the Redis lock corresponding to the newly created data collection scheduled task has been successfully created. The initiation of the execution of the newly created data acquisition scheduled task includes: Based on the task parameters of the newly created data acquisition scheduled task, generate the cron expression corresponding to the newly created data acquisition scheduled task, and use the ScheduledFuture interface and ThreadPoolTaskScheduler scheduler to create the task thread corresponding to the newly created data acquisition scheduled task. Add the task thread corresponding to the newly created data acquisition timed task to the target thread pool so that the target thread pool can execute the newly created data acquisition timed task on a timed basis based on the cr expression corresponding to the newly created data acquisition timed task. The data acquisition module is also used for: Once it is determined that the scheduled task service has been started and completed, a modification instruction for the target data acquisition scheduled task is obtained. The target data acquisition scheduled task is an existing data acquisition scheduled task that needs to be modified. The modification instruction carries the task parameters of the modified data acquisition scheduled task. If it is determined that a task thread corresponding to the target data acquisition timer task exists in the target thread pool, the task thread corresponding to the target data acquisition timer task is deleted, and a Redis lock corresponding to the modified data acquisition timer task is created using the identifier information of the modified data acquisition timer task as the key value. If the Redis lock corresponding to the modified data collection scheduled task is successfully created, a cron expression corresponding to the modified data collection scheduled task is generated based on the task parameters of the modified data collection scheduled task. Then, the task thread corresponding to the modified data collection scheduled task is created using the ScheduledFuture interface and the ThreadPoolTaskScheduler scheduler. The task thread corresponding to the modified data collection scheduled task is then added to the target thread pool so that the target thread pool can execute the newly created data collection scheduled task on a regular basis based on the cron expression corresponding to the modified data collection scheduled task.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the data acquisition timed task scheduling method as described in any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data acquisition timed task scheduling method as described in any one of claims 1 to 5.