Application debugging method and device, electronic device and storage medium
By inserting an aborted exception function at the end of the application compilation, the application checksum correction problem is solved, and the resource overhead and low efficiency of application code correction in the existing technology is solved, and a more efficient joint debugging and debugging process is achieved.
Patent Information
- Application Number
- CN202110806515.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-16
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-07-16
AI Technical Summary
In the process of application code correction for big data tasks, the resource overhead is large and the efficiency is low, resulting in high error rate and debug overhead during the joint debugging process.
Create a first running environment for verification of the application by inserting an execution function that aborts execution and throws an exception at the end of the application compilation. If the application stops due to an insertion abnormality, the verification is determined to be successful; otherwise, the application is corrected based on the exception information. Then, the application is connected in the second running environment.
Reduces resource overhead and improves verification efficiency, reduces error rate and debugging overhead during joint debugging, and improves application debugging efficiency.
Smart Images

Figure CN113568830B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to an application debugging method and device, an electronic device, and a storage medium. Background Art
[0002] The correctness check of big data tasks usually needs to be submitted to a cluster containing multiple devices. Before the joint debugging begins, it is necessary to apply for joint debugging resources to obtain the joint debugging results. Then, based on the joint debugging results, the application code is corrected. However, this method of correcting the application code has high resource consumption and low efficiency. Summary of the invention
[0003] Embodiments of the present disclosure provide an application debugging method and device, an electronic device, and a storage medium.
[0004] A first aspect of an embodiment of the present disclosure provides an application debugging method, including:
[0005] Creating a first operating environment in the submitting machine, wherein a first execution function is called in the first operating environment, and the first execution function is: inserting an execution function that terminates execution and throws an exception at the end of the application compilation;
[0006] Compiling the application based on the first execution function in the first operating environment;
[0007] When the first execution function stops the execution of the application due to an exception, determining, according to the exception information generated by the exception thrown by the application, whether the cause of stopping the application is an exception inserted by the first execution function at the end of the application compilation;
[0008] If it is determined that the cause of the application stopping is an insertion exception of the first execution function at the end of the application compilation, then it is determined that the application verification is successful;
[0009] After the application is successfully verified, the application is jointly debugged based on the second operating environment, wherein a second execution function is called in the second operating environment, and wherein the second execution function submits the compilation result of the application to the target cluster after the application is compiled.
[0010] Based on the above solution, the method further includes:
[0011] If it is determined that the reason causing the application to stop is not an exception inserted by the first execution function at the end of the application compilation, determining that the application verification fails;
[0012] When the application verification fails, the application is corrected according to the abnormality information characterizing the abnormality of the application.
[0013] Based on the above solution, compiling the application based on the first execution function in the first operating environment includes:
[0014] The first execution function calls the entry function of the application based on a reflection mechanism;
[0015] The application is compiled based on the entry function.
[0016] Based on the above scheme, when the first execution function stops the execution of the application due to an exception, determining whether the cause of the application stopping is an exception inserted by the first execution function at the end of the application compilation according to the exception information generated by the exception thrown by the application includes:
[0017] Monitoring the execution status of the application program in the first operating environment;
[0018] When it is detected that the execution of the application program is stopped at the first execution function in the first operating environment and at least one exception information is thrown, the exception information is read from a stack set in the submitting machine;
[0019] Based on the read exception information, it is determined whether the cause causing the application to stop is an exception inserted by the first execution function at the end of the application compilation.
[0020] Based on the above solution, compiling the application based on the first execution function in the first operating environment includes:
[0021] Compiling the application based on the first execution function in the first operating environment to generate an execution process pipeline;
[0022] The method further comprises:
[0023] When the pipeline is found to be empty, it is determined that the application verification fails;
[0024] When the application fails verification, the application is corrected.
[0025] Based on the above solution, if it is determined that the cause causing the application to stop is an insertion exception of the first execution function at the end of the application compilation, then determining that the application verification is successful includes:
[0026] If it is determined that the reason for stopping the application is an insertion exception of the first execution function at the end of the application compilation and the pipeline is not empty, it is determined that the application verification is successful.
[0027] Based on the above solution, the method further includes:
[0028] Query the first type of joint debugging task information;
[0029] Determine the task type according to the first type of joint debugging task information;
[0030] Determine configuration parameters according to the task type;
[0031] Determining the dependencies and operating parameters of the application program according to the configuration parameters;
[0032] The step of creating a first operating environment in the submitting machine includes:
[0033] The first operating environment is created in the submission machine according to the dependencies and operating parameters of the application.
[0034] Based on the above solution, the method further includes:
[0035] Query the verification task information of the verification;
[0036] Determine the task type according to the verification task information;
[0037] Determine configuration parameters according to the task type;
[0038] Dependencies and operating parameters of the application according to the configuration parameters;
[0039] The step of creating a first operating environment in the submitting machine includes:
[0040] The first operating environment is created in the submission machine according to the dependencies and operating parameters of the application.
[0041] Based on the above solution, after the application is successfully verified, joint debugging of the application is performed based on the second operating environment, including:
[0042] After the application program is successfully verified, applying for joint debugging resources and creating a second operating environment according to the dependency relationship and the operating parameters;
[0043] The application is jointly debugged using the applied joint debugging resources in the second operating environment.
[0044] A second aspect of an embodiment of the present disclosure provides an application debugging device, including:
[0045] A creation module, used for creating a first operating environment in the submitting machine, wherein a first execution function is called in the first operating environment, and the first execution function is: an execution function that terminates execution and throws an exception is inserted at the end of the application compilation;
[0046] A compiling module, configured to compile the application program based on the first execution function in the first operating environment;
[0047] A first determination module is used to determine, when the first execution function stops the execution of the application program due to an exception, whether the cause of stopping the application program is an exception inserted by the first execution function at the end of the application program compilation according to the exception information generated by the exception thrown by the application program;
[0048] A second determination module, configured to determine that verification of the application is successful if it is determined that the cause of stopping the application is an insertion exception of the first execution function at the end of application compilation;
[0049] The joint debugging module is used to perform joint debugging of the application based on the second operating environment after the application is successfully verified, wherein the second execution function is called in the second operating environment, and wherein the second execution function submits the compilation result of the application to the target cluster after the application is compiled.
[0050] Based on the above solution, the device also includes:
[0051] a third determination module, configured to determine that the application verification fails if it is determined that the reason causing the application to stop is not an exception inserted by the first execution function at the end of the application compilation;
[0052] The first correction module is used to correct the application program according to the abnormality information characterizing the abnormality of the application program when the application program fails to be verified.
[0053] Based on the above solution, the compilation module is specifically used for the first execution function to call the entry function of the application based on the reflection mechanism; and compile the application based on the entry function.
[0054] Based on the above scheme, the second determination module is specifically used to monitor the execution status of the application in the first operating environment; when it is monitored that the execution of the application is stopped in the first execution function in the first operating environment and at least one exception information is thrown, the exception information is read from the stack set in the submission machine; based on the read exception information, it is determined whether the cause of the stop of the application is the insertion exception of the first execution function at the end of the application compilation.
[0055] Based on the above solution, the compiling module is specifically used to compile the application based on the first execution function in the first operating environment to generate an execution process pipeline;
[0056] The device further comprises:
[0057] A fourth determination module, configured to determine that the application verification fails when the pipeline is obtained to be empty;
[0058] The second correction module is used to correct the application when the application fails to be verified.
[0059] Based on the above scheme, the second determination module is specifically used to determine that the application verification is successful if it is determined that the reason for the application to stop is an insertion exception of the first execution function at the end of the application compilation and the pipeline is not empty.
[0060] A third aspect of the present disclosure provides an electronic device, including:
[0061] a memory for storing processor-executable instructions;
[0062] A processor connected to the memory;
[0063] Wherein, the processor is configured to execute the application debugging method provided by any technical solution of the first aspect mentioned above.
[0064] A fourth aspect of an embodiment of the present disclosure provides a non-temporary computer-readable storage medium, characterized in that the computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the application debugging method provided by any technical solution of the first aspect.
[0065] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0066] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0068] Figure 1 It is a flowchart of an application debugging method shown in an embodiment of the present disclosure.
[0069] Figure 2It is a schematic diagram of the effect of a debugging interface of an application program shown in an embodiment of the present disclosure.
[0070] Figure 3 It is a flowchart of an application debugging method shown in an embodiment of the present disclosure.
[0071] Figure 4 It is a flowchart of an application debugging method shown in an embodiment of the present disclosure.
[0072] Figure 5 It is a structural diagram of an application debugging device shown in an embodiment of the present disclosure.
[0073] Figure 6 It is a structural schematic diagram of an electronic device shown in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0074] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0075] like Figure 1 As shown, the embodiment of the present disclosure provides an application debugging method, including:
[0076] S110: creating a first operating environment in the submitting machine, wherein a first execution function is called in the first operating environment, and the first execution function is: an execution function that terminates execution and throws an exception is inserted at the end of the application compilation;
[0077] S120: Compiling the application based on the first execution function in the first operating environment;
[0078] S130: when the first execution function stops the execution of the application due to an exception, determining, according to the exception information generated by the exception thrown by the application, whether the cause of stopping the application is an exception inserted by the first execution function at the end of the application compilation;
[0079] S140: If it is determined that the reason causing the application to stop is an insertion exception of the first execution function at the end of the application compilation, then it is determined that the application verification is successful;
[0080] S150: After the application is successfully verified, the application is jointly debugged based on the second operating environment, wherein a second execution function is called in the second operating environment, and wherein the second execution function submits the compilation result of the application to the target cluster after the application is compiled.
[0081] In the embodiment of the present disclosure, the submitting machine may be any device that currently stores the application program to be debugged.
[0082] In the disclosed embodiment, the submitting machine may perform verification on the local machine before joint debugging.
[0083] The application to be debugged in the embodiment of the present disclosure may be any application that needs to be debugged. Exemplarily, the application may include but is not limited to an application for a big data task.
[0084] The submitting machine creates a first operating environment in the local machine, and compiles the application according to the first execution function in the first operating environment created locally on the submitting machine. The first execution function here inserts any function that throws an exception and can compile the application at the end of the compilation.
[0085] The application is compiled using the first execution function, and then an OBJ file of the application is obtained after the application is compiled, that is, an object file after the application is compiled is obtained.
[0086] In the disclosed embodiment, since the first execution function inserts an execution function that terminates execution and throws an exception at the end of the application compilation, during the process of the first execution function compiling the application, if the application compilation is successful, it will be compiled to the end and an exception will be thrown at the end. If there are still problems with the application itself, the application may throw an exception during the compilation process, and these exceptions may cause the compilation of the application to be terminated.
[0087] When an exception is thrown during the compilation of an application, the exception information will be recorded. When the application stops executing due to an exception, the reason why the application stopped executing is determined based on the exception information generated by the application exception.
[0088] If it is detected that the reason why the application stops executing is due to an exception inserted by the first execution function at the end of the application compilation, it means that there was no exception in the application compilation process or the probability of an exception was relatively small. Therefore, it can be determined that the application itself may not have attribute definition errors, code syntax writing errors, application dependency errors, or custom function errors, etc., and thus it can be determined that the application verification is successful.
[0089] After the application is successfully verified, the application is debugged in the second runtime environment. The execution function is also called in the second runtime environment to execute the application, but the execution function called at this time is the second execution function. The second execution function will not insert an exception at the end of the application compilation.
[0090] If application-level joint debugging is performed after successful application verification, some application-level errors can be discovered during the application verification process, thereby improving the success rate of joint debugging compared to direct joint debugging.
[0091] Usually, the joint debugging of an application requires the target cluster to mimic the cooperation between the client and multiple servers that run the application in a distributed manner. Therefore, joint debugging involves a large amount of resource scheduling and equipment, and the coordination between multiple devices, as well as a large amount of signaling interaction and debugging configuration before joint debugging. Therefore, if errors are brought to the joint debugging process, it will lead to a large debugging overhead for the application. Moreover, since joint debugging involves the interaction between multiple devices, the dirty data generated during the joint debugging process may also pollute the online data such as the data stored in the database in the target cluster.
[0092] In some embodiments, the target cluster includes one or more physical machines. Specifically, the target cluster usually includes multiple physical machines.
[0093] In this embodiment, before performing joint debugging of the application, an application verification process is inserted and executed locally on the submitting machine (i.e., without involving other devices). Through application verification, some errors in the application are discovered and removed, thereby improving the success rate of joint debugging, improving the debugging efficiency of the application, and reducing the joint debugging overhead of the application.
[0094] In one embodiment, the second execution function and the first execution function may be the same type of execution function, and the differences between the first execution function and the second execution function include:
[0095] The first execution function will insert an exception to terminate the execution of the application program at the end of the compilation of the application program; while the second execution function will not insert an exception to terminate the execution of the application program at the end of the compilation of the application program;
[0096] The first execution function can be executed in the first execution environment, and the second execution function can be executed in the second execution environment. When the application is executed in the first execution environment, the submitter will not interact with other devices in the target cluster. When the application is executed in the second execution environment, the submitter will interact with other devices in the target cluster.
[0097] Due to the similarities and differences between the first execution function and the second execution function, more errors of the application program can be found as much as possible during the verification phase, thereby improving the verification efficiency of the application program.
[0098] Of course, in other embodiments, the first execution function and the second execution function may be different types of execution functions, as long as the first execution function inserts an exception that terminates the execution of the application at the end of the compilation of the application.
[0099] In some embodiments, the method further comprises:
[0100] If it is determined that the reason causing the application to stop is not an exception inserted by the first execution function at the end of the application compilation, determining that the application verification fails;
[0101] When the application verification fails, the application is corrected according to the abnormality information characterizing the abnormality of the application.
[0102] Before verifying the application, a stack for storing exception information is configured. When the application is terminated, the exception information can be extracted from the stack, and the exception type, the parameters causing the exception and / or the cause of the exception can be determined based on the exception information.
[0103] For example, the exception type may include an error type that is a serious exception, and may also include an Exception type that is less severe than the error type.
[0104] For example, if a value used as a divisor is 0, an Exception will result, as will an exception to the parameter setting value.
[0105] In one embodiment, the cause and / or location of the abnormality in the execution of the application program can be analyzed through the abnormality information, thereby facilitating the application program writer or the correction device to correct the application program.
[0106] In another embodiment, the abnormality information may be information that merely indicates that an abnormality has occurred, and such information may not be used to locate the abnormality or determine the cause of the abnormality.
[0107] In some embodiments, the S120 may include:
[0108] The first execution function calls the entry function of the application based on a reflection mechanism;
[0109] The application is compiled based on the entry function.
[0110] The first execution function may obtain an entry function of the application based on a reflection mechanism, and the entry function may be the Main function of the application.
[0111] After reading the entry function of the application, the application can be compiled from the entry function to obtain the target file after the application is compiled. For example, taking the source program of the application as a Java program as an example, a Class file is obtained by compilation.
[0112] In the embodiment of the present disclosure, the entry function of the application is obtained simply and quickly based on the reflection mechanism, and then the application file is compiled based on the entry function.
[0113] In some embodiments, the S130 may include:
[0114] Monitoring the execution status of the application program in the first operating environment;
[0115] When it is detected that the execution of the application program is stopped at the first execution function in the first operating environment and at least one exception information is thrown, the exception information is read from a stack set in the submitting machine;
[0116] Based on the read exception information, it is determined whether the cause causing the application to stop is an exception inserted by the first execution function at the end of the application compilation.
[0117] For example, the execution status of the application in the first operating environment is monitored, so as to know whether the application is terminated due to an exception. If the application is detected to be terminated, the exception information is read, and the exception information is based on whether the termination of the application is caused by an exception in the first execution function at the end of the application compilation.
[0118] In some embodiments, the S120 may include:
[0119] The application is compiled based on the first execution function in the first operating environment to generate an execution process pipeline.
[0120] During the compilation process, an application will generate an execution flow. Usually, applications are written according to the execution flow, and the application can generate such an execution flow during the compilation process. In the embodiment of the present disclosure, the execution flow obtained by compiling such an application is called a pipeline.
[0121] In some embodiments, Figure 2 As shown, the method also includes:
[0122] S101: When it is obtained that the pipeline is empty, it is determined that the application verification fails;
[0123] S102: When the application verification fails, correct the application.
[0124] When it is detected that the application is terminated due to an exception, it will also check whether the pipeline generated by the application compilation is obtained. If the application pipeline is not obtained, it is very likely that the application has not been compiled successfully. Even if the exception information at least shows that the execution of the application is caused by the exception inserted by the first execution function, the application verification will be considered to have failed. By obtaining the pipeline to further determine whether the application verification is successful, the accuracy of the application verification on the submitting machine can be improved.
[0125] If it is determined based on the exception information that the reason for the termination of the application execution is due to the exception inserted by the first execution function at the end of the compilation of the application, and the application pipeline is successfully obtained, it can be determined that the application verification is successful.
[0126] If the application verification fails, the application joint debugging can be suspended to reduce the phenomenon of joint debugging failure. In order to increase the success of application joint debugging, the application can be verified based on the exception information and / or the exception of not obtaining the pipeline.
[0127] In some embodiments, the S140 may include:
[0128] If it is determined that the reason for stopping the application is an insertion exception of the first execution function at the end of the application compilation and the pipeline is not empty, it is determined that the application verification is successful.
[0129] This method can improve the accuracy of the result judgment of successful application verification.
[0130] In some embodiments, the method further comprises:
[0131] Output the prompt information of pipeline obtained and whether the pipeline is correct;
[0132] receiving user feedback regarding the prompt information;
[0133] If the user feedback indicates that the acquired pipeline is correct, and the reason for the termination of the application program is due to an exception inserted by the first execution program at the end of the compilation of the application program, then the application program verification is deemed to be successful.
[0134] If user feedback indicates that the obtained pipeline is wrong, it can be determined that the application verification has failed.
[0135] In some embodiments, the method further comprises:
[0136] Query the first type of joint debugging task information;
[0137] Determine the task type according to the first type of joint debugging task information;
[0138] Determine configuration parameters according to the task type;
[0139] Determining the dependencies and operating parameters of the application program according to the configuration parameters;
[0140] The step of creating a first operating environment in the submitting machine includes:
[0141] The first operating environment is created in the submission machine according to the dependencies and operating parameters of the application.
[0142] In some embodiments, the application has a joint debugging task, and the joint debugging task information is stored in the database in the target cluster. This task information may be first-type joint debugging task information.
[0143] After obtaining the first type of joint debugging task information, the task type of the joint debugging may be determined. Exemplarily, the task type may include at least: Jar task and / or Sql task.
[0144] Different task types require different joint debugging configurations. In the disclosed embodiment, configuration parameters can be determined according to the task type. For example, parameters of entry functions of different task types can be obtained. For example, Args parameters of different tasks can be obtained.
[0145] According to the configuration parameters, the application level dependencies and operating parameters are determined. For example, Maven dependencies are downloaded and the runtime parameters are assembled.
[0146] The first operating environment is created in the submitting machine according to the dependency relationship and operating parameters of the application program. The first operating environment runs the first execution function, and the application program running in the first operating environment is blocked after being compiled.
[0147] In the disclosed embodiment, in order to reduce joint debugging failures, the verification process running locally on the submitting machine is automatically triggered when a joint debugging task is detected. Through the verification process before the joint debugging, some errors in the application program are discovered, thereby reducing the failure rate of the joint debugging and reducing the joint debugging resources wasted by failed joint debugging.
[0148] After the verification is completed successfully, the joint debugging resources are scheduled based on the first type of joint debugging task information, and the formal joint debugging process begins.
[0149] In this embodiment, if there is a joint debugging task, the verification will be automatically triggered, so there is no need for developers or programmers to manually trigger the verification of the application.
[0150] In some embodiments, reference Figure 3 As shown, verification and joint debugging are two independent processes that can be controlled separately. If verification and joint debugging are two independent processes, the debugging interface of the application displayed on the submitting machine can set the verification control and the joint debugging control separately.
[0151] In this way, the task information of the verification task can be stored in the database or in the submitting machine itself, and the task information at this time can be called verification task information. The information content of the same verification task information can be roughly the same as the task information contained in the joint debugging task except for the difference in task identification.
[0152] Similarly, the task type is determined according to the verification task information, and the configuration parameters are determined based on the task type, thereby obtaining the dependency relationship and operation parameters of the application.
[0153] In S110 , a first operating environment may be created locally on the submitting machine according to the dependencies and operating parameters of the application.
[0154] In the embodiment of the present disclosure, creating the first operating environment may at least include: configuring the aforementioned first execution function.
[0155] If the verification task of the application performs the verification, the application can be subsequently debugged based on the debugging task independent of the verification task.
[0156] The S150 may include: after the application is successfully verified, applying for joint debugging resources and creating a second operating environment according to the dependency relationship and the operating parameters; and performing joint debugging on the application in the second operating environment using the applied joint debugging resources.
[0157] After the joint debugging begins, you need to apply for joint debugging resources and create a second operating environment that is different from the first operating environment. Use the joint debugging resources to perform cross-device joint debugging of the application.
[0158] If the joint debugging task and the verification task can be two independent tasks, in some cases, the joint debugging of the application is performed after the instruction for joint debugging is detected, and the verification of the application is performed after the instruction for the verification task is detected.
[0159] In some embodiments, the method further comprises:
[0160] Query the information of the second type of joint debugging tasks;
[0161] When the second type of joint debugging task information is queried, determining whether the application has been verified;
[0162] If the application has not been verified, a verification prompt will pop up;
[0163] detecting user feedback regarding the verification prompt;
[0164] The S110 may include:
[0165] When the user feedback is the first feedback, the first operating environment is created according to the second type of joint debugging task information.
[0166] The type of joint debugging task indicated by the second type of joint debugging task information is different from the type of joint debugging task indicated by the first type of joint debugging task information. The joint debugging task indicated by the first type of joint debugging task information will automatically precede the verification of the application. In the disclosed embodiment, the joint debugging task indicated by the second type of joint debugging task information will not force the verification task of the application to be a preceding task.
[0167] However, in order to reduce the failure rate of joint debugging, when querying the second type of joint debugging task information, it will determine whether the application has been verified. For example, if the application has been verified, a verification record will be generated, which may be stored locally on the submitting machine of the verified application, or submitted to the database in the cluster by the submitting machine of the verified application.
[0168] Of course, in other embodiments, the submission machine can also output inquiry information on whether the application has been verified when querying the second type of joint debugging task information. Based on the confirmation feedback of the inquiry information, it can be determined that the application has been verified and the verification has passed. If a denial prompt based on the inquiry information is detected, it is determined that the application has not been verified.
[0169] There are many ways to determine whether an application has been verified, and the specific implementation is not limited to any of the above examples.
[0170] If it is determined that the application has not been verified, a verification prompt will be output to ensure the success rate of joint debugging. The verification prompt can be used to prompt the application developer to verify the application before the joint debugging task.
[0171] If the user feedback is the first feedback, a first operating environment is created according to the second type of joint debugging task information to enter the verification process of the application program; after the verification is completed and the application program verification succeeds, the joint debugging of the application program is performed.
[0172] If the application fails to be verified, the joint debugging is terminated and a record is generated. The record is associated with the second joint debugging task information, indicating that the application has been verified and failed, and that the second joint debugging task has been started but terminated due to a verification failure, and the joint debugging task has not been completed.
[0173] The first feedback may be user feedback indicating that a preliminary verification of the application is required. In some embodiments, the method further includes:
[0174] When the user feedback is the second feedback, a second operating environment is created according to the second type of joint debugging task information and joint debugging of the application is started.
[0175] The second feedback may be user feedback indicating to ignore whether the application is verified or the verification result and directly perform joint debugging. Therefore, in some embodiments, if the second feedback acting on the verification prompt is detected, the second operating environment will be directly created and enter the joint debugging stage.
[0176] In some embodiments, the method further comprises:
[0177] If the application has been verified, determining a verification result of the application;
[0178] After the application program is successfully verified, joint debugging of the application program based on the second operating environment includes:
[0179] When the verification result indicates that the application is successfully verified, the application is jointly debugged based on the second operating environment.
[0180] If the verification result indicates that the application program verification fails, a verification failure prompt is output. If the verification failure prompt is output and the joint debugging instruction is still received, the application program is jointly debugged based on the second operating environment.
[0181] The disclosed embodiment provides a method for verifying the correctness of a big data task, which can verify the basic properties, syntax, self-dependency, UDF, data type, etc. of the task without applying for scheduling resources; the interaction speed is fast; and the verification will not cause online data pollution during joint debugging.
[0182] Generally, the development cycle of big data tasks is lengthy, usually developing JAR tasks offline, or editing business SQL in the platform IDE, and then joint debugging and testing, and submitting and running after the joint debugging is successful. There is no verification operation.
[0183] The joint debugging process requires application for scheduling resources to run. If an error occurs, multiple runs are required, and a large number of running resources are applied. Incorrect processing of data will cause online data pollution. Scheduling tasks such as Flink and Spark takes several minutes, and error logs are distributed on multiple machines and are difficult to locate.
[0184] In the process of statistical joint debugging and testing, most errors are caused by problems such as basic attributes, syntax, self-dependency, UDF, data types, etc. There is a way to quickly verify the correctness of the task before scheduling and running. The present invention selectively adds a verification step before the joint debugging and testing process.
[0185] Before joint debugging / running, an optional verification step is added. The addition of the verification step will bring the following technical effects:
[0186] No need to apply for scheduling execution resources;
[0187] Fast speed and no dirty data generated;
[0188] The error log is directly displayed; the error log is a specific presentation form of the above-mentioned abnormal information;
[0189] It can check non-runtime errors or exceptions such as basic properties, syntax, self-dependencies, UDFs, data types, etc.
[0190] refer to Figure 4 As shown, the application verification before joint debugging may include:
[0191] Step 1: Create a task and detect a trigger operation of the verification function, which includes but is not limited to: a click operation on a verification control.
[0192] Step 2: The platform queries the basic information of the task from the database based on the task ID.
[0193] Step 3: Determine the task type based on the basic information. Different task types use different processing methods. For example, if it is a Jar task, directly use the business Jar package and Args parameters when creating the task; if it is a Sql task, read the pre-defined Sql parsing Jar package from the platform configuration and assemble the Args parameters when the task is running.
[0194] Step 4: Prepare the running environment. If there are Maven dependencies, download the corresponding Maven dependencies to the local repository of the platform. Maven dependencies can be reused without repeated downloads to ensure the speed of verification. For example, if the submission machine has pre-downloaded the dependencies of the application, you can directly use the existing Maven dependencies and other dependencies in the submission machine, thereby reducing unnecessary downloads and improving the verification rate;
[0195] Step 5: Assemble the execution context based on the basic information of the task.
[0196] Steps 1-5 are the preparation phase. Steps 6-8 are the reflection acquisition pipeline sub-process.
[0197] Step 6: Create a class (e.g., PackagedProgram), prepare related jars and class loaders. Create an env in the thread, and save the env to the current thread through thread download (threadload). The env is one of the aforementioned first operating environments.
[0198] Step 7: Call the Main method through reflection, and execute the execute() method rewritten by env, which will automatically throw a ProgrambortException and exit the application. The Main method here can also be called the Main function, which is a type of the aforementioned entry function.
[0199] Step 8: Capture the exception thrown in step 7, such as ProgramAbortException, and obtain pip eline based on env; if it is other exceptions, return verification failure and echo the error stack information. Determine whether the pipeline returned in step 8 is null. If the pipeline is empty, return verification failure; if the pipeline is not empty, return verification success.
[0200] like Figure 5 As shown, the embodiment of the present disclosure provides an application debugging device, including:
[0201] A creation module 110 is used to create a first operating environment in the submitting machine, wherein a first execution function is called in the first operating environment, and the first execution function is: an execution function that terminates execution and throws an exception is inserted at the end of the application compilation;
[0202] A compiling module 120, configured to compile the application based on the first execution function in the first operating environment;
[0203] A first determination module 130 is used to determine, when the first execution function stops the execution of the application program due to an exception, whether the cause of stopping the application program is an exception inserted by the first execution function at the end of the application program compilation according to the exception information generated by the exception thrown by the application program;
[0204] A second determination module 140, configured to determine that the verification of the application is successful if it is determined that the cause of the application stopping is an insertion exception of the first execution function at the end of the application compilation;
[0205] The joint debugging module 150 is used to perform joint debugging of the application based on the second operating environment after the application is successfully verified, wherein the second execution function is called in the second operating environment, and wherein the second execution function submits the compilation result of the application to the target cluster after the application is compiled.
[0206] The application debugging device may be included in the local machine where the application is debugged.
[0207] In some embodiments, the creation module 110, the compilation module 120, the first determination module 130, the second determination module 140 and the joint debugging module 150 may be program modules; the program modules can implement the above operations after being executed.
[0208] In other embodiments, the creation module 110, the compilation module 120, the first determination module 130, the second determination module 140 and the joint debugging module 150 may be a combination of software and hardware modules; the combination of software and hardware modules include but are not limited to various programmable arrays. The programmable arrays include but are not limited to: field programmable arrays and / or complex programmable arrays.
[0209] In some other embodiments, the creation module 110, the compilation module 120, the first determination module 130, the second determination module 140 and the joint debugging module 150 may be pure hardware modules; the pure hardware modules include various application-specific integrated circuits.
[0210] In some embodiments, the apparatus further comprises:
[0211] a third determination module, configured to determine that the application verification fails if it is determined that the reason causing the application to stop is not an exception inserted by the first execution function at the end of the application compilation;
[0212] The first correction module is used to correct the application program according to the abnormality information characterizing the abnormality of the application program when the application program fails to be verified.
[0213] In some embodiments, the compilation module 120 is specifically configured to cause the first execution function to call an entry function of the application based on a reflection mechanism; and to compile the application based on the entry function.
[0214] In some embodiments, the second determination module 140 is specifically used to monitor the execution status of the application in the first operating environment; when it is monitored that the execution of the application is stopped in the first execution function in the first operating environment and at least one exception information is thrown, the exception information is read from the stack set in the submission machine; based on the read exception information, it is determined whether the cause of the application being stopped is an exception inserted by the first execution function at the end of the application compilation.
[0215] In some embodiments, the compiling module 120 is specifically configured to compile the application program based on the first execution function in the first operating environment to generate an execution process pipeline;
[0216] The device further comprises:
[0217] A fourth determination module, configured to determine that the application verification fails when the pipeline is obtained to be empty;
[0218] The second correction module is used to correct the application when the application fails to be verified.
[0219] In some embodiments, the second determination module 140 is specifically used to determine that the application verification is successful if it is determined that the reason for the application to stop is an insertion exception of the first execution function at the end of the application compilation and the pipeline is not empty.
[0220] In some embodiments, the first determination module 130 is specifically used to determine that the application verification is successful if it is determined that the reason for the application to stop is an insertion exception of the first execution function at the end of the application compilation and the pipeline is not empty.
[0221] In some embodiments, the apparatus further comprises:
[0222] A first query module is configured to query the first type of joint debugging task information;
[0223] A first task type module, used to determine a task type according to the first type of joint debugging task information;
[0224] A first configuration module, used to determine configuration parameters according to the task type;
[0225] A first dependency and operating parameter module, used to determine the dependency and operating parameters of the application according to the configuration parameters;
[0226] The creation module 110 is specifically used to create the first operating environment in the submission machine according to the dependency relationship and operating parameters of the application.
[0227] In some embodiments, the apparatus further comprises:
[0228] The second query module is used to query the verification task information of the verification;
[0229] A second task type module, used to determine the task type according to the verification task information;
[0230] A second configuration module, used to determine configuration parameters according to the task type;
[0231] Second dependency relationship and operation parameters, used for dependency relationship and operation parameters of the application program according to the configuration parameters;
[0232] The creation module 110 is used to create the first operating environment in the submission machine according to the dependency relationship and operating parameters of the application.
[0233] In some embodiments, the joint debugging module 150 is used to apply for joint debugging resources and create a second operating environment based on the dependency and the operating parameters after the application is successfully verified; and use the applied joint debugging resources to perform joint debugging on the application in the second operating environment.
[0234] The present disclosure provides a mobile terminal, including:
[0235] a memory for storing processor-executable instructions;
[0236] Processor, respectively memory connection;
[0237] The processor is configured to execute the application debugging method provided by any of the aforementioned technical solutions by executing computer executable instructions stored in the memory.
[0238] The processor may include various types of storage media, which are non-transitory computer storage media that can continue to memorize information stored thereon after the mobile terminal loses power.
[0239] The processor may be connected to the memory via a bus or the like, and is used to read the executable program stored in the memory, for example, Figure 1 , Figure 2 and Figure 4 At least one of any of the methods shown.
[0240] Figure 6 8 is a block diagram of an electronic device 800 according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, a mobile computer, etc. The electronic device may be used as the aforementioned submission machine.
[0241] Reference Figure 6 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0242] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0243] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0244] The power component 806 provides power to the various components of the electronic device 800. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
[0245] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating state, such as a shooting state or a video state, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0246] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating state, such as a call state, a recording state, and a voice recognition state, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0247] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0248] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0249] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0250] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0251] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the above instructions can be executed by the processor 820 of the electronic device 800 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0252] The present disclosure provides a non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by a processor, the electronic device can execute any of the above embodiments to provide an application debugging method, which can execute the following steps: Figure 1 , Figure 2 and Figure 4 At least one of any of the methods shown.
[0253] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0254] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for debugging an application, characterized in that: include: Creating a first operating environment in the submitting machine, wherein a first execution function is called in the first operating environment, and the first execution function is: inserting an execution function that terminates execution and throws an exception at the end of the application compilation; Compiling the application based on the first execution function in the first operating environment; When the first execution function stops the execution of the application due to an exception, determining, according to the exception information generated by the exception thrown by the application, whether the cause of stopping the application is an exception inserted by the first execution function at the end of the application compilation; If it is determined that the cause of the application stopping is an insertion exception of the first execution function at the end of the application compilation, then determining that the application verification is successful; After the application is successfully verified, the application is jointly debugged based on the second operating environment, wherein a second execution function is called in the second operating environment, and wherein the second execution function submits the compilation result of the application to the target cluster after the application is compiled.
2. The method according to claim 1, characterized in that The method further comprises: If it is determined that the reason causing the application to stop is not an exception inserted by the first execution function at the end of the application compilation, determining that the application verification fails; When the application verification fails, the application is corrected according to the abnormality information characterizing the abnormality of the application.
3. The method according to claim 1 or 2, characterized in that: The compiling the application based on the first execution function in the first operating environment includes: The first execution function calls the entry function of the application based on a reflection mechanism; The application is compiled based on the entry function.
4. The method according to claim 1, wherein: When the first execution function stops the execution of the application due to an exception, determining whether the cause of stopping the application is an exception inserted by the first execution function at the end of the application compilation according to the exception information generated by the exception thrown by the application, includes: Monitoring the execution status of the application program in the first operating environment; When it is detected that the execution of the application program is stopped at the first execution function in the first operating environment and at least one exception information is thrown, the exception information is read from a stack set in the submitting machine; Based on the read exception information, it is determined whether the cause causing the application to stop is an exception inserted by the first execution function at the end of the application compilation.
5. The method according to claim 4, characterized in that The compiling the application based on the first execution function in the first operating environment includes: Compiling the application based on the first execution function in the first operating environment to generate an execution process pipeline; The method further comprises: When the pipeline is found to be empty, it is determined that the application verification fails; When the application fails verification, the application is corrected.
6. The method according to claim 5, characterized in that If it is determined that the cause causing the application to stop is an insertion exception of the first execution function at the end of the application compilation, determining that the application verification is successful includes: If it is determined that the reason for stopping the application is an insertion exception of the first execution function at the end of the application compilation and the pipeline is not empty, it is determined that the application verification is successful.
7. The method according to claim 1, characterized in that The method further comprises: Query the first type of joint debugging task information; Determine the task type according to the first type of joint debugging task information; Determine configuration parameters according to the task type; Determining the dependencies and operating parameters of the application program according to the configuration parameters; The step of creating a first operating environment in the submitting machine includes: The first operating environment is created in the submission machine according to the dependency relationship and operating parameters of the application.
8. The method according to claim 1, characterized in that The method further comprises: Query the verification task information of the verification; Determine the task type according to the verification task information; Determine configuration parameters according to the task type; Determining the dependencies and operating parameters of the application program according to the configuration parameters; The step of creating a first operating environment in the submitting machine includes: The first operating environment is created in the submission machine according to the dependency relationship and operating parameters of the application.
9. The method according to claim 7 or 8, characterized in that: After the application program is successfully verified, joint debugging of the application program based on the second operating environment includes: After the application program is successfully verified, applying for joint debugging resources and creating a second operating environment according to the dependency relationship and the operating parameters; The application is jointly debugged using the applied joint debugging resources in the second operating environment.
10. An application debugging device, characterized in that: include: A creation module is used to create a first operating environment in the submitting machine, wherein a first execution function is called in the first operating environment, and the first execution function is: an execution function that terminates execution and throws an exception is inserted at the end of the application compilation; A compiling module, configured to compile the application program based on the first execution function in the first operating environment; A first determination module is used to determine, when the first execution function stops the execution of the application program due to an exception, whether the cause of stopping the application program is an exception inserted by the first execution function at the end of the application program compilation according to the exception information generated by the exception thrown by the application program; A second determination module, configured to determine that verification of the application is successful if it is determined that the cause of stopping the application is an insertion exception of the first execution function at the end of application compilation; The joint debugging module is used to perform joint debugging of the application based on the second operating environment after the application is successfully verified, wherein the second execution function is called in the second operating environment, and wherein the second execution function submits the compilation result of the application to the target cluster after the application is compiled.
11. The device according to claim 10, characterized in that The device also includes: a third determination module, configured to determine that the application verification fails if it is determined that the reason causing the application to stop is not an exception inserted by the first execution function at the end of the application compilation; The first correction module is used to correct the application program according to the abnormality information characterizing the abnormality of the application program when the application program fails to be verified.
12. The device according to claim 10 or 11, characterized in that The compilation module is specifically used for the first execution function to call the entry function of the application based on the reflection mechanism; and compile the application based on the entry function.
13. The device according to claim 10, wherein: The second determination module is specifically used to monitor the execution status of the application in the first operating environment; when it is monitored that the execution of the application is stopped in the first execution function in the first operating environment and at least one exception information is thrown, read the exception information from the stack set in the submission machine; Based on the read exception information, it is determined whether the cause causing the application to stop is an exception inserted by the first execution function at the end of the application compilation.
14. The device according to claim 13, characterized in that The compiling module is specifically used to compile the application program based on the first execution function in the first operating environment to generate an execution process pipeline; The device further comprises: A fourth determination module, configured to determine that the application verification fails when the pipeline is obtained to be empty; The second correction module is used to correct the application when the application fails to be verified.
15. The device according to claim 14, characterized in that The second determination module is specifically used to determine that the application verification is successful if it is determined that the reason for the application to stop is an insertion exception of the first execution function at the end of the application compilation and the pipeline is not empty.
16. An electronic device, characterized in that: include: a memory for storing processor-executable instructions; A processor connected to the memory; The processor is configured to execute the application debugging method provided in any one of claims 1 to 9.
17. A non-transitory computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the application debugging method provided in any one of claims 1 to 9.
Citation Information
Patent Citations
Method for debugging operational software of a system onboard an aircraft and device for implementing the same
CN101802794A
Dynamic and static combined Java program exception handling and optimization method
CN102117228A