CN116521630B - Task progress real-time display method and device, computer equipment and storage medium - Google Patents

Task progress real-time display method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN116521630B
CN116521630B CN202310792037.1A CN202310792037A CN116521630B CN 116521630 B CN116521630 B CN 116521630B CN 202310792037 A CN202310792037 A CN 202310792037A CN 116521630 B CN116521630 B CN 116521630B
Authority
CN
China
Prior art keywords
task
log
time
message queue
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310792037.1A
Other languages
Chinese (zh)
Other versions
CN116521630A (en
Inventor
何安胜
李伟
冯斌
杜生军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Fulin Technology Co Ltd
Original Assignee
Shenzhen Fulin Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Fulin Technology Co Ltd filed Critical Shenzhen Fulin Technology Co Ltd
Priority to CN202310792037.1A priority Critical patent/CN116521630B/en
Publication of CN116521630A publication Critical patent/CN116521630A/en
Application granted granted Critical
Publication of CN116521630B publication Critical patent/CN116521630B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/168Details of user interfaces specifically adapted to file systems, e.g. browsing and visualisation, 2d or 3d GUIs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/156Query results presentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/545Gui
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02WCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO WASTEWATER TREATMENT OR WASTE MANAGEMENT
    • Y02W90/00Enabling technologies or technologies with a potential or indirect contribution to greenhouse gas [GHG] emissions mitigation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Library & Information Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application belongs to the field of data processing, and relates to a real-time display method of task progress, which comprises the steps of generating a task identifier when a task starting request is received, and generating a task request body based on the task starting request; invoking a task execution interface to send a task request to a task system, wherein the task request comprises a task request body and a task identifier; according to the preset interval, calling a task system log acquisition interface through carrying a task identifier, so that a log record corresponding to the task identifier is obtained from a message queue of a task system through the task system log acquisition interface; and dynamically displaying the task progress corresponding to the task identifier in real time based on each log record. The application also provides a task progress real-time display device, computer equipment and a storage medium. The method and the device ensure continuity and instantaneity of the task progress, realize real-time display of the task progress and improve task progress query efficiency.

Description

Task progress real-time display method and device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a method and apparatus for displaying task progress in real time, a computer device, and a storage medium.
Background
In some large-scale application projects, a plurality of independent subsystems are often involved, wherein the independent subsystems comprise different service systems, different task systems and the like, when the service systems send commands for executing tasks to the task systems, the conventional task systems record task progress in the task execution process, send query requests to the service systems when the service systems send query requests, and display the task progress status on a user interface of the service systems in a visual mode according to fixed time intervals, so that users can perceive the task execution process. However, the task system often processes more tasks, and recording the real-time progress of each task occupies more memory, so that the running and querying efficiency is lower.
Disclosure of Invention
The embodiment of the application aims to provide a method, a device, computer equipment and a storage medium for displaying task progress in real time so as to improve query efficiency and realize real-time progress display.
In order to solve the technical problems described above, an embodiment of the present application provides a method for displaying task progress in real time, which is applied to a distributed cluster, where the distributed cluster includes a service system and a task system, and the method for displaying task progress in real time includes the following steps executed by the service system:
The method for displaying the task progress in real time comprises the following steps:
when the service system receives a task starting request, generating a task identifier, and generating a task request body based on the task starting request;
the service system calls a task execution interface to send a task request to the task system, wherein the task request comprises the task request body and the task identifier;
the task system receives a task request sent by the service system, wherein the task request comprises a task identifier and a task request body;
the task system creates a message queue according to the task identifier;
the task system executes the task corresponding to the task request body, and sends a task log generated in the task executing process to a message queue containing the task identifier to generate a real-time log record;
the service system calls a task system log acquisition interface through carrying a task identifier according to a preset interval, so that a log record corresponding to the task identifier is obtained from a message queue of the task system through the task system log acquisition interface;
and the business system dynamically displays the task progress corresponding to the task identifier in real time based on each log record.
Further, the service system dynamically displaying the task progress corresponding to the task identifier based on each log record includes:
acquiring a task offset in a log record and writing the task offset into a local file;
and displaying the task offset on a front-end interface in a scrolling and splicing mode.
Further, after the service system dynamically displays the task progress corresponding to the task identifier in real time based on each log record, the task progress real-time display method further includes:
and if the log ending symbol is read from the service system log record, stopping reading the log, and displaying the task completion on the front page.
Further, the service system creating a message queue according to the task identifier includes:
initializing a RabbitMQ message queue, and creating a message queue with the task identifier as a name based on the initialized RabbitMQ message queue;
and setting an expiration time for the message queue, wherein the expiration time is used for recycling the messages which are not consumed for more than a preset duration.
Further, after the task system detects that the task execution is completed and sends the log ending symbol to the message queue, the task progress real-time display method further includes:
And if the log ending symbol is detected to be consumed, deleting the message queue corresponding to the log ending symbol.
Optionally, after the setting of the expiration time for the message queue, the method for displaying task progress in real time further includes:
according to a preset time interval, creating time inquiry is carried out on the unconsumed messages in the message queue;
determining an expired critical time based on the expiration time and the current time;
in the message queue, an unconsumed message with the time before the critical time is created as a message to be recovered;
and recycling the message to be recycled.
In order to solve the above technical problem, the embodiment of the present application further provides a task progress real-time display device, which is applied to a distributed cluster, where the task progress real-time display device includes a service system and a task system, and the service system includes:
the task generating module is used for generating a task identifier when a task starting request is received, and generating a task request body based on the task starting request;
the task sending module is used for calling a task execution interface to send a task request to the task system, wherein the task request comprises the task request body and the task identifier;
The task receiving module is used for receiving a task request sent by the service system, wherein the task request comprises a task identifier and a task request body;
the queue creating module is used for creating a message queue according to the task identification;
the task execution module is used for executing the task corresponding to the task request body, sending a task log generated in the task execution process to a message queue containing the task identifier, and generating a real-time log record;
the system comprises a log acquisition module, a task system log acquisition interface, a task system log acquisition module and a task system, wherein the log acquisition module is used for calling the task system log acquisition interface through carrying task identifiers according to preset intervals so as to obtain log records corresponding to the task identifiers from a message queue of the task system through the task system log acquisition interface;
and the progress display module is used for dynamically displaying the task progress corresponding to the task identifier in real time based on each log record.
Further, the progress display module includes:
the offset determining unit is used for acquiring the task offset in the log record and writing the task offset into the local file;
and the front-end display unit is used for displaying the task offset on a front-end interface in a rolling splicing mode.
Further, the task progress real-time display device further includes:
and the end marking module is used for sending the log ending symbol to the message queue when detecting that the task execution is completed.
Further, the queue creation module includes:
the queue generating unit is used for initializing the RabbitMQ message queue and creating a message queue with the task identifier as a name based on the initialized RabbitMQ message queue;
the effective time setting unit is used for setting an expiration time for the message queue, and the expiration time is used for recycling the messages which are not consumed and exceed the preset duration.
Further, the task progress real-time display device further includes:
the timing inquiry module is used for establishing time inquiry for the unconsumed messages in the message queue according to a preset time interval;
the critical time calculation module is used for determining the expired critical time based on the expired time and the current time;
the message to be recovered determining module is used for taking the unconsumed message with the time before the critical time as the message to be recovered in the message queue;
and the message recycling processing module is used for recycling the message to be recycled.
In order to solve the above technical problems, the embodiments of the present application further provide a computer device, which adopts the following technical schemes:
when a service system receives a task starting request, generating a task identifier, and generating a task request body based on the task starting request;
the service system calls a task execution interface to send a task request to the task system, wherein the task request comprises the task request body and the task identifier;
the task system receives a task request sent by the service system, wherein the task request comprises a task identifier and a task request body;
the task system creates a message queue according to the task identification;
the task system executes the task corresponding to the task request body, and sends a task log generated in the task executing process to a message queue containing the task identifier to generate a real-time log record;
the business system calls a task system log acquisition interface through carrying a task identifier according to a preset interval, so that a log record corresponding to the task identifier is obtained from a message queue of the task system through the task system log acquisition interface;
the business system dynamically displays the task progress corresponding to the task identifier in real time based on each log record;
And when the task system detects that the task execution is completed, the task system sends a log ending symbol to the message queue.
In order to solve the above technical problems, embodiments of the present application further provide a computer readable storage medium, which adopts the following technical solutions:
when a service system receives a task starting request, generating a task identifier, and generating a task request body based on the task starting request;
the service system calls a task execution interface to send a task request to the task system, wherein the task request comprises the task request body and the task identifier;
the task system receives a task request sent by the service system, wherein the task request comprises a task identifier and a task request body;
the task system creates a message queue according to the task identification;
the task system executes the task corresponding to the task request body, and sends a task log generated in the task executing process to a message queue containing the task identifier to generate a real-time log record;
the business system calls a task system log acquisition interface through carrying a task identifier according to a preset interval, so that a log record corresponding to the task identifier is obtained from a message queue of the task system through the task system log acquisition interface;
The business system dynamically displays the task progress corresponding to the task identifier in real time based on each log record;
and when the task system detects that the task execution is completed, the task system sends a log ending symbol to the message queue.
Compared with the prior art, the embodiment of the application has the following main beneficial effects:
generating a task identifier when a task starting request is received, and generating a task request body based on the task starting request; invoking a task execution interface to send a task request to a task system, wherein the task request comprises a task request body and a task identifier; according to the preset interval, calling a task system log acquisition interface through carrying a task identifier, so that a log record corresponding to the task identifier is obtained from a message queue of a task system through the task system log acquisition interface; and dynamically displaying the task progress corresponding to the task identifier in real time based on each log record. By the method of acquiring the log records, the task system is prevented from directly counting, the system memory overhead is saved, meanwhile, the log records are acquired at preset intervals, the continuity and instantaneity of the progress are ensured, the real-time display of the task progress is realized, and the task progress query efficiency is improved.
Drawings
For a clearer description of the solution in the present application, a brief description will be given below of the drawings that are needed in the description of the embodiments of the present application, it being obvious that the drawings in the following description are some embodiments of the present application, and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a schematic diagram of interactions between a task system and a business system in a task progress real-time display method according to the present application;
FIG. 3 is a flow chart of one embodiment of a method of displaying task progress in real-time according to the present application;
FIG. 4 is a schematic structural diagram of one embodiment of a method apparatus for displaying task progress in real time according to the present application;
FIG. 5 is a schematic structural diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description and claims of the present application and in the description of the figures above are intended to cover non-exclusive inclusions. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In order to better understand the technical solutions of the present application, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as a web browser application, a shopping class application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablet computers, electronic book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic video expert compression standard audio plane 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic video expert compression standard audio plane 4) players, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the method for displaying the task progress in real time provided in the embodiments of the present application is generally executed by a server, and accordingly, the device for displaying the task progress in real time is generally disposed in the server.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
In this embodiment, the method for displaying task progress in real time includes the following steps executed by the service system:
When a task starting request is received, generating a task identifier, and generating a task request body based on the task starting request;
invoking a task execution interface to send a task request to a task system, wherein the task request comprises a task request body and a task identifier;
according to the preset interval, calling a task system log acquisition interface through carrying a task identifier, so that a log record corresponding to the task identifier is obtained from a message queue of a task system through the task system log acquisition interface;
and dynamically displaying the task progress corresponding to the task identifier in real time based on each log record.
In this embodiment, the method for displaying task progress in real time further includes the following steps executed by the task system:
receiving a task request sent by a service system, wherein the task request comprises a task identifier and a task request body;
creating a message queue according to the task identifier;
executing tasks corresponding to the task request body, and sending task logs generated in the task executing process to a message queue containing task identifiers to generate real-time log records;
upon detecting completion of task execution, a log terminator is sent to the message queue.
Specific interactions between a task system and a service system can be shown with reference to fig. 2, fig. 2 is a schematic diagram of task system and service system interactions in a method for displaying task progress in real time, the service system generates a task identifier and a task request body as task requests, sends the task requests, creates a message queue after the task system receives the task requests, executes tasks in the task requests, generates log records, consumes the log records by the service system, and displays progress in real time based on the log records.
With continued reference to FIG. 3, a flow chart of one embodiment of a method of task progress real-time display according to the present application is shown. The method for displaying the task progress in real time comprises the following steps:
in step S201, when receiving the task start request, the service system generates a task identifier, and generates a task request body based on the task start request.
In this embodiment, the electronic device (for example, the server shown in fig. 1) on which the task progress real-time display method operates may perform interaction between the service system, the task system and the user terminal through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection may include, but is not limited to, 3G/4G/5G connection, wiFi connection, bluetooth connection, wiMAX connection, zigbee connection, UWB (ultra wideband) connection, and other now known or later developed wireless connection.
Specifically, after the user passes legal account password login verification on the service system interface, the user obtains a credential for accessing the task system, the subsequent request carries the credential, the user further clicks a task starting button on the service system interface, and the front end generates a task starting request and sends the request to the service system.
The task request body is assembled according to respective service requirements, and the specific generation mode is as follows: according to the data of the task request of the service system, a task request body is generated according to a preset request body format, for example, in a specific implementation mode, a task is a batch modification work item state, the task request body of the task comprises an array, the array comprises information such as work item id, changed state and the like, after the task request is received, the information such as each work item state id, changed state and the like to be changed is obtained from the task request, each work item state id to be changed and the changed state form a data pair to obtain data, the data is packaged according to the preset format of the task request body to obtain a task request body corresponding to the task, the preset request body format comprises, but is not limited to json, lua, xml, yaml and the like, the task request body can be selected according to actual needs specifically, and the task request body is not limited.
Step S202, the business system calls a task execution interface to send a task request to the task system, wherein the task request comprises a task request body and a task identifier.
Specifically, after generating the task request body, the service system generates a task request based on the task request body and the task identifier, and invokes the task execution interface to send the task request to the task system.
In this embodiment, the task identifier adopts a universal unique identifier (Universally Unique Identifier, UUID), which may specifically be a character string formed by combining one or more of a number, an english character and a special symbol, for example ABC20180356.
The task request body can specifically set a format and content according to a task, for example, for a task of modifying a work item state in batches, the format of the task request body can be set into json format, and the content is:
{
"Task status update":[
{
"UIDD":"ABC20180356",
"Status": "authorization"
},
{
"UIDD":"ACD20210137",
"Status": "authorization"
},
{
"UIDD":"ADF20181558",
"Status" reject "
},
]
}。
In step S203, the task system receives a task request sent by the service system, where the task request includes a task identifier and a task request body.
The task system is a task executing system, and after the task system generates a task request and sends the task request to the task system, the task system receives the task request sent by the service system and analyzes the task request to obtain a task identifier and a task request body.
It should be noted that the task identifier of each task is unique. The task system may process one or more tasks simultaneously, distinguishing between different tasks based on unique task identifications.
In step S204, the task system creates a message queue according to the task identifier.
In this embodiment, the task system creates the message queue according to the task identifier, specifically, the message queue uses the task identifier as a name, so that log records of different tasks can be quickly performed when asynchronous message processing is performed.
Optionally, in this embodiment, when the message queues are generated, the expiration time of each message queue is set, so that part of the messages are prevented from occupying the system memory in an unconsumed state, thereby resulting in waste of the memory.
Step S205, the task system executes the task corresponding to the task request body, and sends the task log generated in the task executing process to the message queue containing the task identifier to generate a real-time log record.
Specifically, the task system executes tasks corresponding to the task request body in an asynchronous mode, and sends task logs generated in the task executing process to a message queue containing task identifiers so as to generate real-time log records. Preferably, the message queue name corresponding to each log record is a task identifier.
Step S206, the business system calls the task system log acquisition interface through carrying the task identification according to the preset interval, so that the log record corresponding to the task identification is obtained from the message queue of the task system through the task system log acquisition interface.
Specifically, after the service system successfully starts a task, a task system log acquisition interface is called by carrying a task identifier in an HTTPS mode according to a preset interval, so that the log of the task system can be acquired in real time and displayed to a user. N logs can be obtained for each request, and the value of n can be determined according to the performance of the server system, for example, the value is set to be 500-1000, so that the overload pressure of the task system is avoided.
Step S207, the business system dynamically displays the task progress corresponding to the task identifier in real time based on each log record.
Specifically, the service system writes the acquired logs into the local file in a file splicing mode, the front end requests the service system at fixed time through the interface, the service system returns the logs in the file according to the offset, the front end is displayed on the interface in a rolling splicing mode, the advantage of writing the logs into the local file is that the task logs are prevented from being lost due to a network and the like, the follow-up problem investigation is convenient, the rolling splicing mode is more natural in flow, and the user visual experience is better.
In some optional implementations, after the service system dynamically displays the task progress corresponding to the task identifier in real time based on each log record, the method further includes: and when the task system detects that the task execution is completed, the task system sends a log ending symbol to the message queue.
Specifically, when the task system detects that the execution of the task is completed, the task system sends a log ending symbol to the message queue, so that when the log ending symbol is detected to be consumed, the message queue corresponding to the task is cleared, and the memory is saved.
When a task starting request is received, a task identifier is generated, and a task request body is generated based on the task starting request; invoking a task execution interface to send a task request to a task system, wherein the task request comprises a task request body and a task identifier; according to the preset interval, calling a task system log acquisition interface through carrying a task identifier, so that a log record corresponding to the task identifier is obtained from a message queue of a task system through the task system log acquisition interface; and dynamically displaying the task progress corresponding to the task identifier in real time based on each log record. By the method of acquiring the log records, the task system is prevented from directly counting, the system memory overhead is saved, meanwhile, the log records are acquired at preset intervals, the continuity and instantaneity of the progress are ensured, the real-time display of the task progress is realized, and the task progress query efficiency is improved.
In some optional implementations, in step S204, creating the message queue according to the task identity includes:
Initializing a RabbitMQ message queue, and creating a message queue with a task identifier as a name based on the initialized RabbitMQ message queue;
and setting an expiration time for the message queue, wherein the expiration time is used for recycling the messages which are not consumed for more than a preset time.
The RabbitMQ is a message middleware which receives and forwards messages, does not process the messages, only receives, stores and forwards the messages, and can set the preset time length according to actual requirements, for example, 5 minutes.
The message queue takes the task identifier as a name, so that log records of different tasks can be rapidly carried out when asynchronous message processing is executed.
In the present embodiment, advantages of using the rabkitmq include high reliability, scalability, flexibility, and the like. The expiration time is set to avoid the problems of message accumulation, memory overflow and the like caused by non-consumption of a service system.
In some alternative implementations, after setting the expiration time for the message queue, the method further includes:
creating time inquiry for the unconsumed information in the information queue according to a preset time interval;
determining an expired critical time based on the expiration time and the current time;
In the message queue, an unconsumed message with the time before the critical time is created as a message to be recovered;
and recycling the message to be recycled.
Specifically, the expired critical time is determined based on the expiration time and the current time, the expiration time can be obtained by subtracting the expiration time from the current time point, or a delay of several seconds can be set according to actual needs, which is not limited herein. The preset time interval may be set according to the actual service requirement and the resource allocation of the server, for example, 30 minutes, etc., which is not limited herein.
In this embodiment, by cleaning the long-term unconsumed message, the system resource is prevented from being occupied by too many invalid messages, thereby being beneficial to improving the processing efficiency.
In some optional implementations, after sending the log terminator to the message queue when the task execution completion is detected, the task progress real-time display method further includes:
and if the log ending symbol is detected to be consumed, deleting the message queue corresponding to the log ending symbol.
In this embodiment, after the task system completes executing the task, the task system sends the log ending symbol to the message queue, and after detecting that the log ending symbol is consumed, deletes the message queue corresponding to the log ending symbol, so as to save the memory of the server.
In some optional implementations, in step 207, the service system dynamically displays the task progress corresponding to the task identifier in real time based on each log record, including the following steps:
acquiring a task offset in a log record and writing the task offset into a local file;
and displaying the task offset on the front-end interface in a scrolling and splicing mode.
In this embodiment, the service system writes the acquired log into the local file in a file splicing manner, the front end requests the service system at regular time (for example, every 5 seconds) through the interface, the service system returns the log in the file according to the offset, the front end is displayed on the interface in a rolling splicing manner, the benefit of writing into the local file is that the task log is prevented from being lost due to network and other reasons, the subsequent problem investigation is convenient, and the rolling splicing manner can enable the user experience to be better.
In some optional implementations, after step 207, that is, after the real-time dynamic display of the task progress corresponding to the task identifier based on each log record, the task progress real-time display method further includes:
if the log ending symbol is read from the log record, the log is stopped being read, and the task is displayed on the front page to be completed.
In this embodiment, when the service system reads the log, if the log ending symbol is read, the log is stopped being read, and the task is displayed on the front end page. Meanwhile, when the task system detects that the log ending symbol is consumed, the task system records the memory corresponding to the task identifier from the memory, so that the memory of the server is saved.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by computer readable instructions stored in a computer readable storage medium that, when executed, may comprise the steps of the embodiments of the methods described above. The storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a random access Memory (Random Access Memory, RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
With further reference to fig. 4, as an implementation of the method shown in fig. 3, the present application provides an embodiment of a task progress real-time display device, where an embodiment of the device corresponds to the embodiment of the method shown in fig. 3, and the device may be specifically applied to various electronic devices.
As shown in fig. 4, the task progress real-time display device 300 according to the present embodiment includes a task generating module 31, a task transmitting module 32, a task receiving module 33, a queue creating module 34, a task executing module 35, a log collecting module 36, and a progress display module 37, wherein:
the task generating module 31 is configured to generate a task identifier when a task start request is received, and generate a task request body based on the task start request;
the task sending module 32 is configured to invoke a task execution interface to send a task request to the task system, where the task request includes a task request body and a task identifier;
the task receiving module 33 is configured to receive a task request sent by the service system, where the task request includes a task identifier and a task request body;
a queue creation module 34, configured to create a message queue according to the task identifier;
the task execution module 35 is configured to execute a task corresponding to the task request body, and send a task log generated in a task execution process to a message queue containing a task identifier, so as to generate a real-time log record;
The log collection module 36 is configured to call the task system log acquisition interface by carrying the task identifier according to a preset interval, so that a log record corresponding to the task identifier is obtained from a message queue of the task system through the task system log acquisition interface;
the progress display module 37 is configured to dynamically display, in real time, a task progress corresponding to the task identifier based on each log record.
Further, the task progress real-time display device further includes:
the timing inquiry module is used for establishing time inquiry for the unconsumed messages in the message queue according to a preset time interval;
the critical time calculation module is used for determining the expired critical time based on the expired time and the current time;
the message to be recovered determining module is used for taking the unconsumed message with the time before the critical time as the message to be recovered in the message queue;
and the message recycling processing module is used for recycling the message to be recycled.
Further, the progress display module 37 includes:
the offset determining unit is used for acquiring the task offset in the log record and writing the task offset into the local file;
and the front-end display unit is used for displaying the task offset on the front-end interface in a rolling splicing mode.
In this embodiment, the service system writes the acquired log into the local file in a file splicing manner, the front end requests the service system at regular time (for example, every 5 seconds) through the interface, the service system returns the log in the file according to the offset, the front end is displayed on the interface in a rolling splicing manner, the benefit of writing into the local file is that the task log is prevented from being lost due to network and other reasons, the subsequent problem investigation is convenient, and the rolling splicing manner can enable the user experience to be better.
Further, the queue creation module 34 includes:
the queue generating unit is used for initializing the RabbitMQ message queue and creating a message queue with a task identifier as a name based on the initialized RabbitMQ message queue;
the effective time setting unit is used for setting an expiration time for the message queue, and the expiration time is used for recycling the messages which are not consumed and exceed the preset duration.
In the present embodiment, advantages of using the rabkitmq include high reliability, scalability, flexibility, and the like. The expiration time is set to avoid the problems of message accumulation, memory overflow and the like caused by non-consumption of a service system.
When a task starting request is received, a task identifier is generated, and a task request body is generated based on the task starting request; invoking a task execution interface to send a task request to a task system, wherein the task request comprises a task request body and a task identifier; according to the preset interval, calling a task system log acquisition interface through carrying a task identifier, so that a log record corresponding to the task identifier is obtained from a message queue of a task system through the task system log acquisition interface; and dynamically displaying the task progress corresponding to the task identifier in real time based on each log record. By the method of acquiring the log records, the task system is prevented from directly counting, the system memory overhead is saved, meanwhile, the log records are acquired at preset intervals, the continuity and instantaneity of the progress are ensured, the real-time display of the task progress is realized, and the task progress query efficiency is improved.
In order to solve the technical problems, the embodiment of the application also provides computer equipment. Referring specifically to fig. 5, fig. 5 is a basic structural block diagram of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It should be noted that only computer device 4 having components 41-43 is shown in the figures, but it should be understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead. It will be appreciated by those skilled in the art that the computer device herein is a device capable of automatically performing numerical calculations and/or information processing in accordance with predetermined or stored instructions, the hardware of which includes, but is not limited to, microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASICs), programmable gate arrays (fields-Programmable Gate Array, FPGAs), digital processors (Digital Signal Processor, DSPs), embedded devices, etc.
The computer equipment can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The computer equipment can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), programmable Read Only Memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the storage 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the computer device 4. Of course, the memory 41 may also comprise both an internal memory unit of the computer device 4 and an external memory device. In this embodiment, the memory 41 is generally used to store an operating system and various application software installed on the computer device 4, such as computer readable instructions of a task progress real-time display method. Further, the memory 41 may be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute computer readable instructions stored in the memory 41 or process data, for example, execute computer readable instructions of the task progress real-time display method.
The network interface 43 may comprise a wireless network interface or a wired network interface, which network interface 43 is typically used for establishing a communication connection between the computer device 4 and other electronic devices.
The computer device provided in the embodiment can execute the task progress real-time display method. The method for displaying the task progress in real time may be the method for displaying the task progress in real time in each of the above embodiments.
In the embodiment, when a task starting request is received, a task identifier is generated, and a task request body is generated based on the task starting request; invoking a task execution interface to send a task request to a task system, wherein the task request comprises a task request body and a task identifier; according to the preset interval, calling a task system log acquisition interface through carrying a task identifier, so that a log record corresponding to the task identifier is obtained from a message queue of a task system through the task system log acquisition interface; and dynamically displaying the task progress corresponding to the task identifier in real time based on each log record. By the method of acquiring the log records, the task system is prevented from directly counting, the system memory overhead is saved, meanwhile, the log records are acquired at preset intervals, the continuity and instantaneity of the progress are ensured, the real-time display of the task progress is realized, and the task progress query efficiency is improved.
The present application also provides another embodiment, namely, a computer-readable storage medium, where computer-readable instructions are stored, where the computer-readable instructions are executable by at least one processor, so that the at least one processor performs the steps of the task progress real-time display method as described above.
In the embodiment, when a task starting request is received, a task identifier is generated, and a task request body is generated based on the task starting request; invoking a task execution interface to send a task request to a task system, wherein the task request comprises a task request body and a task identifier; according to the preset interval, calling a task system log acquisition interface through carrying a task identifier, so that a log record corresponding to the task identifier is obtained from a message queue of a task system through the task system log acquisition interface; and dynamically displaying the task progress corresponding to the task identifier in real time based on each log record. By the method of acquiring the log records, the task system is prevented from directly counting, the system memory overhead is saved, meanwhile, the log records are acquired at preset intervals, the continuity and instantaneity of the progress are ensured, the real-time display of the task progress is realized, and the task progress query efficiency is improved.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method described in the embodiments of the present application.
It is apparent that the embodiments described above are only some embodiments of the present application, but not all embodiments, the preferred embodiments of the present application are given in the drawings, but not limiting the patent scope of the present application. This application may be embodied in many different forms, but rather, embodiments are provided in order to provide a more thorough understanding of the present disclosure. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described in the foregoing, or equivalents may be substituted for elements thereof. All equivalent structures made by the specification and the drawings of the application are directly or indirectly applied to other related technical fields, and are also within the protection scope of the application.

Claims (4)

1. The real-time task progress display method is characterized by being applied to a distributed cluster, wherein the distributed cluster comprises a service system and a task system, and comprises the following steps executed by the service system:
when receiving a task starting request, the service system generates a task identifier and generates a task request body based on the task starting request, wherein the task request body generating step based on the task starting request specifically comprises the following steps: acquiring task request data, and generating a task request body according to a preset request body format, wherein the preset request body format is set according to a specific task;
the service system calls a task execution interface to send a task request to the task system, wherein the task request comprises the task request body and the task identifier;
the task system receives a task request sent by the service system, wherein the task request comprises a task identifier and a task request body;
the task system creates a message queue according to the task identifier, wherein the task system creates the message queue according to the task identifier comprises: initializing a RabbitMQ message queue, and creating a message queue with the task identifier as a name based on the initialized RabbitMQ message queue; setting an expiration time for the message queue, where the expiration time is used to recycle messages that are not consumed for longer than a preset duration, and specifically, after the expiration time is set for the message queue, the method further includes: according to a preset time interval, creating time inquiry is carried out on the unconsumed messages in the message queue; determining an expired critical time based on the expiration time and the current time; in the message queue, an unconsumed message with the time before the critical time is created as a message to be recovered; recycling the message to be recycled;
The task system executes the task corresponding to the task request body, and sends a task log generated in the task executing process to a message queue containing the task identifier to generate a real-time log record;
the service system calls a task system log acquisition interface by carrying task identifications according to preset intervals so as to obtain log records corresponding to the task identifications from a message queue of the task system by the task system log acquisition interface, wherein the service system carries the task identification to call the task system log acquisition interface by carrying task identifications through HTTPS according to preset intervals, and the obtaining the log records corresponding to the task identifications from the message queue of the task system comprises the following steps: setting the number of log records obtained from a message queue of the task system each time according to the performance of the server system;
the business system dynamically displays the task progress corresponding to the task identifier in real time based on each log record, wherein the business system dynamically displays the task progress corresponding to the task identifier based on each log record comprises the following steps: acquiring a task offset in a log record and writing the task offset into a local file; displaying the task offset on a front-end interface in a rolling splicing mode, and after the business system dynamically displays the task progress corresponding to the task identifier in real time based on each log record, the task progress real-time display method further comprises the following steps: when the task system detects that the task execution is completed, the task system sends a log ending symbol to a message queue, and when the task system detects that the task execution is completed, the task progress real-time display method further comprises the following steps: if the log ending symbol is detected to be consumed, deleting a message queue corresponding to the log ending symbol; and if the log ending symbol is read from the log record, stopping reading the log, and displaying that the task is completed on the front page.
2. The utility model provides a real-time display device of task progress, characterized in that is applied to distributed cluster, the real-time display device of task progress includes business system and task system, the business system includes:
the task generating module is used for generating a task identifier when a task starting request is received, and generating a task request body based on the task starting request, wherein the task request body generating step based on the task starting request specifically comprises the following steps: acquiring task request data, and generating a task request body according to a preset request body format, wherein the preset request body format is set according to a specific task;
the task sending module is used for calling a task execution interface to send a task request to the task system, wherein the task request comprises the task request body and the task identifier;
the task receiving module is used for receiving a task request sent by the service system, wherein the task request comprises a task identifier and a task request body;
the system comprises a queue creation module, a queue management module and a queue management module, wherein the queue creation module is used for creating a message queue according to the task identifier, the queue creation module comprises a queue generation unit and an effective time setting unit, the queue generation unit is used for initializing a RabbitMQ message queue, creating a message queue with the task identifier as a name based on the initialized RabbitMQ message queue, and the effective time setting unit is used for setting an expiration time for the message queue, and the expiration time is used for recycling the message which is not consumed for more than a preset time;
The timing inquiry module is used for establishing time inquiry for the unconsumed messages in the message queue according to a preset time interval;
the critical time calculation module is used for determining the expired critical time based on the expired time and the current time;
the message to be recovered determining module is used for taking the unconsumed message with the time before the critical time as the message to be recovered in the message queue;
the message recycling processing module is used for recycling the message to be recycled;
the task execution module is used for executing the task corresponding to the task request body, sending a task log generated in the task execution process to a message queue containing the task identifier, and generating a real-time log record;
the system comprises a log acquisition module, a task system and a task system, wherein the log acquisition module is used for calling a task system log acquisition interface through carrying task identifiers according to a preset interval so that a log record corresponding to the task identifiers is obtained from a message queue of the task system through the task system log acquisition interface, the task system carries the task identifiers to call the task system log acquisition interface through HTTPS according to the preset interval, and the log record corresponding to the task identifiers is obtained from the message queue of the task system, and the log acquisition module comprises: setting the number of log records obtained from a message queue of the task system each time according to the performance of the server system;
The progress display module is used for dynamically displaying the task progress corresponding to the task identifier in real time based on each log record, wherein the progress display module comprises an offset determination unit and a front-end display unit, the offset determination unit is used for obtaining the task offset in the log records and writing the task offset into a local file, and the front-end display unit is used for displaying the task offset on a front-end interface in a rolling splicing mode;
the end marking module is used for sending a log ending symbol to the message queue when the completion of task execution is detected;
the queue deleting module is used for deleting the message queue corresponding to the log ending symbol if the log ending symbol is detected to be consumed;
and the stop reading module is used for stopping reading the log and displaying the completion of the task on the front page if the log ending symbol is read from the log record.
3. A computer device comprising a memory having stored therein computer readable instructions which when executed by the processor implement the steps of the task progress real-time display method of claim 1.
4. A computer readable storage medium having stored thereon computer readable instructions which when executed by a processor perform the steps of the task progress real-time display method of claim 1.
CN202310792037.1A 2023-06-30 2023-06-30 Task progress real-time display method and device, computer equipment and storage medium Active CN116521630B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310792037.1A CN116521630B (en) 2023-06-30 2023-06-30 Task progress real-time display method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310792037.1A CN116521630B (en) 2023-06-30 2023-06-30 Task progress real-time display method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116521630A CN116521630A (en) 2023-08-01
CN116521630B true CN116521630B (en) 2024-01-02

Family

ID=87397998

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310792037.1A Active CN116521630B (en) 2023-06-30 2023-06-30 Task progress real-time display method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116521630B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017101701A1 (en) * 2015-12-15 2017-06-22 阿里巴巴集团控股有限公司 Method and device for querying task status
CN107193669A (en) * 2017-05-09 2017-09-22 千寻位置网络有限公司 The system and design method of maintenance interface based on mixed cloud or large-scale cluster
CN110505238A (en) * 2019-09-06 2019-11-26 杭州安恒信息技术股份有限公司 The processing unit and method of message queue based on EDR
CN111221663A (en) * 2019-11-21 2020-06-02 苏州浪潮智能科技有限公司 Message data processing method, device, equipment and readable storage medium
CN111339186A (en) * 2020-02-19 2020-06-26 平安科技(深圳)有限公司 Workflow engine data synchronization method, device, medium and electronic equipment
CN114780228A (en) * 2022-06-23 2022-07-22 浙江九州云信息科技有限公司 Hybrid cloud resource creation method and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11080031B2 (en) * 2016-02-05 2021-08-03 Sas Institute Inc. Message-based coordination of container-supported many task computing
CN113867916B (en) * 2021-09-28 2024-05-07 北京百度网讯科技有限公司 Task processing method and device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017101701A1 (en) * 2015-12-15 2017-06-22 阿里巴巴集团控股有限公司 Method and device for querying task status
CN107193669A (en) * 2017-05-09 2017-09-22 千寻位置网络有限公司 The system and design method of maintenance interface based on mixed cloud or large-scale cluster
CN110505238A (en) * 2019-09-06 2019-11-26 杭州安恒信息技术股份有限公司 The processing unit and method of message queue based on EDR
CN111221663A (en) * 2019-11-21 2020-06-02 苏州浪潮智能科技有限公司 Message data processing method, device, equipment and readable storage medium
CN111339186A (en) * 2020-02-19 2020-06-26 平安科技(深圳)有限公司 Workflow engine data synchronization method, device, medium and electronic equipment
CN114780228A (en) * 2022-06-23 2022-07-22 浙江九州云信息科技有限公司 Hybrid cloud resource creation method and system

Also Published As

Publication number Publication date
CN116521630A (en) 2023-08-01

Similar Documents

Publication Publication Date Title
CN112162965B (en) Log data processing method, device, computer equipment and storage medium
CN109936621B (en) Information security multi-page message pushing method, device, equipment and storage medium
CN111782304B (en) Paging loading data logic control method, device, computer equipment and medium
WO2020135245A1 (en) Hosting application processing method and device, and computer-readable storage medium
WO2016107465A1 (en) Method, device, and system for implementing card-type desktop
CN113254445B (en) Real-time data storage method, device, computer equipment and storage medium
US20160026728A1 (en) Interaction Method And Device Between Browsers And Browser
CN112860662B (en) Automatic production data blood relationship establishment method, device, computer equipment and storage medium
CN112468409A (en) Access control method, device, computer equipment and storage medium
CN111475388A (en) Data push test method and device, computer equipment and storage medium
CN113656193A (en) Application communication method, system, electronic equipment and storage medium
CN116521630B (en) Task progress real-time display method and device, computer equipment and storage medium
CN116974927A (en) Performance automatic test method, system, computer equipment and storage medium
CN106789568A (en) A kind of communication information acquisition methods and device
CN116483425A (en) Micro-service gray level edition issuing method, device, equipment and storage medium thereof
CN115330396A (en) Payment state acquisition method and device, computer equipment and storage medium
CN116112457A (en) Method, device, computer equipment and storage medium for notifying message
US11893199B2 (en) Systems and methods for viewing incompatible web pages via remote browser instances
CN113449230A (en) Method and system for determining exposure element, client and server
CN116467145A (en) Page performance data acquisition method and device, computer equipment and storage medium
CN114139072B (en) Page data processing method and device, electronic equipment and storage medium
CN116894736A (en) Mail management method, device, computer equipment and storage medium
CN116304431A (en) Webpage automation method and device, computer equipment and storage medium
CN116756163A (en) Data synchronization improvement method, device, equipment and storage medium thereof
CN117827495A (en) Rights and interests state updating method, device, equipment and medium

Legal Events

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