WO2020192733A1 - 定时任务配置方法、服务器、系统和计算机可读存储介质 - Google Patents

定时任务配置方法、服务器、系统和计算机可读存储介质 Download PDF

Info

Publication number
WO2020192733A1
WO2020192733A1 PCT/CN2020/081398 CN2020081398W WO2020192733A1 WO 2020192733 A1 WO2020192733 A1 WO 2020192733A1 CN 2020081398 W CN2020081398 W CN 2020081398W WO 2020192733 A1 WO2020192733 A1 WO 2020192733A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
timing task
timing
server
terminal device
Prior art date
Application number
PCT/CN2020/081398
Other languages
English (en)
French (fr)
Inventor
郑旭
刘超
Original Assignee
京东方科技集团股份有限公司
京东方光科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 京东方科技集团股份有限公司, 京东方光科技有限公司 filed Critical 京东方科技集团股份有限公司
Publication of WO2020192733A1 publication Critical patent/WO2020192733A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications

Definitions

  • the present disclosure relates to the technical field of the Internet of Things, and in particular to a method, a server, a system, and a computer-readable storage medium for configuring a timing task for an Internet of Things device.
  • the Internet of Things is an important part of the new generation of information technology, and its English name is "The Internet of Things". As the name suggests, the Internet of Things is the Internet of things connected. This has two meanings: First, the core and foundation of the Internet of Things is still the Internet, which is an extended and expanded network based on the Internet; second, its user end extends and extends to any item and item to carry out information Exchange and communication.
  • the Internet of Things is the "Internet of Things Connected”.
  • the Internet of Things is widely used in the integration of networks through intelligent perception, recognition technology and pervasive computing, and is therefore known as the third wave of the development of the world's information industry after computers and the Internet.
  • the Internet of Things is the application expansion of the Internet. The Internet of Things is not so much a network as it is a business and an application.
  • a method for configuring a timed task on a server side including: obtaining a timed task created according to business requirements; monitoring whether the timed task is triggered; When triggered, an instruction related to the timing task is sent to the Internet of Things terminal subsystem to instruct the Internet of Things terminal subsystem to perform the timing task.
  • the method further includes: when the timed task is triggered, using a task executor of the server to execute business logic processing corresponding to the timed task, and generate instructions related to the timed task.
  • the method further includes: using a distributed task queue mechanism to configure a timing task trigger unit and configure a task execution unit as a task executor of the server.
  • the method further includes: using a timing task trigger unit to trigger the timing task; and using an intermediary in a distributed task queue mechanism to obtain the timing task triggered by the timing task trigger unit.
  • monitoring whether the timed task is triggered includes: monitoring by the task execution unit whether the intermediary has acquired the timed task triggered by the timed task triggering unit, so as to determine whether the timed task is triggered .
  • sending the instruction related to the timing task to the IoT terminal subsystem includes: sending the instruction related to the timing task to the IoT terminal subsystem via the message middleware of the service interface layer .
  • the message middleware of the service interface layer is a message middleware based on a message queue telemetry transmission protocol; wherein, the Internet of Things terminal subsystem includes a gateway device and a terminal device;
  • the message middleware at the service interface layer sends instructions related to the timing task to the IoT terminal subsystem so that the IoT terminal subsystem executes the timing task including: the message middleware at the service interface layer communicates with the The instructions related to the timing task are sent to the gateway device, so that the gateway device controls the terminal device to perform operations corresponding to the instructions related to the timing task and receive information from the terminal device.
  • timing task includes: data collection or switch control of the terminal device.
  • the instructions related to the timing task include: numerical value collection instructions and/or status collection instructions, the value collection instructions are used to collect various measurement data of the terminal equipment, and the status collection instructions are used to collect the terminal equipment Data on the on/off state of various switches in the terminal; and switch control instructions, which are used to control the on/off state of various switches in the terminal device.
  • the method further includes: receiving information from the terminal device from the gateway device through the message middleware of the service interface layer, and storing it in the result storage unit (Backend), wherein the information from the terminal device
  • the device information includes: measurement data of the terminal device and/or data of the open or closed state of various switches in the terminal device.
  • the method further includes: obtaining the execution record of the timing task from the result storage unit (Backend) for analysis, and judging whether the server is required to perform further operations according to a preset logic.
  • the method further includes: managing timed tasks through a background management platform, where the background management platform is used to add, delete, modify, and query timed tasks according to user-defined editing rules. At least one operation.
  • a server including a processor; and a memory, configured to store computer-executable instructions that, when run by the processor, cause the processor to perform the method described above .
  • a system for performing timing tasks including: a server; an IoT terminal subsystem, which receives instructions related to the timing task from the server and returns information to the server, the IoT terminal
  • the subsystem includes: a gateway device, which controls the terminal device to perform operations corresponding to the instruction related to the timing task according to the instruction related to the timing task received from the server, and returns the information from the terminal device to the The server; terminal device, the terminal device communicates with the gateway device, performs operations corresponding to instructions related to timing tasks under the control of the gateway device, and reports information to the gateway device.
  • Fig. 1 shows the steps of a method for configuring a timed task on the server side according to an embodiment of the present disclosure.
  • Fig. 2 shows the steps of a method for configuring a timed task based on a distributed task queue (Celery) mechanism on the server side according to another embodiment of the present disclosure.
  • Fig. 3 shows the steps of a method for configuring a timing task based on the Celery mechanism on the server side according to another embodiment of the present disclosure.
  • Fig. 4 shows a schematic diagram of a system for executing timing tasks according to an embodiment of the present disclosure.
  • FIG. 5 shows a schematic diagram of the operation flow of the system of FIG. 4 when performing a timing task of data collection according to an embodiment of the present disclosure.
  • FIG. 6 shows a schematic diagram of the operation flow of the system of FIG. 4 when a timing task of switch control is executed according to an embodiment of the present disclosure.
  • Fig. 7 shows a schematic diagram of a server for configuring timing tasks according to an embodiment of the present disclosure.
  • Fig. 8 shows a schematic diagram of a background management platform for managing timing tasks according to an embodiment of the present disclosure.
  • the Internet of Things terminal devices include, for example, sensors (such as wireless sensors, smart sensors, etc.), meters, and Internet of Things. Switches, power electronic equipment, etc. For example, the value of each sensor as a terminal device is collected regularly to determine whether each sensor is working normally, and the audio is regularly turned on to play wake-up music every working day.
  • the timing function can be implemented in the terminal device or the Internet of Things gateway to control the terminal device to perform tasks on a regular basis, but this method cannot remotely control the terminal device timing, and it cannot conveniently manage, schedule and control the timing according to actual business needs. task.
  • the present disclosure proposes a method and system for realizing the configuration of timed tasks on the server side.
  • FIG. 4 shows a schematic diagram of a system 400 for executing timing tasks according to an embodiment of the present disclosure.
  • the system for performing timing tasks includes: a server 401; and an IoT terminal subsystem 402.
  • the IoT terminal subsystem may include, for example, a gateway device 4021 and a terminal device 4022.
  • Fig. 1 shows the steps of a method 100 for configuring a scheduled task on the server side according to an embodiment of the present disclosure.
  • step S110 timed tasks created according to business requirements are acquired.
  • timing tasks can include: data collection or switch control of terminal equipment (that is, time data collection of various meters, switches, power electronic equipment, etc. as terminal equipment, and the open/close state of various switches. Collection of switch status, and timing control of the on/off status of various switches).
  • step S120 it is monitored whether the timing task is triggered.
  • step S130 when the timing task is triggered, the server sends instructions related to the timing task to the IoT terminal subsystem to instruct the IoT terminal subsystem to execute the corresponding timing task.
  • the server sends instructions related to timing tasks to the IoT terminal subsystem via the message middleware of the service interface layer.
  • the message middleware at the service interface layer includes, for example, a message middleware based on the message queue telemetry transmission MQTT protocol (for ease of description, it may be called "message middleware MQTT").
  • the task executor on the server side when it is determined that the timed task is triggered, the task executor on the server side is used to execute the business logic processing corresponding to the timed task and generate instructions related to the timed task.
  • the task executor on the server side Through the above method of configuring timed tasks on the server side, it is possible to create timed tasks for terminal devices according to requirements, so as to further realize the configuration of related timed tasks of terminal devices on the server side to manage, schedule and control the timed tasks.
  • Fig. 2 shows the steps of a method for configuring a timed task based on a distributed task queue (Celery) mechanism on the server side according to an embodiment of the present disclosure.
  • step 210 is the same as step 110.
  • a distributed task queue (Celery) mechanism is used in the server to configure the timing task trigger unit (Celery Beat) and configure the task execution unit as the task executor ( Celery Work).
  • Celery is a distributed task scheduling module developed using Python, so for a large number of systems built using Python, it can be said to be seamless and easy to use.
  • the Python language is gaining attention nowadays. Its clear and concise syntax makes debugging easier, and it has some powerful architectures that can express very complex logic. It has a very powerful framework that supports asynchronous such as Eventlet NetWorking Library.
  • Python can save a lot of time during program development because it does not require compilation and linking and is easy to debug.
  • the Celery mechanism focuses on real-time processing tasks and also supports timing scheduling of tasks.
  • the Celery mechanism includes a timing task trigger unit (Celery Beat), a task execution unit (Celery Work), a middleman (Broker), and a result memory (Backend).
  • the timing task of the Celery mechanism is first created in the configuration, and then the timing task trigger unit (Celery Beat) is run to trigger.
  • the timed task trigger unit (Celery Beat) can trigger the timed task according to the time zone in settings.py; the broker receives the sent message (ie task) and stores the task in the queue, due to the Celery mechanism itself Queue services are not provided, so Rabbit MQ, Zookeeper, and Redis are usually used to implement brokers.
  • the task execution unit (Celery Work) is a processing unit that executes tasks.
  • the timing task trigger module (Celery Beat) and the task execution unit (Celery Work) can have a one-to-one correspondence, and according to specific task requirements, the timing task trigger module (Celery Beat) and the task execution unit (Celery Work) ) Can be multiple.
  • step S230 the timing task triggered by the timing task trigger unit (Celery Beat) is used to trigger the timing task created according to the business requirements, and the middleman (Broker) is used to obtain the timing task triggered by the timing task trigger unit (Celery Beat).
  • timing tasks may include: data collection or switch control of terminal equipment.
  • the triggered timed task will be sent to the broker (Broker).
  • step S240 the task execution unit (Celery Work) monitors whether the broker (Broker) has acquired the timing task triggered by the timing task trigger unit (Celery Beat).
  • step S250 if the task execution unit (Celery Work) monitors that the broker (Broker) obtains the timing task triggered by the timing task trigger unit (Celery Beat), then the business logic processing corresponding to the timing task is performed.
  • the method further includes the following steps.
  • step S260 the server sends an instruction to the gateway device to instruct the gateway device to control the terminal device to perform an operation corresponding to the instruction related to the timing task.
  • the message middleware of the service interface layer includes, for example, a message middleware based on the MQTT protocol of message queue telemetry transmission.
  • instructions related to timed tasks include i) data collection instructions: numeric value collection instructions and/or status collection instructions. Numerical value collection instructions are used to collect various measurement data of terminal equipment, and status collection instructions are used to collect various terminal equipment. Data on the open/closed state of such switches; and ii) switch control instructions, which are used to control the switching of the open/closed states of various switches in the terminal device.
  • the gateway device controlling the terminal device to perform operations corresponding to the instructions related to the timing task includes: when the instruction related to the timing task is a data collection instruction, the gateway device receives the instruction, parses the instruction, and communicates with the terminal device (for example, temperature sensor) communication, control the terminal device to report the measured data, and the gateway device collects the measurement data of the terminal device; alternatively, when the terminal device measurement data operation needs to be started by the outside, the gateway device It is also possible to send a start signal to the terminal device to control the terminal device to start data measurement and control the terminal device to report the measured data.
  • the terminal device For example, temperature sensor
  • controlling the terminal device by the gateway device to perform operations corresponding to the instructions related to the timing task also includes: when the instruction related to the timing task is a switch control instruction, the gateway device receives the instruction, parses the instruction, and sends the instruction to the terminal as the terminal The designated switch of the device sends control information to control the switch state.
  • the gateway device additionally receives data collection instructions related to the timing tasks of data collection from the server after the switch state is switched, for example, state collection instructions, similarly, the control is used to collect switch state data
  • the terminal device (for example, a current sensor used to measure the current flowing through the switch) reports the switch state data of the switch.
  • the Celery mechanism greatly facilitates the configuration of timing tasks for IoT terminal devices, and the combination of Python and message middleware MQTT also realizes the control command scheduling of IoT terminal devices, thus realizing Lightweight message push, better control of the resource overhead of the entire system, especially combining the characteristics of python and message middleware MQTT, to achieve low protocol overhead, low power consumption, tolerance to unstable networks and firewall It is fault-tolerant and supports a large number of concurrent (millions of connections) and different client platforms.
  • Fig. 3 shows the steps of a method 300 for configuring a timing task based on the Celery mechanism on the server side according to another embodiment of the present disclosure.
  • Steps S310-S360 shown in FIG. 3 are similar to steps S210-S260 of the method shown in FIG. 2, and therefore will not be described in detail here.
  • the gateway device can return the data reported by the terminal device to the server. For example, when the server sends an instruction including a data collection instruction to the IoT terminal subsystem, the gateway device needs to report and collect the data reported by the terminal device. The data is returned to the server, so the method also includes the following steps.
  • step S370 the server receives information from the terminal device via the gateway device (for example, the collected measurement data of the terminal device and/or the open/closed state data of various switches in the terminal device), and stores it in the server side
  • the result storage unit for example, a task execution unit (Celery Work) on the server side is used to store it in the result storage unit.
  • step S380 the data analysis module on the server side obtains the execution record of the timing task from the result storage unit (Backend) for analysis, and determines whether the server (for example, its internal alarm module) is required for further processing according to the preset logic. operating.
  • the data analysis module extracts records of temperature data collected during the execution of timed tasks from the result storage unit (Backend) for analysis, and determines whether the temperature data is abnormal (for example, the collected temperature data exceeds The threshold is abnormal); for another example, the data analysis module extracts from the result storage unit (Backend) the record of the state data of the audio control switch collected after the execution of the timing task (switch control) for analysis, according to the preset Logic to determine whether the state of the switch is correct (for example, it is incorrect when the state of the switch is not preset by the user). If it is determined that the temperature data is abnormal or the state of the switch is incorrect, the "further operation" may include, for example, providing alarm data to the user interface through the alarm interface of the alarm module of the server
  • the method may also optionally include: managing timed tasks through a background management platform; wherein, the background management platform is used to add and add timed tasks according to user-defined editing rules. At least one of delete, modify, and query.
  • the background management platform shown in Figure 8 can be used to manage various timing tasks.
  • the method analyzes the execution records of timing tasks on the server side, thereby realizing automatic alarms in abnormal situations, improving safety and user experience.
  • This method can also add, edit, delete, and update different timed tasks through a dedicated management platform, and can associate timed tasks with configuration management, so that three modes of multi-process, Eventlet and Gevent can be selected for concurrent execution ;
  • the dedicated management platform can also provide a variety of task types to facilitate task grouping, splitting and invocation, and support a variety of message agents and storage backends; in terms of user experience, it provides a user interface to enable users to perform timing tasks (such as Whether the execution is successful, the current execution status, the time taken to execute the task, etc.) have a relatively intuitive understanding.
  • the IoT terminal subsystem 402 receives instructions related to timing tasks from the server and returns information (including instructions or data, etc.) to the server.
  • the gateway device 4021 in the IoT terminal subsystem 402 controls the terminal device 4022 to perform operations corresponding to the instructions related to the timing task according to the instructions related to the timing task received from the server 401, and returns the information from the terminal device To the server 401;
  • the terminal device 4022 communicates with the gateway device 4021, and performs operations corresponding to instructions related to timing tasks under the control of the gateway device 4021, and reports information to the gateway device 4021.
  • a service interface between the server 401 and the IoT terminal subsystem 402 for transferring information (including instructions or data, etc.) between the server and the IoT terminal subsystem 402.
  • a programmable controller is also included between the gateway device 4021 and the terminal device 4022, which is used to integrate multiple terminal devices, so as to collect their data and report to the gateway device and control them on and off.
  • PLC programmable controller
  • PLC and multiple terminal devices integrated with it can be regarded as terminal devices.
  • FIG. 5 shows a schematic diagram of the operation flow of the system of FIG. 4 when performing a timing task of data collection according to an embodiment of the present disclosure.
  • the process of configuring the timing task on the server side is similar to the method described according to FIG. 2 and FIG. 3, and will not be described in detail here.
  • the timing task is the data collection of the terminal equipment, including value collection and status collection.
  • the value collection is mainly to collect the readings of various measuring meters and the meter readings of various power electronic equipment.
  • the status collection mainly It is the open/closed state of various switches.
  • the task execution unit (Celery Work) on the server side performs business logic processing and starts to send instructions related to the timing task to the message middleware MQTT of the business interface layer.
  • the message middleware MQTT passes the instructions to the gateway device through the message queue mechanism.
  • the gateway device needs to communicate with the server to perform login and authorization verification, which mainly authenticates the user's identity and authorization of the gateway device.
  • the gateway device is responsible for communicating with the server.
  • the gateway device supports the features of mainstream industrial control protocols and customized special protocols, and realizes local calculation through strategy rule calculation and application deployment and distribution, which improves the control capability and real-time performance of the device.
  • the gateway device also has rich interfaces and convenient Deploy to support communication with 4G, 3G, PPPOE, Wi-Fi networks, digital I/O input and output, serial ports and other terminals, and then provide different access solutions for different applications.
  • a PLC can also be set between them, but the PLC is not If necessary, it is also feasible to use other types of intermediate controllers or gateway devices to directly control each terminal device.
  • the gateway device channel is usually configured in advance to ensure that the address of each terminal device integrated by the PLC can have a dedicated channel to communicate with the server.
  • the configuration items of the gateway device channel mainly have four aspects:
  • the IoT gateway device and measuring point configuration module used to configure the device protocol and measuring point address under the gateway device. Mainly adopt industrial protocols such as Modbus and RS232;
  • the IoT gateway device acquisition module according to the configured IoT device and measuring point information, periodically reads the measuring point data of the IoT device;
  • the timing reporting module of the IoT gateway device is used to upload the collected data to the message center regularly.
  • the message center includes the message middleware MQTT of the embodiment of the present disclosure.
  • the IoT gateway device control module is connected with the message center module to control the controlled device and issue control instructions.
  • the gateway device After the gateway device receives the instructions from the message middleware MQTT and parses the instructions related to the timing task, it starts to control the PLC to report the collected terminal device (sensor, meter, etc.) data and send it back to the server.
  • the gateway device can also send a start signal to the terminal device by controlling the PLC, so that the PLC controls the terminal device to start data measurement, and then the PLC measures the data of the terminal device Collect, report to the gateway device, and finally send it back to the server.
  • the gateway device finally transfers the collected terminal device data back to the server via the message middleware MQTT, and then the task execution unit on the server side records it in the result storage (Backend).
  • the data analysis module on the server side extracts the execution records of the timed tasks (for example, the records of temperature data collected during the execution of the timed tasks) from the result storage for analysis, and determines whether these records are abnormal according to the preset logic (for example, If the collected temperature data exceeds the threshold, it will be abnormal), if it is abnormal, the alarm data will be provided to the user interface through the alarm interface.
  • FIG. 6 shows a schematic diagram of the operation flow of the system of FIG. 4 when a timing task of switch control is executed according to an embodiment of the present disclosure.
  • the process of configuring the timing task on the server side is similar to the method described according to FIG. 2 and FIG. 3, and will not be described in detail here.
  • the timing task is the switch control of the terminal device of the Internet of Things, and the switch control mainly controls the switching of the on/off states of various switches.
  • the task execution unit (Celery Work) on the server side performs business logic processing and starts to send instructions related to the timing task to the message middleware MQTT of the business interface layer.
  • the message middleware MQTT passes the instruction to the gateway device through the message queue mechanism.
  • the gateway device parses the instruction and sends the control information corresponding to the instruction to the PLC.
  • the PLC controls the on/off state of the designated switch among the integrated switches according to the control information. Switch.
  • the switch state data of the terminal device can be collected. Specifically, when the switch status data of the terminal device needs to be collected to determine whether the switch is normal, it is also necessary to trigger the timing task of data collection from the server side and generate a data collection instruction. At this time, the steps are as follows.
  • the gateway device starts to control the PLC to transmit the collected terminal device data back to the server after receiving the data collection instruction (for example, via the message middleware MQTT, and finally back to the server), and then the server's task execution unit records To the result storage (Backend).
  • the data analysis module of the server extracts the execution record of the timing task (for example, the record of the collected switch state data) from the result storage for analysis, and judges the execution record according to the preset logic Whether it is abnormal, if abnormal, the alarm data is provided to the user interface through the alarm interface of the alarm unit on the server side.
  • FIG. 7 is a schematic diagram of a server according to an embodiment of the present disclosure. Since the operation performed by the server of this embodiment is the same as the details of the method described above with reference to FIGS. 1-3, a detailed description of the same content is omitted here for simplicity.
  • the server includes a processor 701 and a memory 702. It should be noted that although the server in FIG. 7 is shown as including only two devices, this is only illustrative, and the server may also include one or more other devices, or be divided according to the functions of each part.
  • the server can be regarded as six modules including login module, authority management module, IoT gateway and device management module, IoT data management module, database module, and timed task module.
  • the login module is used for gateway devices and cloud platform users. Login authentication; user authority management module, used to identify user role authority management, data authority management; IoT gateway and device management module, used for users to add, modify, delete, configure each IoT gateway and IoT device, and configure at the same time Configuration of device protocol and measuring point address under the gateway; IoT data management module, used to display and count the data of each gateway and IoT devices under the gateway; database module, used to store and backup records of data information in the system;
  • the timing task module is used to create different timer tasks for business requirements to achieve different business purposes. Since the specific structures of these devices or modules are known to those skilled in the art, detailed descriptions thereof are omitted here.
  • the memory 702 is used to store computer-executable instructions, which, when run by the processor, cause the processor to perform the steps of the method described above.
  • the method includes: obtaining a timed task created according to business requirements; monitoring whether the timed task is triggered; and sending instructions related to the timed task to the Internet of Things terminal subsystem to instruct the Internet of Things terminal subsystem to perform the timed task.
  • the task executor on the server side is used to execute the business logic processing corresponding to the timed task, and to generate the information related to the timed task for the IoT terminal subsystem Instructions. Then, for example, via the message middleware of the business interface layer, the instructions related to the timing task are sent to the IoT terminal subsystem.
  • the method further includes using the distributed task queue Celery mechanism to configure a timing task trigger unit (Celery Beat) and configure a task execution unit (Celery Work) as a task executor of the server.
  • a timing task trigger unit Celery Beat
  • a task execution unit Celery Work
  • the method further includes: using a timing task trigger unit (Celery Beat) to trigger the timing task; and using a broker in the Celery mechanism of a distributed task queue to obtain the timing task triggered by the timing task trigger unit (Celery Beat). Timed tasks.
  • a timing task trigger unit (Celery Beat) to trigger the timing task
  • a broker in the Celery mechanism of a distributed task queue to obtain the timing task triggered by the timing task trigger unit (Celery Beat). Timed tasks.
  • monitoring whether the timing task is triggered includes: monitoring by the task execution unit (Celery Work) whether the broker has acquired the timing task triggered by the timing task trigger unit (Celery Beat), thereby determining the timing task Whether it is triggered.
  • sending the instruction related to the timing task to the IoT terminal subsystem includes: sending the instruction related to the timing task to the IoT terminal subsystem via the message middleware of the service interface layer.
  • the message middleware of the business interface layer may be a message middleware based on the MQTT protocol of message queue telemetry transmission.
  • the IoT terminal subsystem includes a gateway device and terminal equipment; sending instructions related to the timing task to the IoT terminal subsystem includes: sending instructions related to the timing task through the message middleware of the service interface layer To the gateway device.
  • the timing task includes: data collection or switch control of terminal equipment.
  • the instructions related to timing tasks include: numerical value acquisition instructions and/or status acquisition instructions.
  • Numerical value acquisition instructions are used to collect various measurement data of terminal equipment, and status acquisition instructions are used to collect various types of switches in terminal equipment.
  • Open/closed state data is used to control the switching of the open/closed states of various switches in the terminal device.
  • the method further includes: receiving information from a terminal device from a gateway device, and storing it in a result storage unit (Backend) using a task execution unit (Celery Work), wherein the information from the terminal device includes: terminal device The measurement data and/or the open or closed state data of various switches in the terminal equipment.
  • the method further includes: obtaining the execution record of the timing task from the result storage unit (Backend) for analysis, and judging whether the server is required to perform further operations according to a preset logic.
  • the method further includes: managing timed tasks through a background management platform; wherein the background management platform is used to implement at least one operation of adding, deleting, modifying and querying timed tasks according to editing rules defined by the user.
  • a computer-readable medium which stores computer-executable instructions, which, when run by a processor, cause the processor to perform the steps of the aforementioned method.
  • Python language is used in the present disclosure to configure timing tasks on the server side, those skilled in the art can understand that other programming languages can also be used to implement the same timing task configuration for IoT terminal devices on the server side.
  • Figures 1-3 respectively describe steps executed in a specific order for the purposes of illustration and discussion, the method of the present disclosure is not limited to the specific illustrated order or arrangement. Without departing from the scope of the present disclosure, the various steps of the above method may be omitted, rearranged, combined and/or adjusted in various ways.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

本公开提出了一种用于在服务器侧配置定时任务的方法、服务器、系统和计算机可读存储介质,该方法包括:获取根据业务需求而创建的定时任务;监控定时任务是否被触发;在定时任务被触发时,向物联网终端子系统发送与定时任务相关的指令,以指示物联网终端子系统执行定时任务。

Description

定时任务配置方法、服务器、系统和计算机可读存储介质 技术领域
本公开涉及物联网技术领域,并具体涉及一种针对物联网设备的定时任务配置方法、服务器、系统和计算机可读存储介质。
背景技术
物联网是新一代信息技术的重要组成部分,其英文名称是:“The Internet of things”。顾名思义,物联网就是物物相连的互联网。这有两层意思:其一,物联网的核心和基础仍然是互联网,是在互联网基础上的延伸和扩展的网络;其二,其用户端延伸和扩展到了任何物品与物品之间,进行信息交换和通信。物联网就是“物物相连的互联网”。物联网通过智能感知、识别技术与普适计算、广泛应用于网络的融合中,也因此被称为继计算机、互联网之后世界信息产业发展的第三次浪潮。物联网是互联网的应用拓展,与其说物联网是网络,不如说物联网是业务和应用。
随着传统工业、农业、服务业飞速发展,无人化控制技术的运用越来越普遍。追求无人化工业、农业和服务业的本质是减少对人力的依赖,实现设备运行的自动化和智能化,从而减少企业人力成本的支出,减少高危作业场景,进而降低企业运作的成本和风险。实现无人化控制这个目标,可以应用各种物联网技术。
发明内容
根据本公开的一方面,提供了一种用于在服务器侧配置定时任务的方法,该方法包括:获取根据业务需求而创建的定时任务;监控所述定时任务是否被触发;在所述定时任务被触发时,向物联网终端子系统发送与所述定时任务相关的指令,以指示物联网终端子系统执行定时任务。
根据本公开的另一方面,方法还包括:在所述定时任务被触发时,利用服务器的任务执行器执行与所述定时任务相应的业务逻辑处理,并产生与所述定时任务相关的指令。
根据本公开的另一方面,方法还包括:使用分布式任务队列机制来配置 定时任务触发单元并且配置作为所述服务器的任务执行器的任务执行单元。
根据本公开的另一方面,方法还包括:利用定时任务触发单元触发所述定时任务;以及利用分布式任务队列机制中的中间人来获取由定时任务触发单元触发的所述定时任务。
根据本公开的另一方面,其中,所述监控定时任务是否被触发包括:由任务执行单元监控中间人是否获取了由定时任务触发单元触发的所述定时任务,从而判断所述定时任务是否被触发。
根据本公开的另一方面,其中,向物联网终端子系统发送与所述定时任务相关的指令包括:经由业务接口层的消息中间件向物联网终端子系统发送与所述定时任务相关的指令。
根据本公开的另一方面,其中,所述业务接口层的消息中间件为基于消息队列遥测传输协议的消息中间件;其中,所述物联网终端子系统包括网关设备和终端设备;所述经由业务接口层的消息中间件向物联网终端子系统发送与所述定时任务相关的指令,以使得物联网终端子系统执行所述定时任务包括:通过该业务接口层的消息中间件将与所述定时任务相关的指令发送到网关设备,以使得网关设备控制终端设备进行对应于与定时任务相关的指令的操作并且接收来自终端设备的信息。
根据本公开的另一方面,其中,所述定时任务包括:终端设备的数据采集或开关控制。
根据本公开的另一方面,其中,与定时任务相关的指令包括:数值采集指令和/或状态采集指令,数值采集指令用于采集终端设备的各种测量数据,状态采集指令用于采集终端设备中的各类开关的开启/闭合状态的数据;和开关控制指令,所述开关控制指令用于控制终端设备中的各类开关的开启/闭合状态的切换。
根据本公开的另一方面,方法还包括:通过该业务接口层的消息中间件从网关设备接收来自终端设备的信息,并将其存储到结果存储单元(Backend)中,其中,所述来自终端设备的信息包括:终端设备的测量数据和/或终端设备中的各类开关的开启或闭合状态的数据。
根据本公开的另一方面,方法还包括:从结果存储单元(Backend)中取得定时任务的执行记录进行分析,并根据预设的逻辑来判断是否需要服务器 进行进一步操作。
根据本公开的另一方面,方法还包括:通过后台管理平台来管理定时任务,其中,后台管理平台被用于根据用户定义的编辑规则,实现对定时任务进行增添、删除、修改和查询中的至少一项操作。
根据本公开的又一方面,提供了一种服务器,包括处理器;和存储器,用于存储计算机可执行指令,所述计算机可执行指令在被处理器运行时使得处理器执行如上所述的方法。
根据本公开的又一方面,提供了一种用于执行定时任务的系统,包括:服务器;物联网终端子系统,从服务器接收与定时任务相关的指令并向服务器返回信息,所述物联网终端子系统包括:网关设备,所述网关设备根据从服务器接收的与定时任务相关的指令,控制终端设备进行对应于所述与定时任务相关的指令的操作,并将来自终端设备的信息返回到所述服务器;终端设备,所述终端设备与所述网关设备通信,在网关设备的控制下进行对应于与定时任务相关的指令的操作,并向所述网关设备上报信息。
附图说明
通过结合附图对本公开实施例进行更详细的描述,本公开的上述以及其它目的、特征和优势将变得更加明显。附图用来提供对本公开实施例的进一步理解,并且构成说明书的一部分,与本公开实施例一起用于解释本公开,并不构成对本公开的限制。在附图中,相同的参考标号通常代表相同部件或步骤。
图1示出了根据本公开实施例的在服务器侧配置定时任务的方法的步骤。
图2示出了根据本公开另一实施例的在服务器侧基于分布式任务队列(Celery)机制配置定时任务的方法的步骤。
图3示出了根据本公开又一实施例的在服务器侧基于Celery机制配置定时任务的方法的步骤。
图4示出了根据本公开实施例的用于执行定时任务的系统的示意图。
图5示出了根据本公开实施例的执行数据采集的定时任务时图4的系统的操作流程示意图。
图6示出了根据本公开实施例的执行开关控制的定时任务时图4的系统的操作流程示意图。
图7示出了根据本公开实施例的用于配置定时任务的服务器的示意图。
图8示出了根据本公开实施例的用于管理定时任务的后台管理平台的示意图。
具体实施方式
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本公开一部分的实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。
在物联网技术的应用场合中,会涉及到针对远端物联网终端设备的定时任务的管理和调度,其中物联网终端设备包括例如传感器(例如无线传感器、智能传感器等)、计量表、物联网开关、电力电子设备等。例如,定时地对作为终端设备的各个传感器的数值进行采集,以判断各个传感器是否正常工作,以及每个工作日定时地打开音响播放起床音乐等。可以在终端设备或物联网网关内部实现定时功能以控制终端设备定时地执行任务,但是该方式并不能远程地对终端设备进行定时控制,同时不能根据实际业务需求来便捷地管理、调度和控制定时任务。
因此,为了解决上述问题,本公开提出在服务器侧实现定时任务的配置的方法和系统。
图4示出了根据本公开实施例的用于执行定时任务的系统400的示意图。
如图4所示,用于执行定时任务的系统包括:服务器401;以及物联网终端子系统402。所述物联网终端子系统例如可以包括:网关设备4021和终端设备4022。
图1示出了根据本公开实施例的在服务器侧配置定时任务的方法100的步骤。
在步骤S110,获取根据业务需求而创建的定时任务。
例如,定时任务可以包括:终端设备的数据采集或开关控制(即定时对作为终端设备的各类表计、开关、电力电子设备等的数据进行数值采集和对各类开关的开启/闭合状态进行开关状态采集,以及定时控制各类开关的开启/闭合状态的切换)。
在步骤S120,监控定时任务是否被触发。
在步骤S130,在定时任务被触发时,服务器向物联网终端子系统发送与定时任务相关的指令,以指示物联网终端子系统执行对应的定时任务。
在一些实施例中,服务器经由业务接口层的消息中间件向物联网终端子系统发送与定时任务相关的指令。例如,业务接口层的消息中间件例如包括基于消息队列遥测传输MQTT协议的消息中间件(为了便于描述,可将其称为“消息中间件MQTT”)。
在本公开实施例中,在确定定时任务被触发时,利用服务器侧的任务执行器执行与定时任务相应的业务逻辑处理,并产生与该定时任务相关的指令。通过上述在服务器侧配置定时任务的方法,使得能够根据需求创建针对终端设备的定时任务,从而进一步在服务器侧实现对终端设备相关定时任务的配置,以对定时任务进行管理、调度和控制。
图2示出了根据本公开实施例的在服务器侧基于分布式任务队列(Celery)机制配置定时任务的方法的步骤。
接下来请参阅图2,在结合图1描述的实施例的基础上,介绍在服务器侧基于分布式任务队列(Celery)机制配置定时任务的方法200的步骤。
如图2所示,步骤210与步骤110相同,在步骤S220,在服务器中使用分布式任务队列(Celery)机制来配置定时任务触发单元(Celery Beat)并且配置作为任务执行器的任务执行单元(Celery Work)。
Celery是一个使用Python开发的分布式任务调度模块,因此对于大量使用Python构建的系统,可以说是无缝衔接,使用起来很方便。Python语言在时下关注度逐日攀升,其语言清晰简洁的语法也使得调试起来比较简单,并且具有一些强大的架构,可以表达非常复杂的逻辑,具有非常强大的支持异步的框架如Eventlet NetWorking Library。此外,Python作为脚本语言,可以在程序开发过程中节省大量的时间,因为不需要编译和链接并易于调试。Celery机制专注于实时处理任务,同时也支持任务的定时调度。
Celery机制包括定时任务触发单元(Celery Beat)、任务执行单元(Celery Work)、中间人(Broker)以及结果存储器(Backend)。其中,Celery机制的定时任务首先在配置中创建好,然后运行定时任务触发单元(Celery Beat)来进行触发。例如,定时任务触发单元(Celery Beat)可按照settings.py之中的时区时间来触发定时任务;中间人(Broker)接收发来的消息(即任务),并 将任务存入队列,由于Celery机制本身不提供队列服务,因此通常使用例如Rabbit MQ、Zookeeper和Redis等来实现中间人(Broker);任务执行单元(Celery Work)是执行任务的处理单元,它实时监控消息队列,获取队列中调度的任务,并执行它(进行与任务对应的业务处理);结果存储单元(Backend),用于存储队列中的任务运行完后的结果或者状态。此外,根据需要,定时任务触发模块(Celery Beat)和任务执行单元(Celery Work)可以是一一对应的,且根据具体的任务需求,定时任务触发模块(Celery Beat)和任务执行单元(Celery Work)可以为多个。
在步骤S230,利用定时任务触发单元(Celery Beat)触发根据业务需求而创建的定时任务,并利用中间人(Broker)来获取定时任务触发单元(Celery Beat)触发的定时任务。例如,定时任务可以包括:终端设备的数据采集或开关控制。例如,触发后的定时任务将被发送到中间人(Broker)。
在步骤S240,由任务执行单元(Celery Work)监控中间人(Broker)是否获取了定时任务触发单元(Celery Beat)触发的定时任务。
在步骤S250,如果任务执行单元(Celery Work)监控到中间人(Broker)获取了定时任务触发单元(Celery Beat)触发的定时任务,则进行与定时任务对应的业务逻辑处理。
由于定时任务是针对终端设备的,因此任务执行单元在进行与定时任务对应的业务逻辑处理时,会产生针对终端设备的、与定时任务相关的指令,从而该方法还包括以下步骤。
在步骤S260,服务器向网关设备发送指令,以指示网关设备控制终端设备进行对应于与定时任务相关的指令的操作。
例如,业务接口层的消息中间件例如包括基于消息队列遥测传输MQTT协议的消息中间件。
例如,与定时任务相关的指令包括i)数据采集指令:数值采集指令和/或状态采集指令,数值采集指令用于采集终端设备的各种测量数据,状态采集指令用于采集终端设备中的各类开关的开启/闭合状态的数据;和ii)开关控制指令,开关控制指令用于控制终端设备中的各类开关的开启/闭合状态的切换。
例如,网关设备控制终端设备进行对应于与定时任务相关的指令的操作 包括:当与定时任务相关的指令为数据采集指令时,网关设备接收该指令,对该指令进行解析后,与终端设备(例如温度传感器)通信,控制终端设备将其已测量到的数据上报,由此网关设备采集到终端设备的测量数据;可替换地,当终端设备测量数据的操作需要由外界来启动时,网关设备还可以向终端设备发送启动信号,以控制终端设备启动数据测量,并控制终端设备将测量到的数据进行上报。
例如,网关设备控制终端设备进行对应于与定时任务相关的指令的操作还包括:当与定时任务相关的指令为开关控制指令时,网关设备接收该指令,对该指令进行解析后,向作为终端设备的指定开关发送控制信息,从而控制开关状态的切换。此外,在一些情况下,如果在开关状态切换之后网关设备额外接收到来自服务器的与数据采集的定时任务相关的数据采集指令,例如,状态采集指令,则类似地,控制用于采集开关状态数据的终端设备(例如用于测量流过该开关的电流的电流传感器)将该开关的开关状态数据上报。
通过采用上述方法,采用Celery机制极大方便了对针对物联网终端设备的定时任务的配置,并且Python与消息中间件MQTT的结合使用,还实现了物联网终端设备的控制指令调度,从而实现了轻量级的消息推送,对整个系统的资源开销进行了较好的控制,尤其是结合python和消息中间件MQTT的特性,实现了低协议开销、低功耗、对不稳定网络的容忍和防火墙容错,同时支持大量并发(百万级连接)、不同的客户端平台。
图3示出了根据本公开又一实施例的在服务器侧基于Celery机制配置定时任务的方法300的步骤。
图3所示的步骤S310-S360与图2所示的方法的步骤S210-S260类似,因此这里不再进行详细描述。
如上所述,网关设备可以将终端设备上报的数据返回到服务器,例如,当服务器向物联网终端子系统发送包括数据采集指令的指令时,网关设备需要将该终端设备所上报的、采集到的数据返回到服务器,因此该方法还包括以下步骤。
在步骤S370,服务器经由网关设备接收来自终端设备的信息(例如采集的终端设备的测量数据和/或终端设备中的各类开关的开启/闭合状态的数据),并将其存储到服务器侧的结果存储单元(Backend)中,例如,利用服 务器侧的任务执行单元(Celery Work)将其存储到结果存储单元中。
在步骤S380,服务器侧的数据分析模块从所述结果存储单元(Backend)中取得定时任务的执行记录进行分析,根据预设的逻辑来判断是否需要服务器(例如,其内部的报警模块)进行进一步操作。例如,数据分析模块从结果储存单元(Backend)中抽出执行定时任务时采集到的温度数据的记录以进行分析,根据预设的逻辑来判断这些温度数据是否异常(例如,采集到的温度数据超过阈值则异常);再例如,数据分析模块从结果储存单元(Backend)中抽出关于在执行定时任务(开关控制)后采集到的音响的控制开关的状态数据的记录以进行分析,根据预设的逻辑来判断开关的状态是否正确(例如,开关状态不是用户预设的时则不正确)。如果确定温度数据异常或开关的状态不正确时,则该“进一步操作”可以包括例如通过服务器的报警模块的报警接口向用户界面提供报警数据。
通常,为了更好地对定时任务进行管理,该方法还可选地包括:通过后台管理平台管理定时任务;其中,后台管理平台被用于根据用户定义的编辑规则,实现对定时任务进行增添、删除、修改和查询中的至少一项操作。例如,如图8所示的后台管理平台可用于管理各种定时任务。
通过采用上述方法,除了参照图2所描述的方法的优点以外,该方法通过在服务器侧定时任务的执行记录进行分析,从而在异常情况时实现自动报警,提高了安全性和用户体验。
该方法还通过专用的管理平台,可以对不同的定时任务进行新增、编辑、删除、更新,而且可以把定时任务与配置管理进行关联,从而可选多进程、Eventlet和Gevent三种模式并发执行;该专用的管理平台还能提供多种任务类型,方便实现任务分组、拆分与调用,支持多种消息代理和存储后台;在用户体验方面,提供用户界面使用户对定时任务执行情况(例如是否执行成功、当前的执行状态、执行任务花费的时间等)有比较直观的了解。
下面将结合图4来简单介绍用于执行定时任务的系统400中各部件之间的交互。如图4所示,物联网终端子系统402从服务器接收与定时任务相关的指令并向服务器返回信息(包括指令或数据等)。具体地,物联网终端子系统402中的网关设备4021根据从服务器401接收的与定时任务相关的指令控制终端设备4022进行对应于与定时任务相关的指令的操作,并将来自终端设 备的信息返回到所述服务器401;终端设备4022与所述网关设备4021通信,并且在网关设备4021的控制下进行对应于与定时任务相关的指令的操作,并向所述网关设备4021上报信息。
可选地,在服务器401和物联网终端子系统402之间还具有业务接口,用于在服务器和物联网终端子系统402之间传递信息(包括指令或数据等)。
可选地,在网关设备4021和终端设备4022之间还包括可编程控制器(PLC),用于集成多个终端设备,从而对它们的数据进行采集并上报到网关设备和对它们进行开关控制,此时可将PLC和与其集成的多个终端设备共同视为终端设备。
接下来将基于图4所示的系统,并结合图5和图6详细描述根据本公开实施例的、在具体场景应用中执行不同定时任务时图4的系统的操作流程示意图。
具体场景一
图5示出了根据本公开实施例的执行数据采集的定时任务时图4的系统的操作流程示意图。
在该实施例中,在服务器侧配置定时任务的过程与根据图2和图3所描述的方法类似,这里不再详细描述。在该实施例中,定时任务为终端设备的数据采集,包括数值采集和状态采集,数值采集主要是采集各种测量表计的读值和各种电力电子设备的表头读值,状态采集主要是各类开关的开启/闭合状态。
首先,当数据采集的定时任务被触发时,服务器侧的任务执行单元(Celery Work)进行业务逻辑处理,并开始向业务接口层的消息中间件MQTT发送与定时任务相关的指令。
然后,消息中间件MQTT通过消息队列机制将指令传递给网关设备。网关设备需要和服务器通讯,从而进行登陆和权限验证,其中主要是对网关设备的用户身份和授权进行认证。
其中,网关设备负责和服务器通讯。通过网关设备支持主流工控协议和定制化特有协议的特性,以及通过策略规则计算和应用部署分发实现本地计算,提高了设备的控制能力和实时性能,同时由于网关设备还具有丰富的接口以及便捷的部署,支持与4G、3G、PPPOE、Wi-Fi网络、数字I/O输入输 出、串口等终端的通信,进而可以为不同的应用场合提供不同的接入方案。此外,在进行数据采集和开关控制时,除了在网关设备和终端设备之间直接进行通信(包括控制信息的传递以及数据的上传等)外,还可以在它们之间设置PLC,但是该PLC不是必须的,采用其他类型的中间控制器或者网关设备直接控制各个终端设备也是可行的。在网关设备和终端设备之间设置PLC的情况下,网关设备从消息中间件MQTT接收到指令后,通过PLC来实现对终端设备的数据采集和开关控制。在这种情况下,通常提前配置好网关设备通道,确保PLC集成的每一个终端设备的地址都能有专门的通道与服务器进行通信,网关设备通道的配置项主要有四个方面:
1)物联网网关设备以及测点配置模块,用于配置网关设备下设备协议、测点地址等配置。主要采用Modbus、RS232等工业协议;
2)物联网网关设备采集模块,根据配置的物联网设备以及测点信息,定时读取物联网设备的测点数据;
3)物联网网关设备定时上报模块,用于将采集到的数据定时上传到消息中心。消息中心包括本公开实施例的消息中间件MQTT。
4)物联网网关设备控制模块,与消息中心模块相连接,用于对被控设备进行控制,并下发控制指令。
接着,网关设备接收到从消息中间件MQTT传递来的指令并解析与定时任务相关的指令后,开始控制PLC将采集到的终端设备(传感器、计量表等)的数据上报,并传送回服务器。可替换地,当终端设备采集数据的操作需要由外界来启动时,网关设备还可以通过控制PLC向终端设备发送启动信号,以使PLC控制终端设备启动数据测量,然后PLC对终端设备的测量数据进行采集,并上报到网关设备,最终传送回服务器。具体地,网关设备经由消息中间件MQTT,将所采集到的终端设备的数据最终传递回服务器,然后由服务器侧的任务执行单元记录到结果储存器(Backend)中。
最后,服务器侧的数据分析模块从结果储存器中抽出定时任务的执行记录(例如,执行定时任务时采集到的温度数据的记录)进行分析,根据预设的逻辑来判断这些记录是否异常(例如,采集到温度数据超过阈值则异常),如果异常则通过报警接口向用户界面提供报警数据。图6示出了根据本公开实施例的执行开关控制的定时任务时图4的系统的操作流程示意图。
在该实施例中,在服务器侧配置定时任务的过程与根据图2和图3所描述的方法类似,这里不再详细描述。在该实施例中,定时任务为物联网终端设备的开关控制,开关控制主要是控制各类开关的开启/闭合状态的切换。
首先,当开关控制的定时任务被触发时,服务器侧的任务执行单元(Celery Work)进行业务逻辑处理,并开始向业务接口层的消息中间件MQTT发送与定时任务相关的指令。
然后消息中间件MQTT通过消息队列机制将该指令传递给网关设备。
接着,网关设备接到指令后,对该指令进行解析后向PLC下发与该指令相对应的控制信息,PLC根据该控制信息控制进行与其集成的各个开关中的指定开关的开启/闭合状态的切换。
在实际操作中,为了检查终端设备是否按照用户的意图进行开关切换操作,可以对终端设备的开关状态数据进行采集。具体地,当需要对终端设备的开关状态数据进行采集以判断开关切换是否是正常时,还需要从服务器侧触发数据采集的定时任务,并生成数据采集指令,此时步骤如下。
与场景一类似的,网关设备接到数据采集指令后开始控制PLC将采集到的终端设备的数据传送回服务器(例如经由消息中间件MQTT,最终回到服务器),然后由服务器的任务执行单元记录到结果储存器(Backend)中。此时还可以如前面所述的,服务器的数据分析模块从结果储存器中抽出定时任务的执行记录(例如,采集到的开关状态数据的记录)进行分析,根据预设的逻辑来判断执行记录是否异常,如果异常则通过服务器侧的报警单元的报警接口向用户界面提供报警数据。下面将参照图7描述根据本公开实施例的服务器。图7是根据本公开实施例的服务器的示意图。由于本实施例的服务器执行的操作与在上文中参照图1-3描述的方法的细节相同,因此在这里为了简单起见,省略对相同内容的详细描述。
如图7所示,服务器包括处理器701和存储器702。需要注意的是,尽管在图7中服务器被示出为只包括2个装置,但这只是示意性的,服务器也可以包括一个或多个其他装置,或者按照各个部分的功能进行划分。
例如,服务器可被视为包括登陆模块、权限管理模块、物联网网关及设备管理模块、物联网数据管理模块、数据库模块,定时任务模块六个模块,其中登录模块用于网关设备以及云平台用户的登录认证;用户权限管理模块, 用于鉴定用户角色权限管理,数据权限管理;物联网网关以及设备管理模块,用于用户添加、修改、删除、配置各个物联网网关以及物联网设备,同时配置网关下设备协议、测点地址等配置;物联网数据管理模块,用于展示及统计各个网关以及网关下物联网设备的数据;数据库模块,用于对系统内的数据信息进行存储及备份记录;定时任务模块,用于对业务需求创建不同的定时器任务,实现不同的业务目的。由于这些装置或模块的具体结构是本领域技术人员已知的,因此其详细描述在这里被省略。
图7中,存储器702用于存储计算机可执行指令,该计算机可执行指令在被处理器运行时使得处理器执行如前面所述的方法的各个步骤。
该方法包括:获取根据业务需求而创建的定时任务;监控定时任务是否被触发;向物联网终端子系统发送与定时任务相关的指令,以指示物联网终端子系统执行定时任务。
根据本公开实施例,在定时任务被触发时,利用服务器侧的任务执行器执行与所述定时任务对应的业务逻辑处理,并产生针对所述物联网终端子系统的、与所述定时任务相关的指令。然后,例如经由业务接口层的消息中间件向物联网终端子系统发送与定时任务相关的指令。
例如,方法还包括:使用分布式任务队列Celery机制来配置定时任务触发单元(Celery Beat)并且配置作为服务器的任务执行器的任务执行单元(Celery Work)。
例如,方法还包括:利用定时任务触发单元(Celery Beat)触发所述定时任务;以及利用分布式任务队列Celery机制中的中间人(Broker)来获取由定时任务触发单元(Celery Beat)触发的所述定时任务。
例如,其中,监控定时任务是否被触发包括:由任务执行单元(Celery Work)监控中间人(Broker)是否获取了由定时任务触发单元(Celery Beat)触发的所述定时任务,从而判断所述定时任务是否被触发。
例如,向物联网终端子系统发送与所述定时任务相关的指令包括:经由业务接口层的消息中间件向物联网终端子系统发送与所述定时任务相关的指令。业务接口层的消息中间件可以是基于消息队列遥测传输MQTT协议的消息中间件。
例如,物联网终端子系统包括网关设备和终端设备;向物联网终端子系 统发送与所述定时任务相关的指令包括:通过该业务接口层的消息中间件将与所述定时任务相关的指令发送到网关设备。
例如,其中,所述定时任务包括:终端设备的数据采集或开关控制。
例如,其中,与定时任务相关的指令包括:数值采集指令和/或状态采集指令,数值采集指令用于采集终端设备的各种测量数据,状态采集指令用于采集终端设备中的各类开关的开启/闭合状态的数据;和开关控制指令,所述开关控制指令用于控制终端设备中的各类开关的开启/闭合状态的切换。
例如,方法还包括:从网关设备接收来自终端设备的信息,并利用任务执行单元(Celery Work)将其存储到结果存储单元(Backend)中,其中,所述来自终端设备的信息包括:终端设备的测量数据和/或终端设备中的各类开关的开启或闭合状态的数据。
例如,方法还包括:从结果存储单元(Backend)中取得定时任务的执行记录进行分析,并根据预设的逻辑来判断是否需要服务器进行进一步操作。
例如,方法还包括:通过后台管理平台管理定时任务;其中,后台管理平台被用于根据用户定义的编辑规则,实现对定时任务进行增添、删除、修改和查询中的至少一项操作。
根据本公开的另一方面,还公开了一种计算机可读介质,存储有计算机可执行指令,该计算机可执行指令在被处理器运行时使得处理器执行如前面所述的方法的各个步骤。
虽然本公开中采用了Python语言来在服务器侧进行定时任务的配置,然而本领域技术人员可以理解,也可以用其他编程语言在服务器侧实现同样的针对物联网终端设备的定时任务的配置。
虽然已经针对本主题的各种具体示例实施例详细描述了本主题,但是每个示例通过解释而不是限制本公开来提供。本领域技术人员在得到对上述内容的理解后,可以容易地做出这样的实施例的变更、变化和等同物。因此,本发明并不排除包括将对本领域普通技术人员显而易见的对本主题的这样的修改、变化和/或添加。例如,作为一个实施例的一部分图示或描述的特征可以与另一实施例一起使用,以产生又一实施例。因此,意图是本公开覆盖这样的变更、变化和等同物。
具体地,尽管图1-3出于图示和讨论的目的分别描述了以特定顺序执行 的步骤,但是本公开的方法不限于特定图示的顺序或布置。在不偏离本公开的范围的情况下,上述方法的各个步骤可以以各种方式省略、重新布置、组合和/或调整。
本申请使用了特定词语来描述本申请的实施例。如“一个实施例”、“一实施例”、和/或“一些实施例”意指与本申请至少一个实施例相关的某一特征、结构或特点。因此,应强调并注意的是,本说明书中在不同位置两次或多次提及的“一实施例”或“一个实施例”或“一替代性实施例”并不一定是指同一实施例。此外,本申请的一个或多个实施例中的某些特征、结构或特点可以进行适当的组合。
本领域技术人员可以理解,本申请的各方面可以通过若干具有可专利性的种类或情况进行说明和描述,包括任何新的和有用的工序、机器、产品或物质的组合,或对他们的任何新的和有用的改进。相应地,本申请的各个方面可以完全由硬件执行、可以完全由软件(包括固件、常驻软件、微码等)执行、也可以由硬件和软件组合执行。以上硬件或软件均可被称为“数据块”、“模块”、“引擎”、“单元”、“组件”或“系统”。此外,本申请的各方面可能表现为位于一个或多个计算机可读介质中的计算机产品,该产品包括计算机可读程序编码。
除非另有定义,这里使用的所有术语(包括技术和科学术语)具有与本公开所属领域的普通技术人员共同理解的相同含义。还应当理解,诸如在通常字典里定义的那些术语应当被解释为具有与它们在相关技术的上下文中的含义相一致的含义,而不应用理想化或极度形式化的意义来解释,除非这里明确地这样定义。
以上是对本公开的说明,而不应被认为是对其的限制。尽管描述了本公开的若干示例性实施例,但本领域技术人员将容易地理解,在不背离本公开的新颖教学和优点的前提下可以对示例性实施例进行许多修改。因此,所有这些修改都意图包含在权利要求书所限定的本公开范围内。应当理解,上面是对本公开的说明,而不应被认为是限于所公开的特定实施例,并且对所公开的实施例以及其他实施例的修改意图包含在所附权利要求书的范围内。本公开由权利要求书及其等效物限定。
本申请要求于2019年03月27日递交的中国专利申请第201910238659.3 号的优先权,在此全文引用上述中国专利申请公开的内容以作为本申请的一部分。

Claims (14)

  1. 一种用于在服务器侧配置定时任务的方法,包括:
    获取根据业务需求而创建的定时任务;
    监控所述定时任务是否被触发;
    在所述定时任务被触发时,向物联网终端子系统发送与所述定时任务相关的指令,以指示物联网终端子系统执行所述定时任务。
  2. 如权利要求1所述的方法,还包括:
    在所述定时任务被触发时,利用服务器的任务执行器执行与所述定时任务对应的业务逻辑处理,并产生与所述定时任务相关的指令。
  3. 如权利要求1或2所述的方法,还包括:
    使用分布式任务队列机制来配置定时任务触发单元并且配置作为所述服务器的任务执行器的任务执行单元。
  4. 根据权利要求3所述的方法,还包括:
    利用定时任务触发单元触发所述定时任务;以及
    利用分布式任务队列机制中的中间人来获取由定时任务触发单元触发的所述定时任务。
  5. 如权利要求4所述的方法,其中,所述监控所述定时任务是否被触发包括:
    由任务执行单元监控中间人是否获取了由定时任务触发单元触发的所述定时任务,从而判断所述定时任务是否被触发。
  6. 如权利要求3所述的方法,其中,向物联网终端子系统发送与所述定时任务相关的指令包括:
    经由业务接口层的消息中间件向物联网终端子系统发送与所述定时任务相关的指令。
  7. 根据权利要求6所述的方法,其中,所述业务接口层的消息中间件为基于消息队列遥测传输协议的消息中间件;其中,所述物联网终端子系统包括网关设备和终端设备;
    所述向物联网终端子系统发送与所述定时任务相关的指令,以指示物联网终端子系统执行所述定时任务包括:
    通过该业务接口层的消息中间件将与所述定时任务相关的指令发送到网关设备,以指示网关设备控制终端设备进行对应于与所述定时任务相关的指令的操作并且接收来自终端设备的信息。
  8. 如权利要求1-2和4-7任一项所述的方法,其中,所述定时任务包括:终端设备的数据采集或开关控制。
  9. 如权利要求8所述的方法,其中,与所述定时任务相关的指令包括:
    数据采集指令,其包括数值采集指令和/或状态采集指令,所述数值采集指令用于采集终端设备的测量数据,所述状态采集指令用于采集终端设备中的各类开关的开启/闭合状态的数据;和
    开关控制指令,其用于控制终端设备中的各类开关的开启或闭合状态的切换。
  10. 如权利要求7所述的方法,还包括:
    通过该业务接口层的消息中间件从网关设备接收来自终端设备的信息,并将其存储到结果存储单元中,
    其中,所述来自终端设备的信息包括:终端设备的测量数据和/或终端设备中的各类开关的开启或闭合状态的数据。
  11. 如权利要求10所述的方法,还包括:
    从所述结果存储单元中获取定时任务的执行记录并进行分析,并且根据预设的逻辑来判断是否需要服务器进行进一步操作。
  12. 如权利要求1-2和4-7任一项所述的方法,还包括:
    通过后台管理平台管理所述定时任务;
    其中,所述后台管理平台被用于实现对定时任务进行增添、删除、修改和查询中的至少一项操作。
  13. 一种服务器,包括
    处理器;和
    存储器,用于存储计算机可执行指令,所述计算机可执行指令在被处理器运行时使得所述处理器执行如权利要求1-12任一项所述的方法。
  14. 一种用于执行定时任务的系统,包括:
    如权利要求13所述的服务器;
    物联网终端子系统,从服务器接收与定时任务相关的指令并向服务器返回信息,所述物联网终端子系统包括:
    网关设备,所述网关设备根据从服务器接收的与定时任务相关的指令,控制终端设备进行对应于所述与所述定时任务相关的指令的操作,并将来自终端设备的信息返回到所述服务器;
    终端设备,所述终端设备与所述网关设备通信,在网关设备的控制下进行对应于与所述定时任务相关的指令的操作,并向所述网关设备上报信息。
PCT/CN2020/081398 2019-03-27 2020-03-26 定时任务配置方法、服务器、系统和计算机可读存储介质 WO2020192733A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910238659.3A CN109951559A (zh) 2019-03-27 2019-03-27 定时任务配置方法、服务器、系统和计算机可读存储介质
CN201910238659.3 2019-03-27

Publications (1)

Publication Number Publication Date
WO2020192733A1 true WO2020192733A1 (zh) 2020-10-01

Family

ID=67012007

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/081398 WO2020192733A1 (zh) 2019-03-27 2020-03-26 定时任务配置方法、服务器、系统和计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN109951559A (zh)
WO (1) WO2020192733A1 (zh)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783618A (zh) * 2020-12-30 2021-05-11 银盛支付服务股份有限公司 一种任务调度监控系统、计算机设备及存储介质
CN113726644A (zh) * 2021-08-31 2021-11-30 中冶华天南京工程技术有限公司 智能网关数据采集的方法与系统
CN113760583A (zh) * 2021-09-18 2021-12-07 苏州利成汇志软件科技有限公司 物联数据智能集中处理服务平台
CN114124643A (zh) * 2021-11-10 2022-03-01 中盈优创资讯科技有限公司 一种基于PaaS的网络设备流量采集方法及装置
CN114338767A (zh) * 2021-12-23 2022-04-12 睿云联(厦门)网络通讯技术有限公司 基于数据流的物联网终端设备的网络管理方法及系统
CN115623518A (zh) * 2022-12-15 2023-01-17 阿里巴巴达摩院(杭州)科技有限公司 任务处理方法、平台、系统、设备和存储介质
CN116028544A (zh) * 2023-03-30 2023-04-28 山东爱特云翔计算机有限公司 基于openstack的定时任务动态添加方法
WO2023077637A1 (zh) * 2021-11-03 2023-05-11 中科智城(广州)信息科技有限公司 一种基于mqtt协议的集中控制器控制方法、系统及设备
CN116527718A (zh) * 2023-06-02 2023-08-01 广州达谙信息科技有限公司 一种工业物联网网关的数据采集方法及其系统

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109951559A (zh) * 2019-03-27 2019-06-28 京东方光科技有限公司 定时任务配置方法、服务器、系统和计算机可读存储介质
CN110807637A (zh) * 2019-11-05 2020-02-18 腾讯科技(深圳)有限公司 一种业务处理方法、智能终端及存储介质
CN110837592B (zh) * 2019-11-08 2021-01-26 京东数字科技控股有限公司 数据归档的方法、装置和计算机可读存储介质
CN113411226A (zh) * 2020-03-16 2021-09-17 北京奇虎科技有限公司 路由器分布式自动化测试方法、系统、存储介质及其计算机设备
CN111835842B (zh) 2020-07-02 2023-02-28 远景智能国际私人投资有限公司 网关资源的更新方法、装置及物联网控制平台
CN112416701B (zh) * 2020-09-07 2023-02-17 上海哔哩哔哩科技有限公司 业务数据的监控方法、装置、计算机设备和可读存储介质
CN113190777A (zh) * 2021-03-31 2021-07-30 北京达佳互联信息技术有限公司 数据更新方法、装置、电子设备、存储介质及产品
CN113282398A (zh) * 2021-06-29 2021-08-20 杭州洋驼网络科技有限公司 轻量级任务触发系统及业务生态系统
CN114510282B (zh) * 2021-12-15 2024-02-13 北京达佳互联信息技术有限公司 一种自动化应用的运行方法、装置、设备以及存储介质
CN114650310B (zh) * 2022-03-11 2023-03-14 腾讯科技(深圳)有限公司 基于物联网的设备控制方法、装置、电子设备及存储介质
CN115333939A (zh) * 2022-07-27 2022-11-11 青岛海尔空调电子有限公司 支持边缘计算的物联网网关的运行控制方法、设备及介质
CN115515169B (zh) * 2022-11-22 2023-06-09 天津通信广播集团有限公司 一种工业数据采集网关的数据转发方法
CN116744141B (zh) * 2023-06-01 2024-03-19 杭州研智科技有限公司 一种统一多种协议的物联网网关

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106487895A (zh) * 2016-10-14 2017-03-08 深圳市欧瑞博电子有限公司 定时控制方法和装置
US20170093975A1 (en) * 2015-09-26 2017-03-30 Arun Raghunath Technologies for managing data object requests in a storage node cluster
CN108762931A (zh) * 2018-05-31 2018-11-06 康键信息技术(深圳)有限公司 基于分布式调度系统的任务调度方法、服务器及存储介质
CN109298951A (zh) * 2018-08-21 2019-02-01 平安科技(深圳)有限公司 Celery任务的执行方法及终端设备
CN109951559A (zh) * 2019-03-27 2019-06-28 京东方光科技有限公司 定时任务配置方法、服务器、系统和计算机可读存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107623613A (zh) * 2017-09-13 2018-01-23 微赫智能科技(上海)有限公司 智慧家庭系统
CN109361560A (zh) * 2018-01-24 2019-02-19 广州Tcl智能家居科技有限公司 一种集群节点通讯处理方法、系统、存储介质及服务器

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170093975A1 (en) * 2015-09-26 2017-03-30 Arun Raghunath Technologies for managing data object requests in a storage node cluster
CN106487895A (zh) * 2016-10-14 2017-03-08 深圳市欧瑞博电子有限公司 定时控制方法和装置
CN108762931A (zh) * 2018-05-31 2018-11-06 康键信息技术(深圳)有限公司 基于分布式调度系统的任务调度方法、服务器及存储介质
CN109298951A (zh) * 2018-08-21 2019-02-01 平安科技(深圳)有限公司 Celery任务的执行方法及终端设备
CN109951559A (zh) * 2019-03-27 2019-06-28 京东方光科技有限公司 定时任务配置方法、服务器、系统和计算机可读存储介质

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783618A (zh) * 2020-12-30 2021-05-11 银盛支付服务股份有限公司 一种任务调度监控系统、计算机设备及存储介质
CN113726644A (zh) * 2021-08-31 2021-11-30 中冶华天南京工程技术有限公司 智能网关数据采集的方法与系统
CN113726644B (zh) * 2021-08-31 2023-07-25 中冶华天南京工程技术有限公司 智能网关数据采集的方法与系统
CN113760583A (zh) * 2021-09-18 2021-12-07 苏州利成汇志软件科技有限公司 物联数据智能集中处理服务平台
WO2023077637A1 (zh) * 2021-11-03 2023-05-11 中科智城(广州)信息科技有限公司 一种基于mqtt协议的集中控制器控制方法、系统及设备
CN114124643A (zh) * 2021-11-10 2022-03-01 中盈优创资讯科技有限公司 一种基于PaaS的网络设备流量采集方法及装置
CN114124643B (zh) * 2021-11-10 2023-08-01 中盈优创资讯科技有限公司 一种基于PaaS的网络设备流量采集方法及装置
CN114338767A (zh) * 2021-12-23 2022-04-12 睿云联(厦门)网络通讯技术有限公司 基于数据流的物联网终端设备的网络管理方法及系统
CN114338767B (zh) * 2021-12-23 2023-11-24 睿云联(厦门)网络通讯技术有限公司 基于数据流的物联网终端设备的网络管理方法及系统
CN115623518A (zh) * 2022-12-15 2023-01-17 阿里巴巴达摩院(杭州)科技有限公司 任务处理方法、平台、系统、设备和存储介质
CN116028544A (zh) * 2023-03-30 2023-04-28 山东爱特云翔计算机有限公司 基于openstack的定时任务动态添加方法
CN116028544B (zh) * 2023-03-30 2023-06-23 山东爱特云翔计算机有限公司 基于openstack的定时任务动态添加方法
CN116527718A (zh) * 2023-06-02 2023-08-01 广州达谙信息科技有限公司 一种工业物联网网关的数据采集方法及其系统

Also Published As

Publication number Publication date
CN109951559A (zh) 2019-06-28

Similar Documents

Publication Publication Date Title
WO2020192733A1 (zh) 定时任务配置方法、服务器、系统和计算机可读存储介质
US10429092B2 (en) Asynchronous reporting system
US10854059B2 (en) Wireless sensor network
EP3111433B1 (en) Wireless sensor network
US20180248968A1 (en) Remote access gateway configurable control system
US10992494B2 (en) Gateway round-robin system
CN106549863B (zh) 一种物联网网关、终端及其协议自适应方法和装置
CN103973815A (zh) 一种跨数据中心存储环境统一监控方法
CN112764835A (zh) 基于边缘计算的电力物联网传感设备配置微服务系统及方法
WO2012088905A1 (zh) 一种通讯网络系统及通讯设备的巡检子系统和巡检方法
CN113609048B (zh) 一种电力物联网云边业务协同交互方法
US10514713B2 (en) Mailbox data storage system
CN102932431A (zh) 一种基于消息路由的状态监测数据接口配置方法
EP2908498B1 (en) Integrated application generating system and method for internet of things terminal
CN114095311A (zh) 电力物联网网关、电力系统及配置新增电力设备的方法
Ali et al. Redfish-Nagios: A Scalable Out-of-Band Data Center Monitoring Framework Based on Redfish Telemetry Model
Wang et al. An Edge Computing Based Gateway for WIA-PA Networks
CN116743886A (zh) 基于物联网的工业控制设备数据采集系统
CN114884844B (zh) 流量录制方法及系统
CN114691373B (zh) 边缘计算设备接口通信方法、边缘节点设备及存储介质
CN107920347A (zh) 一种终端设备的数据处理方法及系统、设备
CN109688142B (zh) 一种工业控制系统网络中威胁管理方法和系统
CN108446131B (zh) 一种atm机固件升级方法、装置、设备及存储介质
WO2023116276A1 (zh) 故障处理方法、装置、电子设备及存储介质
Zhang et al. Serial Communication Card and Emergency Technology in Internet of Things [J]

Legal Events

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

Ref document number: 20777499

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20777499

Country of ref document: EP

Kind code of ref document: A1

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

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 24/02/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20777499

Country of ref document: EP

Kind code of ref document: A1