Method for deploying an algorithm and related device

By generating framework files and merging algorithm code files, the deployment process of AI algorithm services has been simplified, solving the problem of repetitive operations in existing technologies, improving deployment efficiency and reducing time costs.

CN115480771BActive Publication Date: 2025-10-21BOE TECHNOLOGY GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110602493.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-31
Publication Date
2025-10-21
Estimated Expiration
2041-05-31

AI Technical Summary

Technical Problem

In existing technologies, with the increasing number of artificial intelligence algorithms, the deployment of algorithm models involves a lot of repetitive work and poor efficiency. This is especially true when the web framework of the AI ​​algorithm needs to be optimized or the pipeline process requirements change, requiring multiple repetitive operations to complete the release.

Method used

A method and device are provided to obtain algorithm code files and configuration files, generate framework files using deployment tools, convert algorithm code files into services, merge them into source code files, and finally deploy the algorithm service, thus simplifying the deployment operation.

Benefits of technology

By developing algorithm maintenance into a general-purpose tool, the deployment process of algorithm services is simplified, repetitive operations are reduced, efficiency is improved, and time costs are lowered.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115480771B_ABST
    Figure CN115480771B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for deploying an algorithm and related devices. The method comprises: obtaining an algorithm code file and a corresponding first configuration file; and according to the first configuration file, calling a deployment tool to perform the following steps: obtaining a second configuration file and generating a framework file for the algorithm code file based on the second configuration file, the framework file being used to convert the algorithm code file into a service; merging the framework file and the algorithm code file into a source code file of the service corresponding to the algorithm; and deploying the service corresponding to the algorithm based on the source code file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method for deploying an algorithm and related devices. Background Art

[0002] One common challenge facing open platform development is the need to convert artificial intelligence (AI) algorithm models into callable application programming interfaces (APIs). As the number of AI algorithms increases, so does the amount of repetitive work involved. For example, when the web framework of an AI algorithm needs to be optimized or the corresponding pipeline requirements change, each algorithm must be maintained and a commit, push, and pipeline command executed to complete a release. This requires multiple repetitive operations, which is inefficient. Summary of the Invention

[0003] The present disclosure proposes a method for deploying an algorithm and related devices.

[0004] In a first aspect, the present disclosure provides a method for deploying an algorithm, comprising:

[0005] Obtaining an algorithm code file and a corresponding first configuration file; and

[0006] According to the first configuration file, the deployment tool is called to perform the following steps:

[0007] Obtaining a second configuration file and generating a framework file for the algorithm code file based on the second configuration file, wherein the framework file is used to convert the algorithm code file into a service;

[0008] Merging the framework file and the algorithm code file into a source code file for the service corresponding to the algorithm; and

[0009] Based on the source code file, the service corresponding to the algorithm is deployed.

[0010] In a second aspect of the present disclosure, a computer device is provided, characterized in that it includes one or more processors, a memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method described in the first aspect.

[0011] In a third aspect, the present disclosure provides a system for deploying an algorithm, comprising:

[0012] The computer device according to the first aspect; and

[0013] The server is configured to run the continuous integration system to perform the following steps:

[0014] Obtaining an algorithm code file and a corresponding first configuration file, and,

[0015] Based on the algorithm code file and the corresponding first configuration file, the running script of the computer device is called to enable the computer device to deploy the service corresponding to the algorithm.

[0016] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium containing a computer program is provided, wherein when the computer program is executed by one or more processors, the processors execute the method described in the first aspect.

[0017] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer-readable storage medium storing instructions, wherein when the instructions are executed, the instructions cause at least one central processing unit of a computing device to execute the method according to the first aspect.

[0018] The method and related equipment for deploying algorithms provided by the present disclosure simplify the deployment operation by writing the algorithm maintenance work into a general tool (deployment tool) and completing the service deployment corresponding to the algorithm based on the general tool. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1A A schematic diagram of an exemplary system for deploying an algorithm provided by an embodiment of the present disclosure is shown.

[0021] Figure 1B A schematic diagram of an exemplary interaction between a terminal device and a code repository of a server according to an embodiment of the present disclosure is shown.

[0022] Figure 1C A schematic diagram showing multiple computer devices executing different pipelines in parallel according to an embodiment of the present disclosure is shown.

[0023] Figure 2 A flowchart of an exemplary method for deploying an algorithm provided by an embodiment of the present disclosure is shown.

[0024] Figure 3A more specific schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0025] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.

[0026] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should have the usual meanings understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative position relationships. When the absolute position of the described object changes, the relative position relationship may also change accordingly.

[0027] Open platforms typically require backend AI algorithms (such as facial recognition, card identification, and intelligent customer service) to provide HTTP / Rest API services. Different algorithms typically use a common web framework with the same functionality, differing only in request and response parameters, HTTP service port numbers, and other factors.

[0028] These algorithms can be configured in the .gitlab-ci.yml file and automated tasks such as algorithm compilation, packaging, uploading, deployment, testing, and notification can be completed based on gitlab-runner.

[0029] When a web framework requires modification, it's typically necessary to update the corresponding files within the algorithm, submit the code to Git, and push it to complete a new round of algorithm deployment. These steps are nearly identical for every algorithm, significantly increasing maintenance costs.

[0030] To alleviate the problem of poor algorithm maintenance efficiency caused by the need to optimize the AI ​​algorithm's web framework or changes to the corresponding pipeline process requirements, the present disclosure provides a method and related equipment for deploying the algorithm. The method includes: obtaining a second configuration file and generating a framework file for the algorithm code file based on the second configuration file, wherein the framework file is used to convert the algorithm code file into a service; merging the framework file and the algorithm code file into a source code file for the service corresponding to the algorithm; and deploying the service corresponding to the algorithm based on the source code file.

[0031] This simplifies deployment by programming algorithm maintenance into a common tool (deployment tool) and deploying the corresponding algorithm services based on this common tool. Furthermore, when a web framework or a command in the pipeline needs to be modified, simply update the tool and re-execute the pipeline to complete the next round of algorithm deployment.

[0032] Figure 1A A schematic diagram of an exemplary system 100 for deploying an algorithm provided by an embodiment of the present disclosure is shown.

[0033] like Figure 1A As shown, system 100 may include a server 200, at least one device for implementing algorithm deployment (e.g., 300a), and a service deployment device 400. In some embodiments, the device for implementing algorithm deployment may also be implemented using a server, but when implemented using a server, it is a separate device from server 200. In some embodiments, the algorithm code file 600 to be deployed may be uploaded to server 200 by terminal device 500.

[0034] In some embodiments, depending on actual needs, the number of devices used to implement algorithm deployment may be more than one, for example, two or even more. Figure 1A The system 100 shown may include multiple devices for implementing algorithm deployment. For example, Figure 1A Devices 300a~300n in.

[0035] In some embodiments, the hardware environment of at least one of the multiple devices 300a-300n may be different from the other devices. For example, the hardware environment of device 300a may use a central processing unit (CPU), while the hardware environment of device 300b may use a graphics processing unit (GPU). In this way, when the hardware environments required for the operation of an algorithm are different, a device with a corresponding hardware environment can be selected for processing. For example, if the algorithm is an image recognition algorithm, device 300b with a hardware environment that includes a GPU can be selected for processing.

[0036] In some embodiments, the multiple devices 300a-300n may also include multiple devices with the same hardware environment. For example, the hardware environment of devices 300b-300n is the same. In this way, when multiple algorithms requiring the same hardware environment need to be deployed, they can be processed in parallel on the devices 300b-300n (for example, one device processes one algorithm), thereby improving processing speed.

[0037] In some embodiments, the server 200 may be a Gitlab server for running a continuous integration system (e.g., GitLab-CI), the devices 300a to 300n may be devices running the gitlab-runner program for executing tasks at various stages in the continuous integration system, and the service deployment device 400 may be a device based on the Kubernetes (K8s) architecture and may run a container management tool based on Kubernetes (K8s) to complete the deployment of services implemented using containers. The system 100 may further include a Gitlab code repository (not shown in the figure) for storing code files and configuration files related to the algorithm, etc. Depending on actual needs, the code repository may be provided by an additional device, or may be set in the server 200. In some embodiments, the code repository is set in the server 200.

[0038] Figure 1B FIG. 5 shows an exemplary interaction diagram of the terminal device 500 and the code repository 202 of the server 200 according to an embodiment of the present disclosure. Figure 1B As shown, in some embodiments, the terminal device 500 may first create a code storage space locally for the code file corresponding to each algorithm, for example, Figure 1B The code storage space 502a-502n (the number of n is determined according to the number of algorithms). Then, in each code storage space, the corresponding algorithm code file (for example, Figure 1B Then, the terminal device 500 can create an empty project for each algorithm code file corresponding to the algorithm in the code warehouse 202 of the server 200 and then create a code warehouse corresponding to the algorithm, for example, Figure 1B After registering the empty project corresponding to the algorithm, the server 200 returns the address (for example, URL address) of the code repository corresponding to the algorithm to the terminal device 500. The terminal device 500 can associate the local code storage space with the corresponding code repository according to the address. Figure 1BAs shown, code storage spaces 502a-502n are associated with code repositories 202a-202n. Thus, when a local algorithm code file (e.g., algorithm code file 5022a) is updated, the terminal device 500 submits the updated algorithm code file to the server 200. Accordingly, the server 200 updates the algorithm code file (e.g., 2022a) in the corresponding code repository (e.g., code repository 202a).

[0039] In some embodiments, a service deployment device 400 based on a Kubernetes (K8s) architecture may include a master node 402 and multiple nodes 404a to 404n. The master node 402 may be a cluster control node of the service deployment device 400, used to manage and control the entire cluster of the service deployment device 400. Control commands sent to the service deployment device 400 may be sent to the master node 402, which is responsible for the specific execution process. Nodes 404a to 404n may be assigned some workloads (Docker containers) by the master node 402. When a node (e.g., node 404a) goes down, the workload on the node may be automatically transferred to other nodes (e.g., node 404b) by the master node 402.

[0040] In some embodiments, devices 300a-300n may first register with server 200 to complete corresponding continuous integration tasks based on the configuration file. For example, the gitlab-runner command line software provided by the Gitlab server may be used to download and install the software on the corresponding devices 300a-300n, run the gitlab-runner register command, and then enter the token obtained from the gitlab-ci interactive interface to register. This will bind the devices 300a-300 to the corresponding gitlab-ci process, allowing the Gitlab pipeline program to be remotely run on the devices 300a-300n.

[0041] After the devices 300a-300n complete the registration, a configuration file for generating a framework file (e.g., a web framework code file) can be configured in the code repository of the Gitlab server 200 and stored in the project root directory of each algorithm. In some embodiments, the configuration file can be stored in the code repository corresponding to the algorithm. Figure 1BAs shown, configuration files 2024a-2024n are correspondingly stored in code repositories 202a-202n. This configuration file, for example, can be a conf.json file. This conf.json file can serve as a connection between the framework file and the algorithm code file. For example, this conf.json file can include information such as the service name, version number, algorithm entry file name, algorithm entry file class name, algorithm call timeout, and routing and algorithm mapping configuration. The following schematically illustrates example code for the conf.json file.

[0042]

[0043] Among them, api_name indicates the service name, version indicates the version number, file_name indicates the AI ​​algorithm entry file name, class_name indicates the AI ​​algorithm entry file class name, timeout indicates the algorithm call timeout (unit: second). If the algorithm call exceeds this time, a request timeout error is returned; routers indicates the mapping configuration between routes and AI algorithms.

[0044] In this way, when the deployment tool is called according to the conf.json file to generate a web framework code file, the service corresponding to the algorithm deployed based on the web framework code file can execute the corresponding call process based on the process in the web framework code file. In some embodiments, the web framework code file provides a web framework for calling an http request of an HttpRestAPI service sent based on the http protocol.

[0045] For example, when an HTTP request is sent to http: / / ip:port / search, the search method in the AIModelInterface class in the main.py file receives the client's request data, uses it to invoke the corresponding AI algorithm, and returns the final algorithm result to the caller of the HTTP request. This framework process from receiving the request to returning the result is provided by the web framework code file.

[0046] After completing the configuration of the configuration file for generating the framework file (web framework code file), you can configure the configuration file .gitlab-ci.yml for gitlab-runner execution in the Gitlab code repository corresponding to the algorithm. The .gitlab-ci.yml configuration file is stored in the project root directory corresponding to each algorithm in the Gitlab code repository. In this way, when deploying the algorithm, the corresponding .gitlab-ci.yml file can be called to execute the set pipeline. In some embodiments, the configuration file can be stored in the code repository corresponding to the algorithm. Figure 1B As shown, configuration files 2026a-2026n are correspondingly stored in code repositories 202a-202n.

[0047] The .gitlab-ci.yml configuration file can include the keywords stages, stage, script and / or tags, which are used to control the specific operation process of a pipeline. Among them, stages are defined in the outermost layer of the .yml file. Its value is an array, which is used to define the different process nodes of a pipeline. Task (Job) is the task node of the pipeline, which constitutes the basic unit of the pipeline. Stage is a string and a child of the stages array, which represents the current pipeline node. Script is the shell script run by the current pipeline node (executed with the project root directory as the context). Script is the core of controlling the CI process. From installation, compilation to deployment, it is completed through the shell script defined in the script. If the script is executed successfully, the pipeline will enter the next Job node. If the execution fails, the pipeline will terminate. Tags are the tags of the current Job. Gitlab-runner can use tags to determine whether the current Job can be executed. When registering devices 300a-300n, a unique tag may be set for each device. Based on the tag, the corresponding device may execute the command corresponding to the tag in .gitlab-ci.yml.

[0048] In some embodiments of the present disclosure, the pipeline to be implemented by the configuration file .gitlab-ci.yml may include functions such as calling a deployment tool (e.g., deployment tool 302a) to generate a framework file, generating a source code file based on the algorithm code file 600 and the framework file, deploying the source code file, and notifying the completion of deployment. Once the configuration file .gitlab-ci.yml is called, the corresponding device running gitlab-runner (e.g., device 300a) can perform the corresponding pipeline operation based on the configuration file, and then call the deployment tool (e.g., deployment tool 302a) to sequentially execute the steps of generating a framework file, generating a source code file based on the algorithm code file 600 and the framework file, deploying the source code file, and notifying the completion of deployment. According to different needs, the stages in the pipeline can be added or deleted, for example, removing the deployment completion notification function, adding an exception notification function, and so on. Adding or deleting stages in the pipeline can be achieved by changing the corresponding code of the configuration file .gitlab-ci.yml.

[0049] In some embodiments, deployment tools 302a-302n may be installed on the devices 300a-300n, and the devices 300a-300n may call the deployment tools 302a-302n to deploy corresponding algorithms.

[0050] After the developer 500 pushes the algorithm code file 600 in the Gitlab code repository, the server 200 can pull the algorithm code file 600 from the Gitlab code repository and obtain the .gitlab-ci.yml file in the project root directory of the algorithm corresponding to the algorithm code file 600, and then determine the corresponding device (for example, device 300a) in the devices 300a to 300n according to the tag in .gitlab-ci.yml. Then, the server 200 calls the running script (gitlab-runner script) of the device (for example, device 300a), so that the device 300a starts running the gitlab-runner program. Here, the process of calling the running script can be automatically triggered or manually triggered by the developer 500.

[0051] Device 300a can obtain the algorithm code file 600 and the corresponding .gitlab-ci.yml configuration file, and then call the deployment tool 302a to perform the following steps based on the .gitlab-ci.yml configuration file: obtain the conf.json configuration file and generate a framework file (for example, a web framework code file) for the algorithm code file 600 based on the configuration in the conf.json configuration file. The framework file is used to convert the algorithm code file 600 into a corresponding callable service; then the framework file and the algorithm code file 600 are merged into the source code file of the service corresponding to the algorithm, and the service corresponding to the algorithm is deployed based on the source code file. In this way, the framework file generation, source code production, and service deployment of the algorithm code file 600 are completed based on the deployment tool 302a.

[0052] In some embodiments, the framework file may have at least one of the following functions: receiving parameters, verifying parameter validity, passing parameters to the algorithm, receiving algorithm results, responding to the algorithm caller, logging requests and responses, returning exception information in a friendly manner, and handling algorithm timeouts. The algorithm may be an artificial intelligence algorithm, and the functions implemented by the algorithm may include at least one of the following: facial recognition, image search, intelligent color filtering, card and ID recognition, intelligent customer service, and sentiment analysis.

[0053] For example, in some algorithms, the framework file may have the functions of receiving parameters, checking the validity of parameters, passing parameters to the AI ​​algorithm, receiving the results of the AI ​​algorithm, and responding to the caller. For example, the face recognition algorithm receives a picture as a parameter, and the response parameters include gender, age, and whether the person is wearing a mask. The caller converts the picture into base64 encoding and sends it to the algorithm service as json data via HttpPost. The functions to be implemented by the framework file are: receiving parameters, parsing and verifying the request data: 1) verifying whether the request data format is json; 2) verifying whether the base64 encoding in the request parameter is an image. If the verification fails, a json format message is directly returned. The two parameters in the message, statusCode, are 500, and statusMessage is the specific error information, such as: the request image data format is incorrect. After the verification is successful, the corresponding AI algorithm is called using base64 encoding. After the algorithm calculation is completed, the algorithm result (including gender, age, whether the person is wearing a mask), status code (statusCode), and status message (statusMessage) are organized into a json format response message and returned to the caller. When the algorithm call is successful, statusCode is 200 and statusMessage is ok. When the algorithm call fails, statusCode is 500 and statusMessage is the exception information captured by the system when the failure occurs.

[0054] For another example, in many algorithms, the framework file can have the function of request response logging. In some embodiments, the request parameters, response results, algorithm call duration, and algorithm call exception information of each algorithm can be recorded in a text file through the deployment tool, which is convenient for problem investigation, resolution and optimization. For example, the logging process may include: after the algorithm service framework receives the request parameters, it records the parameters in the memory variable, records the start time of the algorithm execution before calling the algorithm, and records the end time of the algorithm execution after the algorithm is called, and organizes them into json format together with the algorithm execution results and records them in the local log file.

[0055] In some algorithms, the framework file can include a friendly return function for exception information. For example, even after parameter verification, each algorithm may experience unpredictable call failures, such as memory leaks, video memory overflows, or bugs in the algorithm itself. This exception information needs to be recorded in the log and returned to the client in a friendly manner. The algorithm service framework itself includes exception handling capabilities. When an algorithm error occurs, it automatically captures the exception information and returns a friendly prompt to the client. The captured exception information is also recorded in the log.

[0056] The following is an example of the response information when the algorithm call fails.

[0057]

[0058] Another situation when calling an algorithm is that the algorithm does not return a response result for a long time, nor does it return an error. For long and slow calculations, a timeout mechanism can be configured in the framework file to require the algorithm to complete the calculation within a specified time. If no response result is returned within the specified time, the algorithm is forced to end and the response timeout is returned.

[0059] For example, if the configured timeout is 3 seconds and the algorithm runs for more than 3 seconds, the following information is returned:

[0060]

[0061] It can be seen that the different functions of the framework file enable the user to return different service call results when calling the service of the algorithm corresponding to the framework file. For example, calling the service corresponding to the algorithm for face recognition should return the face recognition result; for another example, when the framework file has a request response log recording function, the service can be called to view the log. Therefore, after the service corresponding to the algorithm is deployed, the terminal device 500 can send a service call request corresponding to the algorithm to the service deployment device 400 (for example, calling the corresponding service or viewing the service log). The service deployment device 400 responds to the service call request and calls the corresponding service. If the service call fails, the service deployment device 400 can return a call failure message to the terminal device 500, so that the user of the terminal device 500 can determine that there is a problem with the generation of the corresponding framework file or a problem with the deployment process based on the call failure information, and then check the code, configuration file, etc. and fix the error.

[0062] In some embodiments, the device 300a can also call the deployment tool 302a to perform the following steps: compile the source code file into an image file, which is the image file of the container corresponding to the service (for example, Docker); and then send the image file to the image package library (for example, Harber) so that the service deployment device 400 can call the image file from the image package library to deploy the service corresponding to the algorithm.

[0063] In some embodiments, the device 300a may also call a deployment tool 302a to execute: generating a service deployment command (e.g., a K8s command) based on the address of the image file in the image package library (e.g., a URL address) and the service name corresponding to the image file; and then sending the service deployment command to the service deployment device 400. The master node 402 of the service deployment device 400 receives the service deployment command, runs a container management tool, and calls the corresponding image file from the image package library according to the service deployment command to deploy the service corresponding to the algorithm. For example, the control node 404a runs the image file to generate a container running the corresponding service, thereby deploying the service to the node 404a.

[0064] After the service deployment is completed, the callable http service address will be exposed on the service deployment device 400 (for example, K8s). The service calling methods include but are not limited to: using server-side development languages ​​such as Golang / Python / Java to complete the call through interactive operations on the UI interface; using Shell scripts to complete the call; using client tools that can send http requests (postman, fiddler, etc.) to complete the call.

[0065] In some embodiments, device 300a may also call deployment tool 302a to execute: in response to the completion of deployment of the service corresponding to the algorithm, push a deployment completion notification to the designated device. The notification may be in the form of email notification, WeChat notification, SMS notification, or other notification methods. In some embodiments, different tags may be set for email notification tasks, WeChat notification tasks, and SMS notification tasks in the .gitlab-ci.yml configuration file, so that email notification tasks, WeChat notification tasks, and SMS notification tasks can be respectively executed by devices corresponding to different tags (e.g., devices 300a, 300b, 300n) calling the deployment tools installed thereon, thereby improving the efficiency of notifications.

[0066] In some embodiments, when the server 200 receives multiple algorithm code files from the terminal device 500, the server 200 may enable multiple computer devices (eg, devices 300a-300n) to execute the method for deploying the algorithm in parallel.

[0067] Figure 1C FIG. 1 shows a schematic diagram of multiple computer devices executing different pipelines in parallel according to an embodiment of the present disclosure. Figure 1C As shown, in some embodiments, when multiple computer devices (e.g., devices 300a-300n) are executing the method for deploying the algorithm in parallel, the server 200 can push an interface 700 containing the execution status of the multiple computer devices to the terminal device 500. Figure 1C As shown, three pipelines 702, 704, and 706 are displayed in the interface 700. The user of the terminal device 500 can intuitively observe the execution status of each pipeline through the interface 700, so as to timely discover and repair errors when they occur.

[0068] like Figure 1C As shown, in some embodiments, the execution status of each task node of each pipeline can be displayed to the terminal device 500 by the server 200 through the interface 700. For example, when the framework file has been generated, the server 200 can push a notification containing the generated framework file (for example, Figure 1C For another example, when the source code file has been generated, the server 200 may push a notification containing the source code file generation (e.g., Figure 1C For another example, when the image file has been generated, the server 200 may push a notification containing the image file generation notification (e.g., Figure 1CWhen the service corresponding to the algorithm has been deployed, the server 200 may push a deployment completion notification (e.g., Figure 1C Thus, the user of the terminal device 500 can understand the execution status of each task node of each pipeline through the interface 700, so as to timely discover and repair errors when they occur.

[0069] In some embodiments, devices 300a-300n may also obtain an update file for a deployment tool (e.g., deployment tool 302a), and then install the update file on devices 300a-300n, thereby completing the update of the deployment tool. In some embodiments, the updated content in the update file is a modification of the functions in the generated framework file. For example, the framework file generated by the original deployment tool does not have an exception notification function, and the framework file generated by the updated deployment tool has an exception notification function. In this way, by re-calling and executing the .gitlab-ci.yml configuration file, the update file of the deployment tool can be called in the pipeline corresponding to the configuration file to generate a new framework file, and then the subsequent process of the pipeline is executed based on the new framework file, thereby completing the update of the service corresponding to the algorithm.

[0070] In some embodiments, modifications to the deployment tool do not affect the configuration files. That is, although the framework files generated based on the deployment tool may change because the tool is more refined, the pipeline process that needs to be executed on the algorithm remains unchanged, and the steps that the algorithm needs to call the deployment tool also remain unchanged. Therefore, the configuration files corresponding to the algorithm (for example, configuration files 2024a~2024n and configuration files 2026a~2026n) do not need to be changed. In this way, there is no need to change the .gitlab-ci.yml configuration files corresponding to each algorithm, nor is there any need to change the conf.json configuration files corresponding to each deployment tool. You only need to update the deployment tool and re-execute the gitlab-runner pipeline to complete the update of the call process provided by the web framework, avoiding a lot of repetitive work and reducing time costs.

[0071] The system 100 provided in the embodiment of the present disclosure develops an automated deployment tool to address the cumbersome issues of open platform updates and maintenance. After each algorithm push code is completed, gitlab-runner can automatically call some commands of the tool to complete related functional operations.

[0072] The embodiment of the present disclosure also provides a method 700 for deploying an algorithm. Figure 2The flow chart of the exemplary method 700 for deploying an algorithm provided by the embodiment of the present disclosure is shown. The method 700 may be Figure 1A The method 700 may be performed by any one or more of the devices 300a-300n. The method 700 may include the following steps.

[0073] In step 702, the device 300a may obtain an algorithm code file (eg, Figure 1A algorithm code file 600) and the corresponding first configuration file (for example, .gitlab-ci.yml file).

[0074] In step 704, the device 300a may call a deployment tool (eg, Figure 1A The deployment tool 300a) performs the following steps:

[0075] Step 7042: Obtain a second configuration file (e.g., a conf.json file) and generate a framework file for the algorithm code file based on the second configuration file, wherein the framework file is used to convert the algorithm code file into a service;

[0076] Step 7044: merge the framework file and the algorithm code file into a source code file of the service corresponding to the algorithm; and

[0077] Step 7046: Deploy the service corresponding to the algorithm based on the source code file.

[0078] In some embodiments, based on the source code file, the service corresponding to the algorithm is deployed, including: compiling the source code file into an image file, wherein the image file is an image file of the container corresponding to the service; and sending the image file to an image package library, so that the service deployment device calls the image file from the image package library to deploy the service corresponding to the algorithm.

[0079] In this way, by writing the algorithm maintenance work into a general tool (deployment tool), the service deployment corresponding to the algorithm is completed based on the general tool, which simplifies the deployment operation.

[0080] In some embodiments, after sending the image file to the image package library, the method further includes:

[0081] Generate a service deployment command according to the address of the image file in the image package library and the service name corresponding to the image file; and

[0082] The service deployment command is sent to the service deployment device, so that the service deployment device calls the image file from the image package library according to the service deployment command to deploy the service corresponding to the algorithm.

[0083] In some embodiments, method 700 may further include: obtaining an update file of the deployment tool; and calling the update file of the deployment tool to update the service corresponding to the algorithm.

[0084] In this way, there is no need to change the .gitlab-ci.yml configuration file or the conf.json configuration file. You only need to update the deployment tool and re-execute the gitlab-runner pipeline to complete the update of the call process provided by the web framework, avoiding a lot of repetitive work and reducing time costs.

[0085] In some embodiments, the method is executed by gitlab-runner, the algorithm code file is obtained from the Gitlab server, the first configuration file is the .gitlab-ci.yml file corresponding to the algorithm, and the framework file is the web framework code file corresponding to the algorithm.

[0086] In some embodiments, obtaining a first configuration file corresponding to the algorithm code file includes:

[0087] Get the .gitlab-ci.yml file corresponding to the algorithm from the project root directory corresponding to the algorithm in the Gitlab code repository.

[0088] In some embodiments, method 700 may further include: calling the deployment tool to perform the following steps: in response to the service corresponding to the algorithm having completed deployment, pushing a deployment completion notification to a designated device.

[0089] In some embodiments, the framework file has at least one of the following functions: parameter reception, parameter validity verification, passing parameters to the algorithm, receiving algorithm results, responding results to the algorithm caller, request response logging, friendly return of exception information, and algorithm timeout processing.

[0090] It should be noted that the method of the embodiments of the present disclosure can be performed by a single device, such as a computer or server. The method of the embodiments of the present disclosure can also be applied in a distributed scenario, where multiple devices cooperate to perform the method. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiments of the present disclosure, and the multiple devices will interact with each other to complete the method.

[0091] It should be noted that the above description is limited to some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0092] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides an electronic device 300, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method 700 described in any of the above embodiments when executing the program.

[0093] Figure 3 Schematic diagram of the hardware structure of a more specific electronic device 300 provided by an embodiment of the present disclosure is shown. The device 300 may include: a processor 302, a memory 304, an input / output interface 306, a communication interface 308, and a bus 310. The processor 302, the memory 304, the input / output interface 306, and the communication interface 308 are connected to each other within the device via the bus 310.

[0094] The processor 302 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0095] The memory 304 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 304 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 304 and called and executed by the processor 302.

[0096] The input / output interface 306 is used to connect to input / output modules to implement information input and output. The input / output modules can be configured as components within the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.

[0097] The communication interface 308 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WIFI, Bluetooth, etc.).

[0098] The bus 310 comprises a pathway for transmitting information between the various components of the device, such as the processor 302 , the memory 304 , the input / output interface 306 , and the communication interface 308 .

[0099] It should be noted that although the above device only shows the processor 302, memory 304, input / output interface 306, communication interface 308, and bus 310, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will understand that the above device may only include the components necessary to implement the embodiments of this specification, and does not necessarily include all the components shown in the figure.

[0100] The electronic device of the above embodiment is used to implement the corresponding method 700 in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.

[0101] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute method 700 as described in any of the above embodiments.

[0102] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0103] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute method 700 as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0104] Based on the same inventive concept, corresponding to the method 700 of any of the above embodiments, the present disclosure further provides a computer program product comprising a non-transitory tangible computer-readable medium having computer-readable instructions thereon. In some embodiments, the computer-readable instructions are executable by one or more processors to cause the processors to perform the method 700 described. For the execution entities corresponding to the steps in each embodiment of method 700, the processors that execute the corresponding steps may belong to the corresponding execution entity, and each execution entity may be implemented using one or more electronic devices 300. When implemented using multiple electronic devices 300, the implementation may be distributed.

[0105] The computer program product of the above embodiment is used to enable the processor to execute the method 700 described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.

[0106] The "means", "modules" and the like in the various embodiments of the present disclosure may be implemented using hardware units, software units or a combination thereof. Examples of hardware units may include devices, components, processors, microprocessors, circuits, circuit elements (e.g., transistors, resistors, capacitors, inductors, etc.), integrated circuits, application specific integrated circuits (ASICs), programmable logic devices (PLDs), digital signal processors (DSPs), field programmable gate arrays (FPGAs), memory cells, logic gates, registers, semiconductor devices, chips, microchips, chipsets, etc. Examples of software units may include software components, programs, applications, computer programs, application programs, system programs, machine programs, operating system software, middleware, firmware, software modules, routines, subroutines, functions, methods, processes, software interfaces, application program interfaces (APIs), instruction sets, computing codes, computer codes, code segments, computer code segments, words, values, symbols, or any combination thereof. Determining whether an embodiment is implemented using hardware elements and / or software elements can vary depending on any number of factors, such as desired computational rate, power levels, thermal tolerances, processing cycle budgets, input data rates, output data rates, memory resources, data bus speeds, and other design or performance constraints, as desired for a given implementation.

[0107] Certain embodiments may include an article of manufacture. The article of manufacture may include a storage medium for storing logic. Examples of storage media may include one or more types of computer-readable storage media capable of storing electronic data, including volatile or non-volatile memory, removable or non-removable memory, erasable or non-erasable memory, writable or rewritable memory, etc. Examples of logic may include various software units, such as software components, programs, applications, computer programs, application programs, system programs, machine programs, operating system software, middleware, firmware, software modules, routines, subroutines, functions, methods, processes, software interfaces, application program interfaces (APIs), instruction sets, computing codes, computer codes, code segments, computer code segments, words, values, symbols, or any combination thereof. In one embodiment, for example, an article of manufacture may store executable computer program instructions that, when executed by a computer, cause the computer to perform the methods and / or operations according to the described embodiments. Executable computer program instructions may include any appropriate type of code, such as source code, compiled code, interpreted code, executable code, static code, dynamic code, etc. Executable computer program instructions can be implemented in a predefined computer language, manner or syntax to instruct a computer to perform certain functions. The instructions can be implemented using any suitable high-level, low-level, object-oriented, visual, compiled and / or interpreted programming language.

[0108] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Within the scope of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.

[0109] In addition, to simplify the description and discussion, and so as not to obscure the embodiments of the present disclosure, known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, devices may be shown in the form of block diagrams to avoid obscuring the embodiments of the present disclosure, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure are to be implemented (i.e., these details should be fully within the purview of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it will be apparent to those skilled in the art that the embodiments of the present disclosure may be implemented without these specific details or with variations in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0110] Although the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.

[0111] The embodiments of the present disclosure are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.

Claims

1. A method for deploying an algorithm, comprising: Obtaining an algorithm code file and a corresponding first configuration file; as well as According to the first configuration file, the deployment tool is called to perform the following steps: Obtaining a second configuration file and generating a framework file for the algorithm code file based on the second configuration file, wherein the framework file is used to convert the algorithm code file into a service; the second configuration file includes a service name and an algorithm entry file name; Merging the framework file and the algorithm code file into a source code file of the service corresponding to the algorithm; as well as Deploy the service corresponding to the algorithm based on the source code file; The method further comprises: Obtaining an update file for the deployment tool, the update file including updates to functions in the generated framework file; and Calling the update file of the deployment tool to update the service corresponding to the algorithm; The updating file of the deployment tool is called to update the service corresponding to the algorithm, including: Regenerating the framework file to include the updated functionality; Wherein, based on the source code file, deploying the service corresponding to the algorithm includes: Compiling the source code file into an image file, wherein the image file is an image file of a container corresponding to the service; and Sending the image file to an image package library, so that a service deployment device calls the image file from the image package library to deploy the service corresponding to the algorithm; After sending the image file to the image package library, the method further includes: Generate a service deployment command according to the address of the image file in the image package library and the service name corresponding to the image file; and The service deployment command is sent to the service deployment device, so that the service deployment device calls the image file from the image package library according to the service deployment command to deploy the service corresponding to the algorithm.

2. The method according to claim 1, wherein The method is executed by gitlab-runner, the algorithm code file is obtained from the Gitlab server, the first configuration file is the .gitlab-ci.yml file corresponding to the algorithm, and the framework file is the web framework code file corresponding to the algorithm.

3. The method according to claim 2, wherein: Obtaining the first configuration file corresponding to the algorithm code file includes: Get the .gitlab-ci.yml file corresponding to the algorithm from the project root directory corresponding to the algorithm in the Gitlab code repository.

4. The method of claim 1 , further comprising: Call the deployment tool to perform the following steps: In response to the service corresponding to the algorithm having completed deployment, a deployment completion notification is pushed to a designated device.

5. The method according to claim 1, wherein The framework file has at least one of the following functions: parameter reception, parameter validity verification, parameter transfer to the algorithm, algorithm result reception, response result to the algorithm caller, request response logging, exception information friendly return, and algorithm timeout processing.

6. The method of claim 1, wherein: The algorithm is an artificial intelligence algorithm, and the functions implemented by the algorithm include at least one of the following functions: face recognition, image search, intelligent color filtering, card recognition, intelligent customer service, and sentiment analysis.

7. A computer device, characterized in that: The method comprises one or more processors, a memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method according to any one of claims 1 to 6.

8. A system for deploying an algorithm, comprising: The computer device according to claim 7; as well as The server is configured to run the continuous integration system to perform the following steps: Obtaining an algorithm code file and a corresponding first configuration file, and, Based on the algorithm code file and the corresponding first configuration file, the running script of the computer device is called to enable the computer device to deploy the service corresponding to the algorithm.

9. The system of claim 8, wherein: There are multiple computer devices; the server is configured to: Obtaining the tag corresponding to the algorithm code file; and, A target computer device is determined according to the tag, and a running script of the target computer device is called to enable the target computer device to deploy a service corresponding to the algorithm.

10. The system of claim 9, wherein: The server is configured to: In response to the plurality of computer devices executing the method for deploying an algorithm in parallel, an interface containing the execution status of the plurality of computer devices is pushed to a designated device.

11. The system of claim 10, wherein: The server is configured to: In response to the framework file being generated, pushing an interface including a notification that the framework file has been generated to the designated device; In response to the source code file being generated, pushing an interface including a notification that the source code file has been generated to a designated device; In response to the image file being generated, pushing an interface containing a notification that the image file has been generated to the designated device; or, In response to the service corresponding to the algorithm having completed deployment, an interface including a deployment completion notification is pushed to a designated device.

12. The system of claim 8 or 9, further comprising: The service deployment device is configured to: run a container management tool to call an image file of a service corresponding to the algorithm from an image package library, and deploy the service corresponding to the algorithm based on the image file.

13. The system of claim 12, wherein: The server is a Gitlab server, and the container management tool is a container management tool based on Kubernetes.

14. The system of claim 13, wherein: The service deployment device is configured to: Receiving a service call request corresponding to the algorithm; Invoke the corresponding service according to the service invocation request; and In response to a service call failure, call failure information is returned.

15. The system of claim 8 or 9, wherein: The hardware environment of at least one computer device among the plurality of computer devices is different from that of the other computer devices.

16. A non-volatile computer-readable storage medium containing a computer program, characterized in that When the computer program is executed by one or more processors, the processors are caused to perform the method according to any one of claims 1 to 6.

17. A computer program product comprising a computer-readable storage medium storing instructions which, when executed, cause at least one central processor unit of a computing device to perform the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Highly-available disposition method facing application service

    CN104811476A

  • Data processing method and device, electronic equipment and storage medium

    CN111694640A