CN116431313A - Scheduling method, device, equipment and medium for polling task - Google Patents

Scheduling method, device, equipment and medium for polling task Download PDF

Info

Publication number
CN116431313A
CN116431313A CN202310513561.0A CN202310513561A CN116431313A CN 116431313 A CN116431313 A CN 116431313A CN 202310513561 A CN202310513561 A CN 202310513561A CN 116431313 A CN116431313 A CN 116431313A
Authority
CN
China
Prior art keywords
polling
task
polling task
moment
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310513561.0A
Other languages
Chinese (zh)
Inventor
何志威
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Shuncom Smart Technology Co ltd
Original Assignee
Shanghai Shuncom Smart Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Shuncom Smart Technology Co ltd filed Critical Shanghai Shuncom Smart Technology Co ltd
Priority to CN202310513561.0A priority Critical patent/CN116431313A/en
Publication of CN116431313A publication Critical patent/CN116431313A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the invention discloses a scheduling method, device, equipment and medium of a polling task. Wherein the method comprises the following steps: acquiring polling task information; the polling task information comprises a polling task and a default polling period; determining a target polling moment according to the default polling period; judging whether the polling task meets an execution condition or not; and when the time reaches the target polling moment, if the polling task meets the execution condition, executing the polling task, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the moment of executing the polling task next time. According to the technical scheme, the execution polling time of each polling task can be dynamically adjusted, the excessive concentration of execution time points of the tasks is prevented, and the dispatching efficiency of a large number of periodic polling tasks is ensured.

Description

Scheduling method, device, equipment and medium for polling task
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for scheduling a polling task.
Background
The internet of things integrates wireless sensing, intelligent sensing, identification, ubiquitous network, cloud computing and other technologies, and is considered to be a development direction with wide prospects in the field of information industry. The Internet of things service platform combines the Internet of things services which are originally isolated from each other, provides comprehensive service support and service, enables various applications to comprehensively utilize resources and shared information, and greatly promotes the application and development of the Internet of things.
However, the conventional polling task processing mechanism is often designed and processed according to the polling period of the task, which easily causes too centralized execution time points of the polling task and cannot adapt to the scheduling of a large number of periodic polling tasks.
Disclosure of Invention
The invention provides a polling task scheduling method, a polling task scheduling device and a polling task scheduling medium, which can dynamically adjust the polling execution time of each polling task, prevent the excessive concentration of the task execution time points and ensure the scheduling efficiency of a large number of periodic polling tasks.
According to an aspect of the present invention, there is provided a scheduling method of a polling task, including:
acquiring polling task information; the polling task information comprises a polling task and a default polling period;
determining a target polling moment according to the default polling period;
judging whether the polling task meets an execution condition or not;
and when the time reaches the target polling moment, if the polling task meets the execution condition, executing the polling task, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the moment of executing the polling task next time.
Optionally, determining the target polling moment according to the default polling period includes:
linearly superposing the default polling period and a preset random time to obtain a target polling moment; wherein the preset random time is less than the default polling period.
Optionally, the determining whether the polling task meets an execution condition includes:
judging whether the polling task is an effective polling task or not;
if the polling task is an effective polling task, judging whether the equipment state corresponding to the effective polling task is an on-line state or not;
and if the equipment state corresponding to the effective polling task is an on-line state, the polling task meets the execution condition.
Optionally, the method further comprises:
if the polling task is an effective polling task, judging whether the polling task meets a pause condition or not; the pause condition is that the equipment state corresponding to the polling task is in an offline state;
and if the polling task meets the pause condition, caching the polling task.
Optionally, the method further comprises:
monitoring state information of equipment corresponding to the cached polling task;
and if the equipment corresponding to the polling task is in an on-line state, removing the polling task from the cache and restoring execution.
Optionally, the method further comprises:
monitoring a polling task adding event;
performing one-time execution operation on the added polling task according to the set execution time, and executing to acquire polling task information; determining a target polling moment according to the default polling period; judging whether the polling task meets an execution condition or not; and when the time reaches the target polling moment, if the polling task meets the execution condition, executing the polling task, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the next moment of executing the polling task.
Optionally, after acquiring the polling task information, the method further includes:
and acquiring new polling task information, and correcting the polling task information according to the new polling task information.
According to another aspect of the present invention, there is provided a scheduling apparatus for a polling task, including:
the information acquisition module is used for acquiring polling task information; the polling task information comprises a polling task and a default polling period;
the target polling moment determining module is used for determining target polling moment according to the default polling period;
the execution condition judging module is used for judging whether the polling task meets the execution condition or not;
and the polling task execution module is used for executing the polling task when the time reaches the target polling moment, if the task meets the execution condition, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the moment of executing the polling task next time.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the scheduling method of polling tasks according to any of the embodiments of the invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a scheduling method for polling tasks according to any of the embodiments of the present invention.
According to the technical scheme, polling task information is acquired; the polling task information comprises a polling task and a default polling period; determining a target polling moment according to the default polling period; judging whether the polling task meets an execution condition or not; and when the time reaches the target polling moment, if the task meets the execution condition, executing the polling task, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the moment of executing the polling task next time. According to the technical scheme, the execution polling time of each polling task can be dynamically adjusted, the excessive concentration of execution time points of the tasks is prevented, and the dispatching efficiency of a large number of periodic polling tasks is ensured.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for scheduling polling tasks according to a first embodiment of the invention;
fig. 2 is a flowchart of a method for scheduling a polling task according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a scheduling device for polling task according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a polling task scheduling method according to an embodiment of the present invention, where the method may be applied to a case of scheduling a large number of polling tasks, and the method may be performed by a polling task scheduling device, where the polling task scheduling device may be implemented in hardware and/or software, and where the polling task scheduling device may be configured in an electronic device having data processing capabilities. As shown in fig. 1, the method includes:
s110, acquiring polling task information.
Wherein the polling task information includes a polling task and a default polling period. A polling task may be understood as periodically sending a query instruction to a target device to obtain the latest data of the target device. The default polling period can be understood as a static polling period preset by a polling task; the configuration acquisition of the query task can be realized, and the modification can be performed according to the actual requirements. The method can be executed by a polling scheduling system and can be used for scheduling a large number of periodic polling tasks; wherein a large number of periodic polling tasks may refer to ten thousand or more polling tasks. In this embodiment, the polling task information may be acquired from an external service. The external service may be a data loading service, which may be loaded from a database or from a third party system.
Further, the polling scheduling system in this embodiment acquires polling task information from an external service when started, and there are a large number of tasks to be scheduled, and a timer implemented based on a "time-round" algorithm is typically used to schedule the tasks. Scheduling may be understood as triggering the execution of registered tasks at a set point in time, this set procedure being described as scheduling tasks; scheduled tasks may be canceled.
The embodiment can delay the random time re-execution of the scheduling operation for each task; the default polling period, task detail content and the like of the task can be queried when the polling task is arranged, so that the polling task is a relatively time-consuming and resource-consuming operation. The scheduling operation of the random delay tasks can be set with the load of the platform system. Illustratively, the random delay time interval may be any one value between 0 and a half of the default polling period of the acquired task, so as to facilitate both timeliness of task scheduling and dispersion of execution time points. When a task is scheduled, the next execution time point of the task may be the acquired task polling period.
S120, determining target polling time according to the default polling period.
The target polling time may be understood as a target polling time point of each polling task. The target polling moment in this embodiment may be determined by its associated polling period policy. For example, the polling period policy in this embodiment may be a default polling period associated with a task plus or minus a random time (the random time interval is between 0 and a value of the task polling period/5), that is, the polling target polling time obtained by the polling policy is dynamically changed each time. In this embodiment, the target polling time of the polling task may be determined according to a default polling period.
In this embodiment, optionally, determining the target polling time according to the default polling period includes: and linearly superposing the default polling period and a preset random time to obtain a target polling moment. Wherein the preset random time is less than the default polling period.
The preset random time may be any value between a first set value and a value obtained by dividing an initial polling period by a second set value. Specifically, in this embodiment, the first set value may be 0, and the second set value may be 5. The first set value and the second set value can be set according to actual requirements. The linear superposition may be an operation of directly adding the default polling period to a pre-random time.
In this embodiment, the default polling period and the preset random time may be linearly overlapped to obtain the target polling time; or in this embodiment, the default polling period may be subtracted from the preset random time to obtain the target polling time.
For example, if the default polling period of the polling task is 30 minutes, the interval of random time may be any one value between 0 and 6, and the target polling time is the default polling period plus or minus the preset random time, and the target polling time may be any one value between 24 minutes and 36 minutes.
In this embodiment, the target polling time is determined according to the default polling period, so that the target polling time of each polling task is dynamically adjusted, and the execution time points of the tasks can be prevented from being too concentrated, so as to ensure that the load of the polling scheduling system is relatively stable.
S130, judging whether the polling task meets an execution condition.
The execution condition may be understood as a condition under which the polling task may be executed. The execution conditions in this embodiment may be conditions for determining whether the polling task is effective, whether the device state corresponding to the polling task is online, and the like, and may also be set according to actual requirements. In this embodiment, it may be determined whether the polling task satisfies the execution condition.
In this embodiment, optionally, the determining whether the polling task meets an execution condition includes: judging whether the polling task is an effective polling task or not; if the polling task is an effective polling task, judging whether the equipment state corresponding to the effective polling task is an on-line state or not; and if the equipment state corresponding to the effective polling task is an on-line state, the polling task meets the execution condition.
Wherein, an active polling task may be understood as the device associated with the polling task is active. In this embodiment, whether the polling task is a valid polling task may be determined by whether the device associated with the polling task can be retrieved; if the equipment associated with the polling task can be retrieved, the polling task is indicated to be an effective polling task, and whether the equipment state corresponding to the polling task is an on-line state or not is continuously judged; if the device associated with the polling task cannot be retrieved, the polling task is indicated as an invalid polling task, the invalid polling task is immediately suspended, and the next execution operation is not scheduled. In this embodiment, if it is determined that the device state corresponding to the polling task is an on-line state, it is indicated that the polling task satisfies the execution condition.
Through the arrangement, whether the polling task meets the execution condition or not can be judged, and the polling task can be executed only if the polling task meets the execution condition, so that the execution efficiency of the polling task is improved.
And S140, when the time reaches the target polling moment, if the polling task meets the execution condition, executing the polling task, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the moment of executing the polling task next time.
In this embodiment, when the time reaches the target polling time, if it is determined that the polling task meets the execution condition, the polling task is executed, and the operation of determining the target polling time according to the default polling period is returned to be executed, so as to continuously determine the time of executing the polling task next time.
According to the technical scheme, polling task information is acquired; the polling task information comprises a polling task and a default polling period; determining a target polling moment according to the default polling period; judging whether the polling task meets an execution condition or not; and if the polling task meets the execution condition, executing the polling task when the time reaches the target polling moment, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the moment of executing the polling task next time. According to the technical scheme, the execution polling time of each polling task can be dynamically adjusted, the excessive concentration of execution time points of the tasks is prevented, and the dispatching efficiency of a large number of periodic polling tasks is ensured.
Example two
Fig. 2 is a flowchart of a polling task scheduling method according to a second embodiment of the present invention, which is optimized based on the foregoing embodiment. The concrete optimization is as follows: further comprises: if the polling task is an effective polling task, judging whether the polling task meets a pause condition or not; the pause condition is that the equipment state corresponding to the polling task is in an offline state; and if the polling task meets the pause condition, caching the polling task. As shown in fig. 2, the method includes:
s210, acquiring polling task information.
Wherein the polling task information includes a polling task and a default polling period.
S220, determining target polling time according to the default polling period.
S230, judging whether the polling task is an effective polling task.
S240, if the polling task is an effective polling task, judging whether the polling task meets a pause condition.
The pause condition is that the equipment state corresponding to the polling task is in an offline state;
if the polling task in the embodiment does not meet the execution condition, determining whether a pause condition is met according to whether the equipment state corresponding to the polling task is an offline state; if the equipment state corresponding to the polling task is an offline state, the polling task meets a pause condition; if the device state corresponding to the polling task is not an offline state but is other conditions, the polling task does not meet the suspension condition.
S250, if the polling task meets a pause condition, caching the polling task.
In this embodiment, if the device state corresponding to the polling task is an offline state, it is indicated that the polling task meets a suspension condition, and the polling task may be suspended, and the task information may be summarized and cached, so that the next execution is not scheduled.
According to the technical scheme, polling task information is acquired; the polling task information comprises a polling task and a default polling period; determining a target polling moment according to the default polling period; judging whether the polling task is an effective polling task or not; if the polling task is an effective polling task, judging whether the polling task meets a pause condition or not; the pause condition is that the equipment state corresponding to the polling task is in an offline state; and if the polling task meets the pause condition, caching the polling task. According to the technical scheme, the polling task can be executed when the execution condition is met, whether the pause condition is met or not is judged when the execution condition is not met, the polling task is paused, and the resource occupation of a system is further reduced.
In this embodiment, optionally, the method further includes: monitoring state information of equipment corresponding to the cached polling task; and if the equipment corresponding to the polling task is in an on-line state, removing the polling task from the cache and restoring execution.
Wherein the listening may be performed through an external interface of the system. The external interface may be understood as notification information of the third party service. The status information of the device may be understood as on-line or off-line status information of the device. According to the embodiment, the state information of the device corresponding to the cached polling task can be monitored according to an external interface provided by the system, and whether the polling task corresponding to the device needs to be restored can be judged according to the type of the monitored event and the data related to the monitored event; in this embodiment, the type of the event that can be monitored and the associated data thereof may be that the device corresponding to the monitored polling task is offline, and then the polling task is suspended; or if the equipment corresponding to the polling task is monitored to be online, the polling task is restored; or the type of the event such as alarm or abnormality can be monitored, and the corresponding operation can be set according to the actual requirement. In this embodiment, if the task is allowed to be recovered, the polling task may be acquired and removed from the cache, and the next execution operation of the polling task is scheduled by the polling task information recovery.
In this embodiment, if the device corresponding to the polling task is monitored to be in an on-line state, the polling task may be removed from the cache and execution may be resumed. Through the arrangement, the suspension and the recovery of the polling task can be realized according to the actual situation, so that the polling task can be reasonably executed, the resource occupation of a system can be reduced, and the execution efficiency of the polling task can be improved.
In addition, the system in this embodiment further increases fault tolerant logic, and when the notification of other systems may fail, the uplink information of the device corresponding to the polling task may not be monitored; therefore, in this embodiment, after the polling task information is cached, a "task recovery operation task" may be further arranged, and the execution time point may be greater than the polling period, and exemplary, the execution time point may be set to be 24×24 of the acquired target polling time, or may be set according to the actual requirement; the polling task can be executed according to the execution time point, when the polling task is executed, the polling task information is obtained and removed from the cache, and the next execution of the scheduled task is recovered through the polling task information. Further, if the device corresponding to the polling task is judged to be on-line through monitoring and the polling task corresponding to the device is recovered, the additionally arranged task recovery operation task is canceled.
In this embodiment, optionally, the method further includes: monitoring a polling task adding event; performing one-time execution operation on the added polling task according to the set execution time, and executing to acquire polling task information; determining a target polling moment according to the default polling period; judging whether the polling task meets an execution condition or not; and when the time reaches the target polling moment, if the polling task meets the execution condition, executing the polling task, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the next moment of executing the polling task.
The polling task adding event may be understood as adding a device corresponding to the system, that is, adding a polling task corresponding to the device. In this embodiment, the polling scheduling system has a scenario of registering devices in batches, that is, the event amount of device increase may be relatively large. The set execution time can be understood as a preset execution time point; the set execution time of the task in this embodiment may be a random time, and the random time may be, for example, a random time between 0 and (acquired task polling period/5). A single execution operation is understood to be an execution operation that is performed only once.
In this embodiment, for the monitored polling task adding event, the execution logic may be to obtain polling task information; determining a target polling moment according to a default polling period to judge whether the polling task judges whether an execution condition is met or not; and if the polling task meets the execution condition, executing the polling task when the time reaches the target polling moment, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the next moment of executing the polling task. However, it is also necessary to additionally schedule the execution of a disposable polling task, and after the execution of the disposable polling task is completed, the next task is not scheduled; and when the operation of the one-time polling task is performed, the operation is performed according to the normal execution logic of the polling task. In this embodiment, if a device removal event is monitored, if a device has an already arranged polling task, the polling task corresponding to the device is cancelled; if the temporarily stored task exists, the temporarily stored task information is cleared, and the task recovery operation task is canceled.
Through the arrangement in the embodiment, the one-time execution operation can be additionally performed on the increased polling task event, so as to ensure that the system can acquire the device data as soon as possible.
In this embodiment, optionally, after acquiring the polling task information, the method further includes: and acquiring new polling task information, and correcting the polling task information according to the new polling task information.
The new polling task information may be understood as polling task information acquired in real time from an external service. The embodiment can set to acquire new polling task information periodically; the periodic time can be set to one day or two days, and the setting can be performed according to actual requirements. Correction may be understood as a post-contrast correction; for example, the correction operation may be performed by adding a polling task corresponding to the missing device or removing an unnecessary polling task in the polling scheduling system.
In this embodiment, according to the new polling task information obtained periodically, the new polling task information and the polling task information in the current polling scheduling system may be compared and corrected, so as to increase the polling tasks corresponding to the missing devices or remove the redundant polling tasks in the polling scheduling system.
In this embodiment, the adding and removing time of the device may be monitored through an external interface provided by the third party service, so that the corresponding polling task is added and removed, and the polling task can be dynamically added and removed; however, there are cases where notification of the third party service may fail, and thus correction logic is added in this embodiment. In this embodiment, the polling scheduling system may compare task information in the current polling scheduling system with task information acquired from an external service (acquired in real time) periodically (or with a longer period), and add a polling task of a missing device or remove an unnecessary polling task in the system.
In this embodiment, by means of such a setting, the acquired polling task can be corrected according to the set period, so that the executed polling task can be more accurate, and therefore, the scheduling efficiency of a large number of periodic polling tasks is ensured.
Example III
Fig. 3 is a schematic structural diagram of a polling task scheduling device according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes:
an information acquisition module 310, configured to acquire polling task information; the polling task information comprises a polling task and a default polling period;
a target polling moment determining module 320, configured to determine a target polling moment according to the default polling period;
an execution condition judgment module 330, configured to judge whether the polling task meets an execution condition;
and the polling task execution module 340 is configured to execute the polling task when the time reaches the target polling time, and return to execute the operation of determining the target polling time according to the default polling period to determine the next time of executing the polling task if the polling task meets the execution condition.
Optionally, the target polling moment determining module 320 is specifically configured to:
linearly superposing the default polling period and a preset random time to obtain a target polling moment; wherein the preset random time is less than the default polling period.
Optionally, the execution condition determining module 330 is specifically configured to:
judging whether the polling task is an effective polling task or not;
if the polling task is an effective polling task, judging whether the equipment state corresponding to the effective polling task is an on-line state or not;
and if the equipment state corresponding to the effective polling task is an on-line state, the polling task meets the execution condition.
Optionally, the method further comprises:
the temporary storage task module is used for judging whether the polling task meets a pause condition if the polling task is an effective polling task; the pause condition is that the equipment state corresponding to the polling task is in an offline state;
and if the polling task meets the pause condition, caching the polling task.
Optionally, the method further comprises: a state monitoring module, configured to:
monitoring state information of equipment corresponding to the cached polling task;
and if the equipment corresponding to the polling task is in an on-line state, removing the polling task from the cache and restoring execution.
Optionally, the method further comprises: a task adding event monitoring module, configured to:
monitoring a polling task adding event;
performing one-time execution operation on the added polling task according to the set execution time, and executing to acquire polling task information; determining a target polling moment according to the default polling period; judging whether the polling task meets an execution condition or not; and if the polling task meets the execution condition, executing the polling task when the time reaches the target polling moment, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the next moment of executing the polling task.
Optionally, the method further comprises: and the task correction module is used for acquiring new polling task information after acquiring the polling task information, and correcting the polling task information according to the new polling task information.
The scheduling device for the polling task provided by the embodiment of the invention can execute the scheduling method for the polling task provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the scheduling method of polling tasks.
In some embodiments, the scheduling method of polling tasks may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the above-described scheduling method of polling tasks may be performed. Alternatively, in other embodiments, the processor 11 may be configured in any other suitable manner (e.g., by means of firmware) to perform the scheduling method of the polling task.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for scheduling a polling task, comprising:
acquiring polling task information; the polling task information comprises a polling task and a default polling period;
determining a target polling moment according to the default polling period;
judging whether the polling task meets an execution condition or not;
and when the time reaches the target polling moment, if the polling task meets the execution condition, executing the polling task, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the moment of executing the polling task next time.
2. The method of claim 1, wherein determining a target polling moment from the default polling period comprises:
linearly superposing the default polling period and a preset random time to obtain a target polling moment; wherein the preset random time is less than the default polling period.
3. The method of claim 1, wherein determining whether the polling task satisfies an execution condition comprises:
judging whether the polling task is an effective polling task or not;
if the polling task is an effective polling task, judging whether the equipment state corresponding to the effective polling task is an on-line state or not;
and if the equipment state corresponding to the effective polling task is an on-line state, the polling task meets the execution condition.
4. A method according to claim 3, further comprising:
if the polling task is an effective polling task, judging whether the polling task meets a pause condition or not; the pause condition is that the equipment state corresponding to the polling task is in an offline state;
and if the polling task meets the pause condition, caching the polling task.
5. The method as recited in claim 4, further comprising:
monitoring state information of equipment corresponding to the cached polling task;
and if the equipment corresponding to the polling task is in an on-line state, removing the polling task from the cache and restoring execution.
6. The method as recited in claim 1, further comprising:
monitoring a polling task adding event;
performing one-time execution operation on the added polling task according to the set execution time, and executing to acquire polling task information; determining a target polling moment according to the default polling period; judging whether the polling task meets an execution condition or not; and when the time reaches the target polling moment, if the polling task meets the execution condition, executing the polling task, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the next moment of executing the polling task.
7. The method of claim 1, further comprising, after acquiring the polling task information:
and acquiring new polling task information, and correcting the polling task information according to the new polling task information.
8. A scheduling apparatus for a polling task, comprising:
the information acquisition module is used for acquiring polling task information; the polling task information comprises a polling task and a default polling period;
the target polling moment determining module is used for determining target polling moment according to the default polling period;
the execution condition judging module is used for judging whether the polling task meets the execution condition or not;
and the polling task execution module is used for executing the polling task if the polling task meets the execution condition when the time reaches the target polling moment, and returning to execute the operation of determining the target polling moment according to the default polling period so as to determine the moment of executing the polling task next time.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform a method of scheduling polling tasks according to any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform a method of scheduling polling tasks according to any one of claims 1-7.
CN202310513561.0A 2023-05-08 2023-05-08 Scheduling method, device, equipment and medium for polling task Pending CN116431313A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310513561.0A CN116431313A (en) 2023-05-08 2023-05-08 Scheduling method, device, equipment and medium for polling task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310513561.0A CN116431313A (en) 2023-05-08 2023-05-08 Scheduling method, device, equipment and medium for polling task

Publications (1)

Publication Number Publication Date
CN116431313A true CN116431313A (en) 2023-07-14

Family

ID=87081559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310513561.0A Pending CN116431313A (en) 2023-05-08 2023-05-08 Scheduling method, device, equipment and medium for polling task

Country Status (1)

Country Link
CN (1) CN116431313A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117311772A (en) * 2023-11-30 2023-12-29 中控技术股份有限公司 Configuration updating method, device, equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117311772A (en) * 2023-11-30 2023-12-29 中控技术股份有限公司 Configuration updating method, device, equipment and medium
CN117311772B (en) * 2023-11-30 2024-02-06 中控技术股份有限公司 Configuration updating method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN116431313A (en) Scheduling method, device, equipment and medium for polling task
CN115328741A (en) Exception handling method, device, equipment and storage medium
CN115964153A (en) Asynchronous task processing method, device, equipment and storage medium
CN112948081B (en) Method, device, equipment and storage medium for processing tasks in delayed mode
CN115426287B (en) System monitoring and optimizing method and device, electronic equipment and medium
CN116661960A (en) Batch task processing method, device, equipment and storage medium
CN116450176A (en) Version updating method and device, electronic equipment and storage medium
CN116090780A (en) Control method, device, equipment and medium of weather forecast flow
CN113590287B (en) Task processing method, device, equipment, storage medium and scheduling system
CN113656239A (en) Monitoring method and device for middleware and computer program product
CN116244324B (en) Task data relation mining method and device, electronic equipment and storage medium
CN117608932A (en) Processing method, device, equipment and medium for delay task
CN115718608A (en) Parameter updating method and device, electronic equipment and storage medium
CN116319758A (en) Data migration method, device, electronic equipment and readable storage medium
CN117194113A (en) Container snapshot generation method, device, equipment and medium
CN117743467A (en) Agent node replacement method, device, equipment and storage medium
CN117520456A (en) Data synchronization method and device, electronic equipment and storage medium
CN116303070A (en) Abnormality detection method, device, equipment and medium
CN117331716A (en) Message processing method and system
CN116302796A (en) Process monitoring method and device, electronic equipment and storage medium
CN118101537A (en) Gateway monitoring method and device, system-level chip and electronic equipment
CN114844920A (en) Internet of things equipment checking method and device, electronic equipment and storage medium
CN117290179A (en) Method, device, equipment and storage medium for determining event timeout state
CN116974825A (en) Backup method, device, equipment and storage medium
CN115904701A (en) Parameter refreshing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination