Task input and output display method for development, operation and maintenance assembly line
By clarifying the input and output dependencies of development and operation pipeline tasks and performing cache management, the problem of low pipeline execution efficiency in the existing technology is solved, accurate reuse and caching of tasks is achieved, and quality inspection of code changes and new product delivery are improved. efficiency.
Patent Information
- Application Number
- CN202310244325.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-09
- Publication Date
- 2024-09-10
AI Technical Summary
The existing development and operation pipeline cannot effectively cache and reuse the input and output of tasks, resulting in inefficiencies in the quality inspection of code changes and the delivery of new products.
By writing development and operation pipeline description files, the input and output dependencies between tasks are clarified, and the operating system is used to automatically obtain and cache task outputs to achieve precise reuse and caching of tasks.
It greatly reduces repeated calculations and unnecessary time overhead, improves pipeline execution efficiency, and allows developers and users to obtain development and operation feedback more quickly.
Smart Images

Figure CN118626091A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software development and operation, and in particular to a method for displaying input and output of development and operation pipeline tasks. Background Art
[0002] The development and operation pipeline is an automated pipeline that connects development and operation tasks such as scanning, compiling, testing, and deployment. Each task is actually completed by the corresponding automated tool. By using the development and operation pipeline, the efficiency of software project development and operation can be improved. Whenever the code of the software project changes, the software product can be automatically built and the quality of the software product can be checked, thereby achieving efficient delivery and operation adjustments.
[0003] Currently, most continuous integration / deployment / delivery systems such as Jenkins have implemented development and operation pipelines (or continuous integration pipelines). Developers and maintainers of software projects can set tasks in the pipeline through configuration files or graphical interfaces.
[0004] As the scale of software projects continues to expand, the number of development and operation tasks increases and the tasks become more complex, the execution of a complete development and operation pipeline takes a long time, which greatly affects the inspection of code change quality, the delivery of new products, and the adjustment of operations.
[0005] In some cases, caching the results of past pipeline executions can speed up the re-execution of the pipeline. However, since the existing development and operation pipeline description only gives the topological order between tasks, there is no direct description of the input and output dependencies between tasks, making it impossible to achieve effective caching and accurate reuse of tasks. Summary of the invention
[0006] The technical problem to be solved by the present invention is: to achieve effective caching and precise reuse of development and operation pipeline tasks and improve the execution efficiency of the pipeline, a method for displaying the input and output of development and operation pipeline tasks is provided to establish input and output dependencies between tasks.
[0007] The development and operation pipeline task input and output display method of the present invention comprises the following steps:
[0008] (1) Write a development and operation pipeline description file, develop an operation task input and output description file, and construct a pipeline based on the development and operation pipeline description file; wherein:
[0009] The development and operation pipeline includes a series of development and operation tasks. The development and operation tasks correspond to the automated Linux programs that implement the tasks. The programs can be existing open source programs, such as the GCC compiler and the Pylint code quality scanner, or they can be programs written by developers according to specific business needs. The present invention does not involve the specific content of the tasks and the implementation of the programs.
[0010] The development and operation pipeline description file includes the task ID, task name, task text description, and task start command of each task on the pipeline;
[0011] The task startup command is a Linux Shell command, including the program name and startup parameters;
[0012] There is an association relationship between tasks. If the output of a task is the input of the next task, then the task is the predecessor task of the next task. The source task is a task without a predecessor task.
[0013] The output description file of a task is a formatted file used to describe the output of a task. The output of a task is the string returned by the command line after the task program is run and one or more files generated. The output description file of a task has a numerical domain and a file domain. The value of the numerical domain is the string returned by the command line after the task program is run, which is automatically obtained and filled in by the operating system in step (2). The value of the file domain is the path of each output file generated after the task program is run and the digital fingerprint of each output file. The file path is filled in by the developer according to the business logic to indicate the file output by the task. The digital fingerprint of the file is automatically obtained and filled in by the operating system in step (2). Each time a task is executed, a new version of the output description file of the task is generated.
[0014] The input description file of a task is a formatted file used to describe the input of a task. The input of a task is the output of the task's predecessor. The input description file of a task has a file field. The value of the file field is the path of the output description file of the task's predecessor. It is used to indicate the output description file of the task's predecessor and is filled in by the developer according to the business logic.
[0015] (2) executing each task by parsing the development and operation pipeline description file and the task input description file of step (1). After the task is executed, the operating system automatically obtains and updates the numerical domain in each task output description file and the file digital fingerprint part of the file domain, obtains a new version of the output description file of each task, and caches it. The new version of the file indicated in the file domain of each output description file is also cached. Each execution of the pipeline has a unique number. When caching the task output description files of multiple executions of the pipeline, the version of the cached file is marked with the number of the pipeline execution round, and the path remains unchanged;
[0016] (3) If the input of the source task in the pipeline changes, the pipeline constructed in step (1) is executed again, and for each task T, the output description files of the predecessor tasks indicated by the file path in the file field of the input description file of task T and the files indicated in the file field of the output description file of each predecessor task P of task T are compared to see whether they are consistent with the files cached during the kth round of execution of the predecessor task P: if they are consistent, task T is not executed, and the output description file of task T cached in the kth round and the output file indicated in the file field thereof are used as the output description file and output file of the task T executed again; otherwise, task T is executed, and the resulting output description file and the new version of the output file indicated in the file field of the output description file are cached.
[0017] Furthermore, the development and operation pipeline description file includes the task ID, task name, task text description, and task start command of each task on the pipeline; there is an association relationship between each task. If the output of a task is the input of the next task, then the task is the predecessor task of the next task, and the source task is a task without a predecessor task.
[0018] Furthermore, the task output description file is a formatted file used to describe the task output, and the output of the task is the string returned by the command line after the task program is run and one or more files generated; the task output description file has a numerical domain and a file domain, and the value of the numerical domain is the string returned by the command line after the task is run, and the value of the file domain is the path of each output file generated after the task is run and the digital fingerprint of each output file; the task input description file is a formatted file used to describe the task input, and the input of the task is the output of the predecessor task of the task, and the task input description file has a file domain for storing the path of the corresponding predecessor task output description file.
[0019] Furthermore, each execution of the pipeline has a unique number, and when caching task output description files of multiple executions of the pipeline, the pipeline number is used to distinguish versions.
[0020] Furthermore, the MD5 algorithm is used to calculate the digital fingerprint in the file domain.
[0021] A server, characterized in that it comprises a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing each step in the above method.
[0022] A computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0023] Compared with the prior art, the present invention has the following positive effects:
[0024] In traditional development and operation pipelines, the input and output of each task are maintained by the developer. These input and output are black boxes for the pipeline execution engine. The pipeline execution engine cannot effectively cache the output of the task and use the cache to accelerate the execution of a new round of pipelines. The present invention explicitly defines the input and output of the development and operation tasks in the relevant description files, and performs unified cache management. In the execution of a new round of pipelines, once the pipeline execution engine recognizes that the output of the previous task has not changed from the cache, it can skip the current task and directly reuse the output of the current task cache, which greatly reduces repeated calculations and unnecessary time overhead, and developers and users can get development and operation feedback faster. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 The present invention is a flowchart of the steps of an embodiment of a method for visualizing input and output of development and operation pipeline tasks. DETAILED DESCRIPTION
[0026] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0027] like Figure 1 As shown, a flowchart of an embodiment of a method for displaying input and output of a development and operation pipeline task of the present invention may include the following steps:
[0028] Step 1: Write a development and operation pipeline task description file, in which you set each task in the pipeline, including setting the unique number of the task, the task name, the task text description, and the shell command for executing the task program;
[0029] Preferably, the pipeline description file adopts the following json format:
[0030]
[0031] Step 2: Write input and output description files for development and operation tasks;
[0032] Preferably, the output description file naming convention is task_ <id>_output_<No.> , where id is the id of the task, No. is the number of the description file, the digital fingerprint of the file indicated in the file field is calculated using the MD5 algorithm, and the input description file uses the following json format:
[0033]
[0034] The input description file naming convention is task_ <id>_input_<No.> , where id is the id of the task, No. is the number of the description file, and the output description file uses the following json format:
[0035]
[0036] Step 3: Execute the pipeline and cache the output files of the tasks. This is done by parsing the development and operation pipeline task description file of step 1, and caching the output description files of each task. The files in the file domain are cached together. Each execution of the pipeline has a unique number. When caching the output description files of multiple executions of the pipeline, the version of the cached file is marked with the number of the pipeline execution round, and the path remains unchanged.
[0037] Preferably, the naming convention for cached output description files is task_ <id>_output_<No.> _<build_id> , where id is the id of the task, No. is the number of the description file, and build_id is the number of the pipeline execution round.
[0038] Step 4: Execute the pipeline again, and compare the input of each task with the cached input: if the inputs are consistent, do not execute the task, and use the cached output description file of the task as the output description file of this task; otherwise, execute the task and cache the new output description file;
[0039] For example, a pipeline has two tasks with IDs 1 and 2, where task 1 is the predecessor of task 2, and the pipeline is currently being executed for the second time:
[0040] When comparing the current input with the cached input, the cache file named task_1_output_1_1 is searched through the reference value task_1_output_1 in the file field in the input description file;
[0041] Compare the located cache file task_1_output_1_1 with the input of this pipeline execution, that is, the output task_1_output_1_2 generated by the predecessor task, to check whether the values of each numerical field in the file are consistent and whether the file digital fingerprint of the file field is consistent. If both are consistent, it is considered that the input file and the cached input file are consistent, and the cached task_2_output_1_1 is used as the output of this execution.
[0042] Although the specific embodiments of the present invention are disclosed for the purpose of illustration, the purpose is to help understand the content of the present invention and implement it accordingly, those skilled in the art will understand that various substitutions, changes and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, the present invention should not be limited to the content disclosed in the best embodiment, and the scope of the present invention is subject to the scope defined in the claims.< / id> < / id> < / id>
Claims
1. A method for displaying input and output of development and operation pipeline tasks, the steps of which include: 1) Obtain the development and operation pipeline description file, task input description file, and task output description file input or written by the user; Construct a pipeline according to the development and operation pipeline description file; 2) executing each task in the pipeline in sequence and generating the numerical domain information and file digital fingerprint of the file domain required for each corresponding task output description file according to the task input description file corresponding to the task when executing each task, generating each corresponding task output description file and caching it, and caching the files indicated in the file domain of each corresponding task output description file together; 3) When the input of the source task in the pipeline changes, the pipeline is executed again, and for each task T, the output description files of each predecessor task indicated by the file path in the file field of the input description file of task T, and the file indicated in the file field of the output description file of each predecessor task P of task T are compared to see whether they are consistent with the file cached during the kth round of execution of the predecessor task P: if they are consistent, task T is not executed, and the output description file of task T cached in the kth round and the output file indicated by the file field therein are used as the output description file and output file of the task T executed again; otherwise, task T is executed, and the resulting output description file and the new version of the output file indicated in the file field of the output description file are cached.
2. The method according to claim 1, characterized in that: The development and operation pipeline description file includes the task ID, task name, task text description, and task start command of each task on the pipeline; There is an association relationship between each task. If the output of a task is the input of the next task, then the task is the predecessor task of the next task. The source task is a task without a predecessor task.
3. The method according to claim 2, characterized in that The task output description file is a formatted file used to describe the task output. The output of the task is the string returned by the command line after the task program is run and one or more files generated. The task output description file has a numerical domain and a file domain. The value of the numerical domain is the string returned by the command line after the task is run, and the value of the file domain is the path of each output file generated after the task is run and the digital fingerprint of each output file. The task input description file is a formatted file used to describe the task input. The input of the task is the output of the predecessor task of the task. The task input description file has a file domain for storing the path of the corresponding predecessor task output description file.
4. The method according to claim 1, 2 or 3, characterized in that: Each execution of the pipeline has a unique number. When caching task output description files of multiple executions of the pipeline, the pipeline number is used to distinguish versions.
5. The method according to claim 1, 2 or 3, characterized in that: The MD5 algorithm is used to calculate the digital fingerprint in the file domain.
6. A server, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing each step in the method according to any one of claims 1 to 5.
7. 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 5 are implemented.
