IP Library Granted Patent US 12675271
Granted Patent B2
US 12675271 · App. 17/973,889 · Granted Jul 7, 2026

Code execution method and device

Inventors: Fei Li (Beijing, CN); Chang Liu (Gui'an, CN)
Assignee: HUAWEI CLOUD COMPUTING TECHNOLOGIES CO., LTD.
G06F8/65G06F8/71
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12675271
App. No.
17/973,889
Filed
Oct 26, 2022
Granted
Jul 7, 2026
Kind
B2
Art Unit
2199
USPC
717/170
Abstract

A code execution method includes: a pre-preparation service module obtaining a pre-preparation policy set by a user; the pre-preparation service module downloading, based on the pre-preparation policy, an updated code file included in an updated code version from a code hosting platform to a storage cluster; the pre-preparation service module receiving a code execution request; the pre-preparation service module determining a storage address of code content corresponding to the code execution request in the storage cluster and sending the storage address to an executor; the executor obtaining the code content based on the received storage address and executing the obtained code content.

Claims (76)

1 . A method comprising:

obtaining, by a pre-preparation servicer of a code execution system, a pre-preparation policy set by a user;

receiving, from a code hosting platform, a code version update notification comprising an identifier that identifies an updated code version;

determining, based on the code version update notification and the pre-preparation policy, whether the updated code version complies with the pre-preparation policy;

in response to determining the updated code version complies with the pre-preparation policy, downloading, by the pre-preparation servicer and based on the identifier, one or more updated code files associated with the identifier from the code hosting platform to a storage cluster of the code execution system;

subsequent to downloading the one or more updated code files, receiving, by the pre-preparation servicer, a code execution request;

identifying, based on the identifier, the one or more updated code files associated with the identifier;

obtaining, from the storage cluster, storage addresses of first code content within the one or more updated code files;

generating a file tree object corresponding to the updated code version based on the identifier, the one or more updated code files, and the storage addresses;

determining, by the pre-preparation servicer and based on the code execution request and the file tree object, a storage address of second code content within the one or more updated code files, wherein the first second code content is retrieved from the storage cluster using the storage address;

sending, by the pre-preparation servicer, the storage address to an executor of the code execution system;

obtaining, by the executor and based on the storage address, the second code content; and

executing, by the executor, the second code content.

2 . The method of claim 1 , further comprising receiving the code execution request from the user.

3 . The method of claim 1 , wherein the pre-preparation policy comprises a first commit type, wherein the code version update notification further comprises a second commit type corresponding to the updated code version, and wherein determining whether the updated code version complies with the pre-preparation policy comprises:

determining whether the second commit type and the first commit type are a same commit type; and

determining that the updated code version complies with the pre-preparation policy when the second commit type and the first commit type are the same commit type.

4 . The method of claim 1 , wherein the pre-preparation policy comprises a first code branch, wherein the code version update notification further comprises information about a second code branch in which the updated code version is located, and wherein determining whether the updated code version complies with the pre-preparation policy comprises:

determining, based on the information, whether the second code branch and the first code branch are a same code branch; and

determining that the updated code version complies with the pre-preparation policy when the second code branch and the first code branch are the same code branch.

5 . The method of claim 1 , wherein the code execution system is a code check system.

6 . The method of claim 1 , wherein the code execution request carries information about at least one code version that the user requests to execute, wherein determining the storage address comprises determining, based on the information, at least one storage address of corresponding code content that corresponds to each code version in the at least one code version, and wherein obtaining the first second code content comprises:

determining to-be-read storage addresses based on the at least one storage address, wherein each to-be-read storage address of the to-be-read storage addresses is different from each other to-be-read storage address of the to-be-read storage addresses; and

reading, based on the to-be-read storage addresses, the corresponding code content from the storage cluster.

7 . The method of claim 1 , wherein the code execution system is a compilation and building system or a code analysis system.

8 . A computer program product comprising instructions that are stored on a non-transitory computer-readable medium and that, when executed by a processor, cause a code execution system to:

obtain, by a pre-preparation servicer of the code execution system, a pre-preparation policy set by a user;

receive, from a code hosting platform, a code version update notification comprising an identifier that identifies an updated code version;

determine, based on the code version update notification and the pre-preparation policy, whether the updated code version complies with the pre-preparation policy;

in response to determining the updated code version complies with the pre-preparation policy, download, by the pre-preparation servicer and based on the identifier, one or more updated code files associated with the identifier from the code hosting platform to a storage cluster of the code execution system;

receive, by the pre-preparation servicer and subsequent to downloading the one or more updated code files, a code execution request,

identify, based on the identifier, the one or more updated code files associated with the identifier;

obtain, from the storage cluster, storage addresses of first code content within the one or more updated code files;

generate a file tree object corresponding to the updated code version based on the identifier, the one or more updated code files, and the storage addresses;

determine, by the pre-preparation servicer and based on the code execution request and the file tree object, a storage address of second code content within the one or more updated code files, wherein the second code content is retrieved from the storage cluster using the storage address;

send, by the pre-preparation servicer, the storage address to an executor of the code execution system;

obtain, by the executor, the second code content based on the storage address; and

execute, by the executor, the second code content.

9 . The computer program product of claim 8 , wherein when executed by the processor, the instructions cause the code execution system to download the one or more updated code files by causing the pre-preparation servicer to receive the code execution request from the user.

10 . The computer program product of claim 8 , wherein the pre-preparation policy comprises a first commit type, wherein the code version update notification further comprises a second commit type corresponding to the updated code version, and wherein when executed by the processor, the instructions cause the code execution system to determine whether the updated code version complies with the pre-preparation policy by causing the pre-preparation servicer to:

determine whether the second commit type and the first commit type are a same commit type; and

determine that the updated code version complies with the pre-preparation policy when the second commit type and the first commit type are the same commit type.

11 . The computer program product of claim 8 , wherein the pre-preparation policy comprises a first code branch, wherein the code version update notification further comprises information about a second code branch in which the updated code version is located, and wherein when executed by the processor, the instructions cause the code execution system to determine whether the updated code version complies with the pre-preparation policy by causing the pre-preparation servicer to:

determine, based on the information, whether the second code branch and the first code branch are a same code branch; and

determine that the updated code version complies with the pre-preparation policy when the second code branch and the first code branch are the same code branch.

12 . The computer program product of claim 8 , wherein the code execution system is a code analysis system.

13 . The computer program product of claim 8 , wherein the code execution request carries information about at least one code version that the user requests to execute, wherein when executed by the processor, the instructions cause the code execution system to determine the storage address by causing the pre-preparation servicer to determine, based on the information, at least one storage address of corresponding code content that corresponds to each code version in the at least one code version, and wherein when executed by the processor, the instructions cause the code execution system to obtain the second code content by causing the executor to:

determine to-be-read storage addresses based on the at least one storage address, wherein each to-be-read storage address of the to-be-read storage addresses is different from each other to-be-read storage address of the to-be-read storage addresses; and

read, based on the to-be-read storage addresses, the corresponding code content from the storage cluster.

14 . An electronic device, comprising:

a memory configured to store program instructions; and

a processor coupled to the memory and configured to execute the program instructions to implement a code execution system comprising a pre-preparation servicer, a storage cluster, and an executor and to cause the code execution system to:

obtain, by the pre-preparation servicer, a pre-preparation policy set by a user;

receive, from a code hosting platform, a code version update notification comprising an identifier that identifies an updated code version;

determine, based on the code version update notification and the pre-preparation policy, whether the updated code version complies with the pre-preparation policy;

in response to determining the updated code version complies with the pre-preparation policy, download, by the pre-preparation servicer and based on the identifier, one or more updated code files associated with the identifier from the code hosting platform to a storage cluster of the code execution system;

receive, by the pre-preparation servicer and subsequent to downloading the one or more updated code files, a code execution request;

identify, based on the identifier, the one or more updated code files associated with the identifier;

obtain, from the storage cluster, storage addresses of first code content within the one or more updated code files;

generate a file tree object corresponding to the updated code version based on the identifier, the one or more updated code files, and the storage addresses;

determine, by the pre-preparation servicer and based on the code execution request and the file tree object, a storage address of second code content within the one or more updated code files, wherein the second code content is retrieved from the storage cluster using the storage address;

send, by the pre-preparation servicer, the storage address to an executor of the code execution system;

obtain, by the executor, the second code content based on the storage address; and

execute, by the executor, the second code content.

15 . The electronic device of claim 14 , wherein when executed by the processor, the program instructions cause the code execution system to download the one or more updated code files by causing the pre-preparation servicer to receive the code execution request from the user.

16 . The electronic device of claim 14 , wherein the pre-preparation policy comprises a first commit type, wherein the code version update notification further comprises a second commit type corresponding to the updated code version, and wherein when executed by the processor, the program instructions cause the code execution system to determine whether the updated code version complies with the pre-preparation policy by causing the pre-preparation servicer to:

determine whether the second commit type and the first commit type are a same commit type; and

determine that the updated code version complies with the pre-preparation policy when the second commit type and the first commit type are the same commit type.

17 . The electronic device of claim 14 , wherein the pre-preparation policy comprises a first code branch, wherein the code version update notification further comprises information about a second code branch in which the updated code version is located, and wherein when executed by the processor, the program instructions cause the code execution system to determine whether the updated code version complies with the pre-preparation policy by causing the pre-preparation servicer to:

determine, based on the information, whether the second code branch and the first code branch are a same code branch; and

determine that the updated code version complies with the pre-preparation policy when the second code branch and the first code branch are the same code branch.

18 . The electronic device of claim 14 , wherein the code execution system is a code check system.

19 . The electronic device of claim 14 , wherein the code execution request carries information about at least one code version that the user requests to execute, wherein when executed by the processor, the program instructions cause the code execution system to determine the storage address by causing the pre-preparation servicer to determine, based on the information, at least one storage address of corresponding code content that corresponds to each code version in the at least one code version, and wherein when executed by the processor, the program instructions cause the code execution system to obtain the first second code content by causing the executor to:

determine to-be-read storage addresses based on the at least one storage address, wherein each to-be-read storage address of the to-be-read storage addresses is different from each other to-be-read storage address of the to-be-read storage addresses; and

read, based on the to-be-read storage addresses, the corresponding code content from the storage cluster.

20 . The electronic device of claim 14 , wherein the code execution system is a compilation and building system.