Power spot system clearing information processing method, device and equipment, storage medium and program product
By receiving, serializing and deserializing the cleaning process information in the power spot system and adding a custom end mark, the asynchronous problem of cleaning information processing is solved, and the accurate retention of cleaning information and inter-process communication is achieved, making it convenient to export The root cause of clearing failure is determined.
Patent Information
- Application Number
- CN202411155693.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-11-26
AI Technical Summary
The prior art is difficult to effectively process the clearing information in the spot power system, resulting in the difficulty in determining the source of the clearing failure.
By receiving the cleaning process information written by the production side of the message, serializing and writing to the queue file, adding a custom write end mark, deserializing and outputting the target cleaning process information on the reading side, ensuring the completeness and accuracy of the information sex.
The inter-process communication mechanism is realized, and the cleaning process information is automatically retained, which is convenient for determining the root cause of cleaning failure and tracking and displaying the cleaning process information, avoiding the incomplete information caused by asynchronous writing and reading.
Smart Images

Figure CN119027162A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer information technology, and in particular to a method, device, computer equipment, computer-readable storage medium and computer program product for processing electricity spot system clearing information. Background Art
[0002] The electricity spot system is a trading platform for buying and selling spot commodities (electricity). The clearing process of the electricity spot system refers to matching commodities (electricity) with price quotations to find a supply and demand balance point with the highest economic efficiency, that is, to achieve market supply and demand balance. If clearing fails, it will affect transactions. Accordingly, it becomes particularly important to determine the root cause of the failure of clearing in the electricity spot system. The determination of the root cause of the failure of clearing in the electricity spot system depends on the clearing-related information in the electricity spot system. However, the processing of clearing-related information based on existing technologies cannot (or even hinder) the determination of the root cause of the failure of clearing in the electricity spot system. Therefore, how to process the clearing information in the electricity spot system to facilitate the determination of the root cause of the failure of clearing is a problem to be solved. Summary of the invention
[0003] Based on this, it is necessary to provide a method, device, computer equipment, computer readable storage medium and computer program product for processing clearing information of the electricity spot system in response to the above-mentioned technical problems, so as to optimize the processing of clearing information in the electricity spot system, thereby facilitating the determination of the root cause of the failure of clearing the electricity spot system.
[0004] In a first aspect, the present application provides a method for processing clearing information of a power spot system, comprising:
[0005] Receiving the clearing process information of the power spot system written by the message production end;
[0006] Serializing the clearing process information and writing it into a queue file; the queue file includes a file end marker;
[0007] Add a custom write end marker in the queue file;
[0008] receiving a read request from a message reading end, and reading the clearing process information from the queue file;
[0009] Deserialize the read clearing process information to obtain target clearing process information;
[0010] When the file end mark is read, continue reading the queue file; when the custom write end mark is read, end reading the queue file;
[0011] Output each of the target clearing process information and / or the queue file.
[0012] In one embodiment, a message end mark corresponding to each of the clearing process information is added to the queue file; and reading the clearing process information from the queue file includes:
[0013] Reading the clearing process information from the queue file, caching the read clearing process information into a buffer; and taking out the clearing process information in the buffer when the message end mark is read;
[0014] The deserializing the read clearing process information to obtain target clearing process information includes:
[0015] The retrieved clearing process information is deserialized to obtain target clearing process information.
[0016] In one embodiment, caching the read clearing process information into a buffer includes:
[0017] Cache the sub-information of the clearing process information read into a buffer, and record the current reading position;
[0018] According to the current reading position, the sub-information of the clearing process information continues to be read, and the sub-information that continues to be read is cached in a buffer.
[0019] In one of the embodiments, recording the current reading position includes: recording the current reading position when the message production end pauses writing the sub-information;
[0020] Continuing to read the sub-information of the clearing process information according to the current read position includes: obtaining the current read position based on a random file reading technology while the message production end continues to write the sub-information; and continuing to read the sub-information according to the current read position.
[0021] In one of the embodiments, before reading the clearing process information from the queue file, the method further comprises: periodically detecting the existence of the queue file, and when the existence of the queue file is detected, reading the clearing process information from the queue file;
[0022] After outputting the target clearing process information and / or the queue file, the method further includes: deleting the queue file.
[0023] In one of the embodiments, the outputting the target clearing process information and / or the queue file includes: storing the target clearing process information and / or the queue file in a local file system and forwarding it to a monitoring platform.
[0024] In a second aspect, the present application also provides a power spot system clearing information processing device, including:
[0025] A writing module, used for receiving the clearing process information of the power spot system written by the message production end; serializing the clearing process information and writing it into a queue file; the queue file includes a file end mark; adding a custom write end mark to the queue file;
[0026] A reading module, used for receiving a reading request from a message reading end, reading the clearing process information from the queue file; deserializing the clearing process information read to obtain target clearing process information; continuing to read the queue file when the file end mark is read; and ending reading the queue file when the custom write end mark is read;
[0027] An output module is used to output each of the target clearing process information and / or the queue file.
[0028] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any step in the above-mentioned first aspect when executing the computer program.
[0029] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements any step in the above-mentioned first aspect when executed by a processor.
[0030] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which implements any step in the above-mentioned first aspect when executed by a processor.
[0031] The above-mentioned method, device, computer equipment, computer-readable storage medium and computer program product for processing clearing information of the power spot system receive the clearing process information of the power spot system written by the message production end, serialize the clearing process information and write it into the queue file, read the clearing process information from the queue file, deserialize the clearing process information read, thereby obtaining the target clearing process information, and finally output each target clearing process information and / or queue file, which realizes the communication mechanism between the message production end and the message reading end, and automatically retains the clearing process information, thereby facilitating the determination of the root cause of the clearing failure and meeting the functional requirements of tracking and displaying the clearing process information. In addition, by adding a custom write end mark to the queue file, when the custom write end mark is read, the reading of the queue file is ended, thereby avoiding the inaccuracy and incompleteness of the target clearing process information and queue file obtained due to the asynchronous writing and reading of the clearing process information (it may happen that only half of the clearing process information is written, but the file end mark is read and the reading is ended, and it is impossible to determine whether the clearing process information is ended by the file end mark). Through serialization and deserialization processing, the processing of the clearing process information, such as writing and storage, is facilitated, and the direct use of the clearing process information, such as reading and statistical analysis, is also facilitated. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 It is a flowchart of a method for processing electricity spot market system clearing information in one embodiment;
[0034] Figure 2 It is another flowchart of a method for processing electricity spot market system clearing information in one embodiment;
[0035] Figure 3 It is another flowchart of a method for processing electricity spot market system clearing information in one embodiment;
[0036] Figure 4 It is another flowchart of a method for processing electricity spot market system clearing information in one embodiment;
[0037] Figure 5 It is a structural block diagram of a power spot system clearing information processing device in one embodiment;
[0038] Figure 6FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] The power spot system is a system used for power spot trading, that is, in the power trading market, electricity can be purchased or sold through negotiation within a specific power trading time. The power spot trading market mainly revolves around medium- and long-term, day-ahead, and real-time power transactions and auxiliary service transactions such as standby and frequency regulation. There are two price mechanisms for power spot trading: one is to settle according to the quotations of each market player, and the other is a unified price mechanism for settlement according to the marginal clearing price. Settlement according to the marginal clearing price (Uniform-Pricing, referred to as UP) means that each market player obtains or pays the corresponding power cost according to the unified market marginal clearing price, that is, the buyer pays the power cost according to the marginal clearing price, and the seller obtains the power income according to the marginal clearing price. The main purpose of power spot trading is to balance the deviation between contract transactions and actual loads, and to improve the competitive efficiency of the power market. The operation process of the power spot market mainly includes declaration, clearing, and settlement. Among them, the clearing of the power spot market, in simple terms, is to give priority to calling the units with the cheapest quotations in the system under the premise of ensuring the power balance and safety constraints of the power grid until they meet the needs.
[0041] In the electricity spot system, the tracking and display of the clearing process information is an important function of the clearing calculation. It is necessary to ensure the timeliness and integrity of the clearing process information collection, and to retain the clearing process information in order to locate the problem of clearing failure. If IPC communication (inter-process communication, InterProcessCommunication, refers to the transmission or exchange of information between different processes) technical means such as Socket, shared memory and memory pipe are used, the requirements of timeliness and integrity of the clearing process information collection can be met, but the data will be destroyed after reading, and the process information cannot be automatically retained. In this regard, the technical solutions in the following embodiments can be used to ensure the timeliness and integrity of the clearing process information collection, while retaining the clearing process information to locate the problem of clearing failure.
[0042] In an exemplary embodiment, Figure 1As shown, a method for processing clearing information of a power spot system is provided. This embodiment uses the method applied to a power spot (trading) system as an example. It can be understood that the method can also be applied to a terminal or a server, in which a power spot system is pre-installed. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. It can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes steps S101 to S107:
[0043] Step S101: receiving the clearing process information of the power spot system written by the message production end.
[0044] Among them, the message production end, that is, an end or process in various forms such as one end or process used to generate and record the clearing process information written into the power spot system, can be a component of the power spot system, or can be externally attached to the power spot system. Clearing process information refers to the process information generated when clearing power spot transactions in the power spot system. The clearing here refers to the clearing process, rather than requiring the completion of the clearing, that is, whether the clearing fails or not. Exemplarily, in order to complete the processing of the clearing information of the power spot system, the clearing process information of the power spot system written by it can be first received through the message production end.
[0045] Step S102: Serialize the clearing process information and write it into a queue file. The queue file includes a file end mark.
[0046] Among them, serialization is the process of converting the state information of the object (clearing process information) into a form that can be stored or transmitted; queue file is a file that can encapsulate messages, which is used to encapsulate clearing process information and provide the ability to write and read clearing process information; file end mark is a mark in the queue file used to indicate the end of the file. The file end mark can be used to stop reading when the file end mark is read in the subsequent reading of the queue file, for example, the default file end mark automatically generated by the system, EOF (End of File), etc. Exemplarily, after the clearing process information is obtained, it can be serialized to convert it into a data format that is easy to store and transmit. After serialization or at the same time as serialization, the process information can be written into the queue file. Here, the queue file can be regarded as a message container. At the same time, the queue file has a file end mark.
[0047] Step S103: Add a custom write end mark in the queue file.
[0048] Among them, the custom write end mark is a self-defined mark used to indicate the end of the process of writing the clearing process information to the queue file. The custom write end mark should be different from the file end mark in the aforementioned steps. Exemplarily, in the electricity spot system, the process of writing to the queue file and the subsequent process of reading the queue file are asynchronous. For example, it is possible that the former only writes half of the content and the latter stops reading when it reads the file end mark. At this time, the content read is incomplete, which will affect the effect of clearing information processing of the electricity spot system. In this regard, a custom write end mark can be added to the queue file to facilitate subsequent steps. When the custom write end mark is read, the reading of the queue file is stopped to avoid the above situation.
[0049] Step S104: receiving a read request from the message reading end, and reading clearing process information from the queue file.
[0050] Among them, the message reading end, that is, an end or process for obtaining the clearing process information in the power spot system, can be a component of the power spot system or an external attachment to the power spot system. For example, according to the read request issued by the message reading end, the operation of reading the queue file can be performed, that is, the clearing process information can be read from the queue file.
[0051] Step S105: Deserialize the read clearing process information to obtain target clearing process information.
[0052] Among them, deserialization corresponds to the serialization in the previous step and is the reverse operation of serialization, that is, restoring the state information (clearing process information) of the object. The target clearing process information is the final clearing process information required for the clearing information processing of the power spot system. Exemplarily, the clearing process information read from the queue file can be deserialized to obtain the target clearing process information.
[0053] Step S106: When the file end mark is read, continue to read the queue file. When the custom write end mark is read, end the reading of the queue file.
[0054] Exemplarily, as mentioned above, considering that the writing process and the reading process of the queue file are asynchronous, a custom write end marker is added to the queue file, and when the custom write end marker is read, the reading of the queue file is ended; at the same time, when the file end marker is read, the reading of the queue file continues; that is, the end of the reading process of the queue file is executed based on the custom write end marker, not the file end marker, and the file end marker will not lead to the end of the queue file reading process.
[0055] Step S107: Outputting each target clearing process information and / or queue file.
[0056] For example, after obtaining the target clearing process information, each target clearing process information can be output to facilitate the determination of the root cause of the clearing failure. Of course, the queue file can also be output to facilitate the determination of the root cause of the clearing failure. Of course, the target clearing process information and the queue file can also be output at the same time. For example, the target clearing process information is in the original state, which is convenient for quick analysis of the clearing process information; the queue file can be used as a backup file to provide traceability.
[0057] In the above-mentioned method for processing the clearing information of the power spot system, by receiving the clearing process information of the power spot system written by the message production end, the clearing process information is serialized and written into the queue file, and the clearing process information is read from the queue file and deserialized to obtain the target clearing process information, and finally the target clearing process information and / or queue file are output, which realizes the inter-process communication mechanism (message production process and message reading process) and automatically retains the message (clearing process information), thereby facilitating the determination of the root cause of the clearing failure and meeting the functional requirements of tracking and displaying the clearing process information. In addition, by adding a custom write end mark to the queue file, when the custom write end mark is read, the reading of the queue file is ended, thereby avoiding the inaccuracy and incompleteness of the target clearing process information and queue file obtained due to the asynchronous writing and reading of the clearing process information. Through serialization and deserialization processing, the processing of the clearing process information, such as writing and storage, is facilitated, and the direct use of the clearing process information, such as reading, statistical analysis, etc., is also facilitated.
[0058] In an exemplary embodiment, a message end mark corresponding to each clearing process information is added to the queue file in the aforementioned embodiment.
[0059] The message end mark is a mark used to indicate the end of a clearing process information. For example, considering that there may be more than one clearing process information, a message end mark corresponding to each clearing process information may be added to the queue file. Of course, the corresponding message end mark may be added before the clearing process information is written into the queue file. Then, after the clearing process information is written into the queue file, the message end mark corresponding to each clearing process information is naturally added to the queue file.
[0060] The step of "reading clearing process information from the queue file" in the above embodiment may include: Figure 2 Steps S201 to S202 shown:
[0061] Step S201: read the clearing process information from the queue file, and cache the read clearing process information in the buffer. The buffer is an area for caching the clearing process information. Exemplarily, the clearing process information is read from the queue file, and the read clearing process information is cached (temporarily stored) in the buffer.
[0062] Step S202: when the message end mark is read, the clearing process information in the buffer is retrieved. For example, in the process of reading the clearing process information from the queue file, when the message end mark is read, it indicates that the clearing process information has been read and the clearing process information stored in the buffer is complete, so the clearing process information can be extracted from the buffer.
[0063] The step of "deserializing the read clearing process information to obtain target clearing process information" in the above embodiment includes the following steps: Figure 2 Step S203 shown: deserialize the retrieved clearing process information to obtain target clearing process information. Exemplarily, after the clearing process information is extracted from the buffer, it can be deserialized to obtain the target clearing process information.
[0064] In this embodiment, by adding a message end mark, the read clearing process information is cached in a buffer, and when the message end mark is read, the clearing process information in the buffer is taken out and deserialized to obtain the target clearing process information, it is possible to distinguish different clearing process information and avoid mixing all the clearing process information together; at the same time, since the clearing process information in the buffer is only taken out when the message end mark is read, if the message end mark is not read, it can at least indicate that this clearing process information has not been read to the end, therefore, this can assist in determining whether the reading is completed, thereby helping to avoid the problem of inaccurate and incomplete target clearing process information and queue files due to asynchronous writing and reading of the clearing process information.
[0065] In an exemplary embodiment, the step of "caching the read clearing process information into a buffer zone" in the aforementioned embodiment includes: caching the sub-information of the read clearing process information into a buffer zone and recording the current reading position; continuing to read the sub-information of the clearing process information according to the current reading position, and caching the sub-information that continues to be read into the buffer zone.
[0066] Among them, the sub-information of the clearing process information is the information used to form the complete clearing process information. When the sub-information included in a clearing process information is combined in sequence, the complete clearing process information can be obtained; of course, the sub-information can be for a clearing process information or for all clearing process information. The current reading position is the reading position corresponding to the clearing process information at the current moment in the process of reading the clearing process information from the queue file, specifically the reading position corresponding to the sub-information of the clearing process information read at the current moment, for example, the position of the end of the sub-information. Exemplarily, consider that the writing process and the reading process of the aforementioned queue file are asynchronous. For example, the writing process is to continue writing after a period of time after writing half of the content, but the reading process is always reading. At this time, it is possible to read and cache part of the empty content. In order to avoid the influence of this asynchrony, the sub-information of the clearing process information read can be cached in the buffer, and the current reading position is recorded at the same time. Regardless of whether the above-mentioned asynchronous influence exists, the corresponding sub-information can be continued to be read according to the current reading position and the corresponding sub-information can be cached in the buffer. Exemplarily, a clearing process information includes the first sub-information, the second sub-information and the third sub-information. When the first sub-information and the second sub-information are read, the first sub-information and the second sub-information are cached in the buffer, and the current reading position at this time is recorded as the end of the second sub-information. However, due to the existence of the above-mentioned asynchrony, the third sub-information has not yet been written. At this time, the writing of the third sub-information can be waited for. When the writing is completed, according to the current reading position as the end of the second sub-information, the reading and caching can be continued from the end. Of course, the above method can also be for the same sub-information. For example, when the third sub-information is halfway written, the writing is suspended. Then the current reading position at this time is recorded as the middle position of the third sub-information. When writing continues, the third sub-information can be read and cached from the middle position.
[0067] In this embodiment, by caching the sub-information of the clearing process information into the buffer and recording the current reading position, and then continuing to read and cache according to the current reading position, a complete read-cache is formed, thereby avoiding abnormal situations such as reading pauses, interruptions, etc. that affect the caching of the read clearing process information into the buffer or cause the cache to fail, thereby helping to ensure that the information cached in the buffer is complete and correct, not mixed with other information, and does not contain redundant information.
[0068] In an exemplary embodiment, the step of "recording the current read position" in the aforementioned embodiment includes: when the message production end pauses writing sub-information, recording the current read position; the step of "continuing to read the sub-information of the clearing process information according to the current read position" in the aforementioned embodiment includes: when the message production end continues to write sub-information, obtaining the current read position based on random file reading technology; and continuing to read sub-information according to the current read position.
[0069] Among them, random file reading technology is a data reading method used in computer programming to directly access any record from a file. This technology allows specific data in a file to be read directly without the need to access the file in sequence. This is very useful when processing large amounts of data because it can significantly increase the speed of data retrieval. Exemplarily, when the message production end pauses writing sub-information, the current read position is recorded, and then when the message production end continues to write sub-information, the current read position recorded by the location can be obtained based on the random file reading technology, and the reading can continue. Through the random file reading technology, after recording the last position, the next read can return to the last read position to continue reading, avoiding the problem of stopping the loop after the streaming read reaches the end of the file mark.
[0070] In this embodiment, by combining the random file reading and writing technology for design, the scheduler, as a message consumption process, will record the end position of the last data reading when reading operations are performed. When entering the next reading cycle, it can return to the end position of the last reading and continue reading, thereby ensuring data accuracy and data integrity.
[0071] In an exemplary embodiment, in the step "before reading the clearing process information from the queue file" in the aforementioned embodiment, the power spot system clearing information processing method further includes: periodically detecting the existence of the queue file, and when the existence of the queue file is detected, reading the clearing process information from the queue file. In the step "after outputting each target clearing process information and / or queue file" in the aforementioned embodiment, the power spot system clearing information processing method further includes: deleting the queue file.
[0072] Exemplarily, before reading the clearing process information from the queue file, you can first detect whether the queue file exists, for example, periodically detect the existence of the queue file, that is, detect it every certain period of time (such as 10 seconds, 1 second, 50 milliseconds, etc.), and the interval time can be customized according to actual needs. If it is detected that the queue file exists, then the subsequent steps can be carried out, such as reading the clearing process information from the queue file. Accordingly, after outputting each target clearing process information and / or queue file, the corresponding queue file can be deleted to facilitate the start of the next cycle, such as writing to the queue file, detecting the existence of the queue file, reading the clearing process information from the queue file, etc.
[0073] In this embodiment, by periodically detecting the existence of queue files, deleting queue files and other technical features, it is ensured that there are no duplicate queue files, the obtained target clearing process information and queue files cannot be duplicated, and resources are saved at the same time, such as timely deleting queue files to avoid wasting resources.
[0074] In an exemplary embodiment, the step of “outputting target clearing process information and / or queue files” in the aforementioned embodiment may include: storing the target clearing process information and / or queue files in a local file system and forwarding them to a monitoring platform.
[0075] The local file system, i.e., a local system for storing file data, can be a component of the power spot system or a system independent of the power spot system, as long as it can realize the storage of the target clearing process information and / or queue files. The monitoring platform, i.e., a platform for monitoring and processing the clearing process, for example, a platform in the power spot system for monitoring transaction anomalies and analyzing the causes of clearing failures. This platform can be equipped with corresponding professional analysts to analyze the target clearing process information and / or queue files to find the corresponding causes of clearing failures. Exemplarily, the target clearing process information and / or queue files can be stored in the local file system for preservation, and the target clearing process information and / or queue files can also be forwarded to the monitoring platform for convenient processing of the root causes of clearing failures, etc.
[0076] In this embodiment, by storing the target clearing process information and / or queue files in the local file system, local retention of the clearing process information is achieved, thereby facilitating the determination of the root cause of the clearing failure. At the same time, the target clearing process information and / or queue files are forwarded to the monitoring platform, which helps to directly, quickly and accurately determine the root cause of the clearing failure.
[0077] In an exemplary embodiment, a method for processing information of a power spot market system clearing process is provided. The following is an example of applying the method to a power spot market system.
[0078] For example, see Figure 3 As shown in the figure, the clearing process of the power spot trading system can include a message consumption process (message reading end) and a message production process (message production end). The message production process is responsible for writing messages to the queue file, and the message consumption process is responsible for reading messages from the queue file. The following is a possible message consumption process and message production process. Both need to follow the same queue file protocol. See Table 1. The message of the queue file protocol consists of a message type, a separator ":", and a message body (json string). The messages are separated by a consumption separator "\n" (message end marker). The message types include interaction messages entity.InteractionMessage, result savepoint messages entity.SavePointBasicInfo, and calculation result messages entity.CalcResult (custom write end marker). The message consumption process stops reading the queue file after reading the calculation result message entity.CalcResult. When the message consumption process reads, it deserializes the message body Json string into a memory object, and when the message production process writes, it serializes the memory object into a Json string. The message type can be expanded as needed, and different types of messages can be defined to meet different business needs.
[0079] Table 1
[0080]
[0081] The following is an introduction to the message consumption process. Figure 4 As shown in the figure, the message consumption process of the message consumption process includes the following steps:
[0082] Step S401: Determine whether a queue file exists. The message consumption process needs to open the queue file before consuming to start reading messages. Since the message production process needs time to start and create the queue file, if the file does not exist, it needs to sleep for 100 milliseconds and then re-determine whether the queue file exists. (This corresponds to the technical features such as periodic detection of the existence of queue files)
[0083] Step S402: Prepare to read the queue file. When the queue file is created by the message production process, the message consumption process starts to create a consumption queue to prepare for message consumption (this corresponds to the technical features such as writing clearing process information and receiving read requests from the message reading end). After the consumption queue is ready, start the queue file reading thread. The thread determines whether to stop reading based on the stop state. When the stop method of the queue file reading thread is called, the stop state is set to true, then the queue file reading thread stops reading, and the message consumption process stops consuming the queue file. (This corresponds to the technical features such as reading clearing process information and ending reading)
[0084] Step S403: Read the queue file. After the queue file reading thread is started, it enters the reading loop and starts to read the file character by character. When the message terminator "\n" is read, the queue file reading thread takes out the buffer content; otherwise, the read characters are cached in the buffer and the current file reading position is recorded, and the next character is read after the file content is written; when the character is read next time, the random file reading technology will be used to locate the last read position. This is because the writing of the message production process and the reading of the message consumption process are asynchronous. There is a probability that the message production process writes half of the content and the message consumption process reads the file end character, so the end of the file cannot be judged by the file end character EOF. For this reason, the custom calculation result message entity.CalcResult is used as the end mark of the message writing. For example, the data is processed before writing and added into the custom end mark. In addition, through the random file reading technology, after recording the last position, the next read can return to the last read position to continue reading, avoiding the problem of stopping the loop after the streaming read reaches the file end character. (This corresponds to adding a custom write end mark, a message end mark, caching the read clearing process information into the buffer, recording the current read position, continuing to read and other related technical features)
[0085] Step S404: Get the target clearing process information. The deserializer deserializes the content taken out of the buffer and generates a message object (target clearing process information). The creation of the message object will dynamically create different types of messages according to the message type in the queue file protocol. (This corresponds to the technical features related to deserialization and obtaining target clearing process information)
[0086] Step S405: trigger a message monitoring event. After the message object is created, a message monitoring event will be triggered, and the corresponding message listener will be called to complete the message processing. The message listener is handled by the business personnel. (This corresponds to the relevant technical features such as forwarding to the monitoring platform)
[0087] Step S406: End reading and destroy the queue file. After reading the end message of type entity.CalcResult, the queue file reading thread ends reading and closes the file to complete the destruction. (This corresponds to the technical features related to ending reading, deleting queue files, etc.)
[0088] Furthermore, in the aforementioned step S404, when the message terminator "\n" is read, the queue file reading thread takes out the buffer content, and continues to perform the reading loop and reads the file character by character, that is, taking out the buffer content and the subsequent steps do not affect "reading the next character from the record position". This can improve the reading efficiency. Of course, it is also possible to continue to perform the reading loop and read the file character by character after the message listening event is triggered in the aforementioned step S405, that is, "reading the next character from the record position".
[0089] The method provided in this embodiment has the ability to automatically retain messages, thereby helping to troubleshoot clearing errors and meeting the functional requirements of tracking and displaying clearing process information. The method encapsulates the clearing process information into a readable text format and stores it in the local file system, which is then read by the upstream scheduler and forwarded to the spot platform. The method is designed in combination with the random file reading and writing technology of the operating system. The scheduler, as a message consumer process, will record the end position of the last data read when reading operations. When entering the next reading cycle, it can return to the end position of the last read and continue reading, thereby ensuring data accuracy and data integrity. The method encapsulates the file reading operation and converts it into a message queue interface, and provides serialization and deserialization for the message to achieve local retention of the message. At the same time, the method can also save certain resources.
[0090] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0091] Based on the same inventive concept, the embodiment of the present application also provides a power spot system clearing information processing device for implementing the power spot system clearing information processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more power spot system clearing information processing device embodiments provided below can refer to the limitations of the power spot system clearing information processing method above, and will not be repeated here.
[0092] In an exemplary embodiment, Figure 5As shown, a power spot system clearing information processing device 500 is provided, comprising:
[0093] The writing module 501 is used to receive the clearing process information of the power spot system written by the message production end; serialize the clearing process information and write it into the queue file; the queue file includes a file end mark; add a custom write end mark in the queue file;
[0094] The reading module 502 is used to receive a read request from a message reading end, read the clearing process information from the queue file; deserialize the clearing process information read to obtain the target clearing process information; continue to read the queue file when a file end mark is read; and end reading the queue file when a custom write end mark is read;
[0095] The output module 503 is used to output each target clearing process information and / or queue file.
[0096] In one of the embodiments, the writing module 501 is also used to add a message end mark corresponding to each clearing process information to the queue file; the reading module 502 is also used to read the clearing process information from the queue file, cache the read clearing process information to the buffer; and when the message end mark is read, take out the clearing process information in the buffer; deserialize the taken out clearing process information to obtain the target clearing process information.
[0097] In one embodiment, the reading module 502 is further used to cache the sub-information of the clearing process information read into a buffer and record the current reading position; continue to read the sub-information of the clearing process information according to the current reading position, and cache the sub-information that continues to be read into the buffer.
[0098] In one of the embodiments, the reading module 502 is also used to record the current reading position when the message production end pauses writing sub-information; when the message production end continues writing sub-information, obtain the current reading position based on random file reading technology; and continue reading sub-information according to the current reading position.
[0099] In one of the embodiments, the writing module 501 is used to periodically detect the existence of the queue file before reading the clearing process information from the queue file, and read the clearing process information from the queue file when the existence of the queue file is detected; the output module 503 is also used to output each target clearing process information and / or queue file, and the method also includes: deleting the queue file.
[0100] In one embodiment, the output module 503 is further used to store the target clearing process information and / or queue files into the local file system and forward them to the monitoring platform.
[0101] Each module in the above-mentioned power spot system clearing information processing device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0102] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store relevant data required for the clearing information processing of the power spot system, such as queue files, target clearing process information, etc. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for processing the clearing information of the power spot system is implemented.
[0103] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0104] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0105] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0106] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0107] It should be noted that the clearing process information and related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0108] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0109] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0110] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for processing electricity spot system clearing information, characterized in that: The method comprises: Receiving the clearing process information of the power spot system written by the message production end; Serializing the clearing process information and writing it into a queue file; the queue file includes a file end marker; Add a custom write end marker in the queue file; receiving a read request from a message reading end, and reading the clearing process information from the queue file; Deserialize the read clearing process information to obtain target clearing process information; When the file end mark is read, continue reading the queue file; when the custom write end mark is read, end reading the queue file; Output each of the target clearing process information and / or the queue file.
2. The method according to claim 1, characterized in that: The queue file is added with a message end mark corresponding to each of the clearing process information; The reading the clearing process information from the queue file includes: Reading the clearing process information from the queue file, caching the read clearing process information into a buffer; and taking out the clearing process information in the buffer when the message end mark is read; The deserializing the read clearing process information to obtain target clearing process information includes: The retrieved clearing process information is deserialized to obtain target clearing process information.
3. The method according to claim 2, characterized in that The step of caching the read clearing process information into a buffer zone includes: Cache the sub-information of the clearing process information read into a buffer, and record the current reading position; According to the current reading position, the sub-information of the clearing process information continues to be read, and the sub-information that continues to be read is cached in a buffer.
4. The method according to claim 3, characterized in that The record currently read position includes: When the message production end stops writing the sub-information, recording the current reading position; The step of continuing to read the sub-information of the clearing process information according to the current reading position includes: When the message production end continues to write the sub-information, the current reading position is obtained based on a random file reading technology; and the sub-information is continued to be read according to the current reading position.
5. The method according to claim 1, characterized in that Before reading the clearing process information from the queue file, the method further includes: Periodically detecting the existence of the queue file, and when the existence of the queue file is detected, reading the clearing process information from the queue file; After outputting the target clearing process information and / or the queue file, the method further includes: deleting the queue file.
6. The method according to any one of claims 1 to 5, characterized in that: The outputting the target clearing process information and / or the queue file includes: The target clearing process information and / or the queue file are stored in the local file system and forwarded to the monitoring platform.
7. A power spot system clearing information processing device, characterized in that: The device comprises: A writing module, used for receiving the clearing process information of the power spot system written by the message production end; serializing the clearing process information and writing it into a queue file; the queue file includes a file end mark; adding a custom write end mark to the queue file; A reading module, used for receiving a reading request from a message reading end, reading the clearing process information from the queue file; deserializing the clearing process information read to obtain target clearing process information; continuing to read the queue file when the file end mark is read; and ending reading the queue file when the custom write end mark is read; An output module is used to output each of the target clearing process information and / or the queue file.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
