CN114721664A - Compiling method and device - Google Patents

Compiling method and device Download PDF

Info

Publication number
CN114721664A
CN114721664A CN202210390550.3A CN202210390550A CN114721664A CN 114721664 A CN114721664 A CN 114721664A CN 202210390550 A CN202210390550 A CN 202210390550A CN 114721664 A CN114721664 A CN 114721664A
Authority
CN
China
Prior art keywords
compiling
task
execution terminal
execution
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210390550.3A
Other languages
Chinese (zh)
Inventor
叶涛
孙雄
李伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202210390550.3A priority Critical patent/CN114721664A/en
Publication of CN114721664A publication Critical patent/CN114721664A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The present disclosure provides a compiling method and apparatus, in which a compilable file generated in a process of executing a compiling task is transmitted to a slave execution terminal through a master execution terminal, so that the slave execution terminal executes an allocated compiling task according to the received compilable file, without calculating the input and output of each compiling task in advance, thereby greatly shortening the speed of distributed compiling and saving computing resources.

Description

Compiling method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a compiling method and apparatus.
Background
When a developer develops a program, the written code needs to be compiled frequently, and for a large program development project, the time consumed by single-machine compiling may be very long. For this reason, a method of "distributed compiling" is proposed, which can combine the computing power of multiple computers to jointly complete the compiling task.
In a distributed compiling scene, before a master compiling terminal master distributes a compiling task to a slave compiling terminal worker, the input and the output of the compiling task need to be calculated, namely the worker needs which files to compile an execution task and which files generated after the master needs the task to be executed, after the input is calculated, the master can send the input to the worker, and after the worker is executed, the master needs to return the output to the master as the output. Because the computation input and output relate to the dependency analysis of the compiling task, the dependency analysis is complex, a large amount of computing resources and time are consumed, and different programming languages are difficult to use the same set of computing scheme, so that the efficiency of distributed compiling is difficult to improve.
Disclosure of Invention
The embodiment of the disclosure at least provides a compiling method and a compiling device.
In a first aspect, an embodiment of the present disclosure provides a compiling method applied to a main execution terminal, including:
acquiring a compiling task list aiming at a target source file; the compilation task list indicates that there are a plurality of compilation tasks;
for each compiling task, determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals based on the task type of the compiling task;
when the target execution terminal is a main execution terminal, executing the compiling task, and sending a compilable file generated in the process of executing the compiling task to a slave execution terminal except the main execution terminal in the plurality of candidate execution terminals;
and when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
In an optional embodiment, the method further comprises:
receiving executable files generated by slave execution terminals except the master execution terminal in the plurality of candidate execution terminals in the process of executing a compiling task;
and executing the compiling task under the condition that the target execution terminal corresponding to the compiling task is the main execution terminal, wherein the executing comprises the following steps:
under the condition that the compiling task needs a target executable file generated by the slave execution terminal, searching the target executable file needed by executing the compiling task from the executable files sent by the slave execution terminal;
and executing the compiling task based on the searched target executable file.
In an optional embodiment, the sending a compilable file generated in the process of executing the compilation task to a slave execution terminal except the master execution terminal among the multiple candidate execution terminals includes:
after the compiling task is executed, determining the type information of each new file generated in the process of executing the compiling task;
and under the condition that the type information of the new file is a compilable file, sending the new file to a slave execution terminal except the master execution terminal in the candidate execution terminals.
In an optional implementation manner, the determining, from a plurality of candidate execution terminals, a target execution terminal corresponding to the compilation task based on the task type of the compilation task includes:
under the condition that the task type of the compiling task is a compiling task, selecting a subordinate execution terminal except a main execution terminal from the candidate execution terminals as a target execution terminal corresponding to the compiling task;
and under the condition that the task type of the compiling task is a non-compiling task, determining that the main execution terminal is a target execution terminal corresponding to the compiling task.
In a second aspect, an embodiment of the present disclosure further provides another compiling method applied to a slave execution terminal, including:
receiving a compiling task distributed by the main execution terminal to the slave execution terminal, and receiving a compilable file generated by the main execution terminal in the process of executing other compiling tasks;
and executing the distributed compiling task based on the compilable file.
In an optional embodiment, the executing the allocated compiling task based on the compilable file includes:
searching a target compilable file required by executing the compiling task from the received compilable file;
and executing the distributed compiling task based on the searched target compilable file.
In an optional embodiment, the method further comprises:
and sending an executable file generated in the process of executing the compiling task to the main execution terminal, wherein the executable file is used for the main execution terminal to execute the compiling task needing to use the executable file.
In a third aspect, an embodiment of the present disclosure further provides a compiling apparatus, configured to a main execution terminal, including:
the obtaining module is used for obtaining a compiling task list aiming at a target source file; the compilation task list indicates that there are a plurality of compilation tasks;
the screening module is used for determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals based on the task type of the compiling task aiming at each compiling task;
the execution module is used for executing the compiling task under the condition that the target execution terminal is a main execution terminal, and sending a compilable file generated in the process of executing the compiling task to a slave execution terminal except the main execution terminal in the candidate execution terminals; and when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
In an optional implementation manner, the apparatus further includes a first receiving module, configured to:
receiving executable files generated by slave execution terminals except the master execution terminal in the plurality of candidate execution terminals in the process of executing the compiling task;
when the execution module executes the compilation task under the condition that the target execution terminal corresponding to the compilation task is the main execution terminal, the execution module is used for:
under the condition that the compiling task needs a target executable file generated by the slave execution terminal, searching the target executable file needed by executing the compiling task from the executable files sent by the slave execution terminal;
and executing the compiling task based on the searched target executable file.
In an optional embodiment, when the executable module sends the compilable file generated in the process of executing the compilation task to a slave execution terminal other than the master execution terminal among the candidate execution terminals, the executable module is configured to:
after the compiling task is executed, determining the type information of each new file generated in the process of executing the compiling task;
and under the condition that the type information of the new file is a compilable file, sending the new file to a slave execution terminal except the master execution terminal in the candidate execution terminals.
In an optional implementation manner, when determining, based on the task type of the compilation task, a target execution terminal corresponding to the compilation task from a plurality of candidate execution terminals, the screening module is configured to:
when the task type of the compiling task is a compiling task, selecting a subordinate execution terminal except a main execution terminal from the candidate execution terminals as a target execution terminal corresponding to the compiling task;
and under the condition that the task type of the compiling task is a non-compiling task, determining that the main execution terminal is a target execution terminal corresponding to the compiling task.
In a fourth aspect, an embodiment of the present disclosure further provides another compiling apparatus, configured to be used in a slave execution terminal, including:
the second receiving module is used for receiving the compiling tasks distributed to the slave execution terminals by the main execution terminal and receiving the compilable files generated by the main execution terminal in the process of executing other compiling tasks;
and the compiling module is used for executing the distributed compiling tasks based on the compilable files.
In an optional implementation manner, the compiling module is specifically configured to:
searching a target compilable file required by executing the compiling task from the received compilable file;
and executing the distributed compiling task based on the searched target compilable file.
In an optional implementation manner, the apparatus further includes a sending module:
and sending an executable file generated in the process of executing the compiling task to the main execution terminal, wherein the executable file is used for the main execution terminal to execute the compiling task needing to use the executable file.
In a fifth aspect, an embodiment of the present disclosure further provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect, or any one of the possible implementations of the first aspect, or the second aspect, or any one of the possible real-time implementations of the second aspect.
In a fourth aspect, the disclosed embodiments also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, performs the steps in the first aspect, or any one of the possible implementations of the first aspect, or performs the steps in the second aspect, or any one of the possible real-time implementations of the second aspect.
According to the compiling method and device provided by the embodiment of the disclosure, a compiling task list aiming at a target source file is obtained; the compilation task list indicates that there are a plurality of compilation tasks; for each compiling task, determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals based on the task type of the compiling task; when the target execution terminal is a main execution terminal, executing the compiling task, and sending a compilable file generated in the process of executing the compiling task to a slave execution terminal except the main execution terminal in the plurality of candidate execution terminals; and when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
According to the compiling task execution method and the compiling device, the compilable files generated in the compiling task execution process are sent to the subordinate execution terminals through the main execution terminal, so that the subordinate execution terminals execute the distributed compiling tasks according to the received compilable files, the input and the output of each compiling task do not need to be calculated in advance, the distributed compiling speed can be greatly shortened, and computing resources are saved.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
Fig. 1 is a schematic diagram illustrating a compiling system provided by an embodiment of the disclosure;
FIG. 2 is a flow chart illustrating a compiling method provided by an embodiment of the disclosure;
FIG. 3 is a flow chart illustrating another compiling method provided by the embodiments of the present disclosure;
FIG. 4 is a flow chart illustrating yet another compiling method provided by the embodiments of the present disclosure;
fig. 5 is a schematic diagram of a compiling apparatus provided by an embodiment of the disclosure;
fig. 6 is a schematic diagram of another compiling apparatus provided in the embodiment of the disclosure;
fig. 7 shows a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure, presented in the figures, is not intended to limit the scope of the claimed disclosure, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making any creative effort, shall fall within the protection scope of the disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The term "and/or" herein merely describes an associative relationship, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Research shows that a main execution terminal in a distributed compiling system usually needs to calculate input and output of each compiling task before distributing the compiling tasks, because dependent calculation is involved, a large amount of computing resources and time are consumed, and different programming languages are difficult to use the same set of computing scheme, so that the efficiency of distributed compiling is difficult to improve.
Based on the above research, the present disclosure provides a compiling method and device, in which a main execution terminal sends a compliable file generated in a process of executing a compiling task to a slave execution terminal, so that the slave execution terminal executes an allocated compiling task according to the received compliable file, without calculating the input and output of each compiling task in advance, thereby greatly reducing the speed of distributed compiling and saving computing resources.
For the convenience of understanding of the present embodiment, a compiling system disclosed in the embodiments of the present disclosure will be described in detail first. Referring to fig. 1, a compiling system provided in the embodiment of the present disclosure includes a master execution terminal master and one or more slave execution terminals worker, where the master execution terminal and the slave execution terminals are respectively provided with a file management module cfs, the file management modules may perform network communication and file transmission, the master execution terminal and the slave execution terminals may also directly perform network communication, the file management module may be used as a part of a local disk of a corresponding execution terminal for the execution terminal to read and write data, and can send the data of the local disk of the corresponding execution terminal to other file management modules, the main execution terminal can distribute a compiling Task to the subordinate execution terminals, and can also send a compliable file, if the suffixes are c and h, the files are written into the corresponding file management modules and are sent to the file management modules of the subordinate execution terminals by the file management modules. The slave execution terminal may write an executable file, such as a file suffixed with o, to its corresponding file management module, which sends it to the file management module of the master execution terminal.
To describe the compiling method provided by the present disclosure in detail, a master execution terminal and a slave execution terminal will be respectively used as an execution subject.
Referring to fig. 2, which is a flowchart of a compiling method provided in the embodiment of the present disclosure, an execution subject of the method is a main execution terminal, and the method includes steps S201 to S204, where:
s201, acquiring a compiling task list aiming at a target source file; the compilation task list indicates that there are multiple compilation tasks.
The target source file can be a code file written by a computer programming language, and the main execution terminal can acquire the target source file, analyze the target source file through the compiling framework, generate a plurality of compiling tasks and a compiling task list aiming at the target source file. A plurality of compilation tasks is indicated in the compilation task list.
S202, aiming at each compiling task, determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals based on the task type of the compiling task.
The candidate execution terminals may include a master execution terminal and a slave execution terminal; the compiling tasks can be divided into a plurality of types, and the compiling tasks needing the compiling step can be distributed to the subordinate execution terminals, such as the tasks for generating the o-type files, and other non-compiling tasks needing no compiling can be distributed to the main execution terminal. The compiling task can be determined to be distributed to the main execution terminal or the slave execution terminals according to the task type of the compiling task, and if a plurality of slave execution terminals exist, the compiling task can be distributed according to the load of each slave execution terminal and the distributed compiling task.
S203, under the condition that the target execution terminal is a main execution terminal, executing the compiling task, and sending a compilable file generated in the process of executing the compiling task to slave execution terminals except the main execution terminal in the candidate execution terminals.
In this step, if the target execution terminal is the master execution terminal, the master execution terminal may execute the compilation task, and if a compilable file is generated during execution of the compilation task, the generated compilable file may be transmitted to each slave execution terminal.
Specifically, the generated compliable file may be directly sent to all the slave execution terminals, so that the slave execution terminals do not need to calculate in advance the output required for each slave execution terminal to execute the compiling task, and the slave execution terminals may directly access the required file according to the path indicated by the compiling task.
The main execution terminal can send the executable file through the file management module deployed by the main execution terminal, and the process of executing the compiling task does not need to sense the processes of sending and receiving the file and can directly access the local disk.
Furthermore, the main execution terminal can also send the target source file to the slave execution terminal in advance, so that the slave execution terminal not only contains the initial target source file, but also contains a compliable file newly generated in the compiling process, and can execute any compiling task needing compiling steps.
For example, each time the main execution terminal completes the compilation task, the type information of each new file generated in the process of executing the compilation task may be determined, and if the type information is a compilable file, the type information is sent to each slave execution terminal, and if the type information is not a compilable file, the type information may not be operated.
S204, when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
In this step, since the master execution terminal has already sent all the compilable files generated currently to all the slave execution terminals, the files on any slave execution terminal can support it to execute the allocated compilation task, and due to the file management module, the slave execution terminal only needs to execute the task normally and read the local disk to access the required compilable files.
Furthermore, the main execution terminal may further receive an executable file generated by the slave execution terminal during the execution of the compilation task, and in the case that the currently executed compilation task requires a target executable file generated by the slave execution terminal, search the received executable file for the target executable file.
Specifically, the received executable file can be stored in the corresponding compiling directory through the file management module, the process executing the compiling task can find the target executable file only according to the normal execution flow, and the current compiling task is executed based on the target executable file.
Referring to fig. 3, a flowchart of another compiling method provided in the embodiment of the present disclosure is shown, where an execution terminal of the method is a slave execution terminal, and includes steps S301 to S302, where:
s301, receiving the compiling task distributed by the main execution terminal to the slave execution terminal, and receiving a compilable file generated by the main execution terminal in the process of executing other compiling tasks.
In this step, the slave execution terminal may receive, through the file management module disposed therein, a compilable file generated by the master execution terminal in the process of executing another compilation task, and store the compilable file into a corresponding compilation path, or may receive a target source file sent by the master execution module in advance, so that when the master execution terminal distributes the compilation task to the slave execution terminal, a file for executing the compilation task necessarily exists on the slave execution terminal.
S302, executing the distributed compiling tasks based on the compilable files.
In this step, the slave execution terminal may normally start to execute the logic of the compilation task, directly search the target compilable file required for executing the compilation task under the compilation directory, and execute the allocated compilation task based on the searched target compilable file.
After the distributed compiling task is completed, the slave execution terminal may send the executable compiling file generated in the compiling task execution process to the master execution terminal, so that the master execution terminal may execute other compiling tasks by using the executable file.
Referring to fig. 4, in another compiling method provided for the embodiment of the present disclosure, in the method, a master of a master execution terminal obtains a compiling task list TL, and then determines whether there are unfinished tasks in the TL, and if not, directly ends the compiling; if the task T exists, taking out a compiling task T from the TL, judging whether the task is required to be sent to a subordinate execution terminal worker, if not, directly executing the task T by the master, generating a new file F1 in the process of executing the task T, writing the new file F1 into a file management module CFS1 deployed on the master, judging whether the F1 is required to be sent to the worker by the CFS1, forwarding the file according to a judgment result when the judgment is finished, and waiting for executing the next mutation task; if the file needs to be compiled, the file is sent to the worker, the worker executes the compiling task T, a new file F2 is generated in the execution process, the file is written into a file management module CFS2 deployed on the worker, the CFS2 judges whether the F2 needs to be forwarded to the master or not, if the file needs to be compiled, the file is forwarded to the master, then the next task is waited to be executed, and if the file does not need to be compiled, the next task is waited to be executed directly.
According to the compiling method provided by the embodiment of the disclosure, a compiling task list aiming at a target source file is obtained; the compilation task list indicates that there are a plurality of compilation tasks; for each compiling task, determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals based on the task type of the compiling task; when the target execution terminal is a main execution terminal, executing the compiling task, and sending a compilable file generated in the process of executing the compiling task to a slave execution terminal except the main execution terminal in the plurality of candidate execution terminals; and when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
According to the compiling method and the compiling device, the compiling file generated in the process of executing the compiling task is sent to the slave executing terminal through the master executing terminal, so that the slave executing terminal can execute the distributed compiling task according to the received compiling file, the input and the output of each compiling task do not need to be calculated in advance, the speed of distributed compiling can be greatly shortened, and computing resources are saved.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, a compiling device corresponding to the compiling method is also provided in the embodiments of the present disclosure, and since the principle of solving the problem of the device in the embodiments of the present disclosure is similar to that of the compiling method in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Referring to fig. 5, a schematic diagram of a compiling apparatus provided in an embodiment of the present disclosure is used for a main execution terminal, where the apparatus includes:
an obtaining module 510, configured to obtain a compilation task list for a target source file; the compilation task list indicates that there are a plurality of compilation tasks;
a screening module 520, configured to determine, for each compiling task, a target execution terminal corresponding to the compiling task from multiple candidate execution terminals based on a task type of the compiling task;
an executing module 530, configured to, if the target execution terminal is a master execution terminal, execute the compilation task, and send a compilable file generated in a process of executing the compilation task to a slave execution terminal, other than the master execution terminal, of the multiple candidate execution terminals; and when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
In an optional implementation manner, the apparatus further includes a first receiving module, configured to:
receiving executable files generated by slave execution terminals except the master execution terminal in the plurality of candidate execution terminals in the process of executing the compiling task;
when the execution module 530 executes the compiling task under the condition that the target execution terminal corresponding to the compiling task is the main execution terminal, the execution module is configured to:
under the condition that the compiling task needs a target executable file generated by the slave execution terminal, searching the target executable file needed by executing the compiling task from the executable files sent by the slave execution terminal;
and executing the compiling task based on the searched target executable file.
In an optional embodiment, when the compilable file generated during the process of executing the compilation task is sent to a slave execution terminal other than the master execution terminal in the plurality of candidate execution terminals, the execution module 530 is configured to:
after the compiling task is executed, determining the type information of each new file generated in the process of executing the compiling task;
and under the condition that the type information of the new file is a compilable file, sending the new file to subordinate execution terminals except the main execution terminal in the candidate execution terminals.
In an optional implementation manner, when the screening module 520 determines, based on the task type of the compilation task, a target execution terminal corresponding to the compilation task from a plurality of candidate execution terminals, the screening module is configured to:
when the task type of the compiling task is a compiling task, selecting a subordinate execution terminal except a main execution terminal from the candidate execution terminals as a target execution terminal corresponding to the compiling task;
and under the condition that the task type of the compiling task is a non-compiling task, determining that the main execution terminal is a target execution terminal corresponding to the compiling task.
Referring to fig. 6, a schematic diagram of another compiling apparatus provided in the embodiment of the present disclosure is used for a slave execution terminal, where the apparatus includes:
a second receiving module 610, configured to receive a compiling task that is allocated by the master execution terminal to the slave execution terminals, and receive a compilable file that is generated by the master execution terminal in a process of executing other compiling tasks;
and a compiling module 620, configured to execute the allocated compiling task based on the compilable file.
In an alternative embodiment, the compiling module 630 is specifically configured to:
searching a target compilable file required by executing the compiling task from the received compilable file;
and executing the distributed compiling task based on the searched target compilable file.
In an optional implementation manner, the apparatus further includes a sending module:
and sending an executable file generated in the process of executing the compiling task to the main execution terminal, wherein the executable file is used for the main execution terminal to execute the compiling task needing to use the executable file.
The compiling device provided by the embodiment of the disclosure acquires a compiling task list aiming at a target source file; the compilation task list indicates that there are a plurality of compilation tasks; for each compiling task, determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals based on the task type of the compiling task; when the target execution terminal is a main execution terminal, executing the compiling task, and sending a compilable file generated in the process of executing the compiling task to a slave execution terminal except the main execution terminal in the plurality of candidate execution terminals; and when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
According to the compiling method and the compiling device, the compiling file generated in the process of executing the compiling task is sent to the slave executing terminal through the master executing terminal, so that the slave executing terminal can execute the distributed compiling task according to the received compiling file, the input and the output of each compiling task do not need to be calculated in advance, the speed of distributed compiling can be greatly shortened, and computing resources are saved.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Corresponding to the compiling method in fig. 2 or fig. 3, an embodiment of the present disclosure further provides an electronic device 700, as shown in fig. 7, a schematic structural diagram of the electronic device 700 provided in the embodiment of the present disclosure includes:
processor 71, memory 72, and bus 73; the memory 72 is used for storing execution instructions and includes a memory 721 and an external memory 722; the memory 721 is also referred to as an internal memory, and is used for temporarily storing the operation data in the processor 71 and the data exchanged with the external memory 722 such as a hard disk, the processor 71 exchanges data with the external memory 722 through the memory 721, and when the electronic device 700 operates, the processor 71 communicates with the memory 72 through the bus 73, so that the processor 71 executes the following instructions:
acquiring a compiling task list aiming at a target source file; the compilation task list indicates that there are a plurality of compilation tasks;
for each compiling task, determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals based on the task type of the compiling task;
when the target execution terminal is a main execution terminal, executing the compiling task, and sending a compilable file generated in the process of executing the compiling task to a slave execution terminal except the main execution terminal in the plurality of candidate execution terminals;
when a target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file;
or receiving a compiling task distributed by the main execution terminal to the slave execution terminal, and receiving a compilable file generated by the main execution terminal in the process of executing other compiling tasks;
executing the allocated compilation task based on the compilable file.
The embodiments of the present disclosure also provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the compiling method described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the compiling method in the foregoing method embodiments, which may be referred to specifically in the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in software functional units and sold or used as a stand-alone product, may be stored in a non-transitory computer-readable storage medium executable by a processor. Based on such understanding, the technical solutions of the present disclosure, which are essential or part of the technical solutions contributing to the prior art, may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, but not to limit the technical solutions, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (11)

1. A compiling method applied to a main execution terminal includes:
acquiring a compiling task list aiming at a target source file; the compilation task list indicates that there are a plurality of compilation tasks;
for each compiling task, determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals based on the task type of the compiling task;
executing the compiling task under the condition that the target execution terminal is a main execution terminal, and sending a compilable file generated in the process of executing the compiling task to slave execution terminals except the main execution terminal in the candidate execution terminals;
and when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
2. The method of claim 1, further comprising:
receiving executable files generated by slave execution terminals except the master execution terminal in the plurality of candidate execution terminals in the process of executing the compiling task;
and executing the compiling task under the condition that the target execution terminal corresponding to the compiling task is the main execution terminal, wherein the executing comprises the following steps:
under the condition that the compiling task needs a target executable file generated by the slave execution terminal, searching the target executable file needed by executing the compiling task from the executable files sent by the slave execution terminal;
and executing the compiling task based on the searched target executable file.
3. The method according to claim 1, wherein the sending the compilable file generated in the process of executing the compilation task to a slave execution terminal other than the master execution terminal among the plurality of candidate execution terminals comprises:
after the compiling task is executed, determining the type information of each new file generated in the process of executing the compiling task;
and under the condition that the type information of the new file is a compilable file, sending the new file to subordinate execution terminals except the main execution terminal in the candidate execution terminals.
4. The method according to claim 1, wherein the determining a target execution terminal corresponding to the compilation task from a plurality of candidate execution terminals based on the task type of the compilation task comprises:
under the condition that the task type of the compiling task is a compiling task, selecting a subordinate execution terminal except a main execution terminal from the candidate execution terminals as a target execution terminal corresponding to the compiling task;
and under the condition that the task type of the compiling task is a non-compiling task, determining that the main execution terminal is a target execution terminal corresponding to the compiling task.
5. A compiling method applied to a slave execution terminal, comprising:
receiving a compiling task distributed by the main execution terminal to the slave execution terminal, and receiving a compilable file generated by the main execution terminal in the process of executing other compiling tasks;
and executing the distributed compiling task based on the compilable file.
6. The method of claim 5, wherein performing the assigned compilation task based on the compilable file comprises:
searching a target compilable file required by executing the compiling task from the received compilable file;
and executing the distributed compiling task based on the searched target compilable file.
7. The method of claim 5, further comprising:
and sending an executable file generated in the process of executing the compiling task to the main execution terminal, wherein the executable file is used for the main execution terminal to execute the compiling task needing to use the executable file.
8. A compiling apparatus for a master execution terminal, comprising:
the obtaining module is used for obtaining a compiling task list aiming at a target source file; the compiling task list indicates that a plurality of compiling tasks exist;
the screening module is used for determining a target execution terminal corresponding to the compiling task from a plurality of candidate execution terminals according to the task type of the compiling task;
the execution module is used for executing the compiling task under the condition that the target execution terminal is a main execution terminal, and sending a compilable file generated in the process of executing the compiling task to a slave execution terminal except the main execution terminal in the candidate execution terminals; and when the target execution terminal corresponding to the compiling task is a slave execution terminal except the master execution terminal in the candidate execution terminals, distributing the compiling task to the target execution terminal so that the target execution terminal executes the distributed compiling task based on the received compilable file.
9. A compiling apparatus for a slave execution terminal, comprising:
the second receiving module is used for receiving the compiling tasks distributed to the slave execution terminals by the main execution terminal and receiving the compilable files generated by the main execution terminal in the process of executing other compiling tasks;
and the compiling module is used for executing the distributed compiling tasks based on the compilable files.
10. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is operating, the machine-readable instructions when executed by the processor performing the steps of the compiling method of any of claims 1 to 4 or 5 to 7.
11. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the steps of the compiling method according to any of claims 1 to 4 or 5 to 7.
CN202210390550.3A 2022-04-14 2022-04-14 Compiling method and device Pending CN114721664A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210390550.3A CN114721664A (en) 2022-04-14 2022-04-14 Compiling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210390550.3A CN114721664A (en) 2022-04-14 2022-04-14 Compiling method and device

Publications (1)

Publication Number Publication Date
CN114721664A true CN114721664A (en) 2022-07-08

Family

ID=82244477

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210390550.3A Pending CN114721664A (en) 2022-04-14 2022-04-14 Compiling method and device

Country Status (1)

Country Link
CN (1) CN114721664A (en)

Similar Documents

Publication Publication Date Title
EP3285170B1 (en) Application profiling job management system, program, and method
CN111831287B (en) Method, apparatus and program product for determining resources required to execute a code segment
CN110058861B (en) Source code processing method and device, storage medium and electronic equipment
JPWO2018066040A1 (en) Management computer and test environment determination method
JP2018028777A (en) Emulation device, emulation method, and emulation program
CN110928548A (en) Data processing method and equipment
CN106557307B (en) Service data processing method and system
CN113268500A (en) Service processing method and device and electronic equipment
CN114820080A (en) User grouping method, system, device and medium based on crowd circulation
CN115016905A (en) Calling topological graph generation method and device
CN113110865A (en) Server hot updating method and device
CN111988429A (en) Algorithm scheduling method and system
CN106484375B (en) Instruction block loading method, soft switch equipment and system
CN111488144A (en) Data processing method and equipment
CN114721664A (en) Compiling method and device
CN114356342A (en) Compiling method and device
CN114706586A (en) Code compiling method, code running method, code compiling device, code running device, computer equipment and storage medium
CN114817288A (en) Data processing method and device, electronic equipment and storage medium
CN114443042A (en) Service arrangement execution method based on rule engine and related equipment
CN112445607B (en) Method and device for executing method function by application program
CN113849161A (en) Application control method and device, storage medium and electronic equipment
CN113127005A (en) Method and device for generating executable file and computer storage medium
JP2017091070A (en) Executable code generation program and executable code generation device
CN112882698A (en) Development environment generation method and device, computer storage medium and electronic device
CN116301758B (en) Rule editing method, device, equipment and medium based on event time points

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

CB02 Change of applicant information