Online debugging method and device for visual development based on Flink
Technical Field
The invention relates to the technical field of big data, in particular to a method and a device for online debugging of visual development based on Flink.
Background
With the rapid development of internet company business, the generated data is also well-blown, which requires real-time platform department to provide easy-to-use, stable and efficient real-time data service for business department, so that real-time computing business based on data is gradually increased in recent years and is used by more and more on-line, such as real-time recommendation business, double eleven sales real-time large screen display business, real-time fraud-resisting business, etc.
The field of big data real-time computation is often accompanied with various complex business requirements, corresponding Flink programs are very complex, and when the business requirements are complex and the task logic amount is huge, how to perform visual online task debugging becomes an urgent task.
Disclosure of Invention
The invention aims to provide a method and a device for visualized development online debugging based on Flink, which can improve the efficiency of development and debugging of a Flink program.
In order to achieve the above object, an aspect of the present invention provides a method for online debugging of visualization development based on Flink, including:
presetting a data source file format and a service logic file format, wherein the data source comprises event time and event data;
acquiring a data source, performing format conversion according to the format of the data source file, and uploading the converted data source file to a server for storage;
constructing abstract business logic based on a business logic file format, filtering effective data source files from a server according to set conditions in the abstract business logic, and outputting simulation result files or error feedback logs after performing simulation calculation;
and debugging abstract service logic or modifying corresponding error codes on line according to the simulation result file or the error feedback log.
Preferably, the method for acquiring a data source, performing format conversion according to the data source file format, and uploading the converted data source file to the server for storage includes:
acquiring a plurality of data sources, and respectively carrying out combined conversion on event time and event data in each data source according to a data source file format to correspondingly obtain a plurality of data source files;
verifying the data source file, and positioning the data source file with an error format to prompt modification;
and packaging the data source files passing the verification and uploading the data source files to a server for storage.
Preferably, the method for constructing an abstract service logic based on a service logic file format, filtering an effective data source file from a server according to a set condition in the abstract service logic, and outputting a simulation result file or an error feedback log after performing simulation calculation includes:
configuring a uniform debugging environment, and acquiring all required data source files from a server;
visually selecting or editing abstract business logic based on a business logic file format to generate an abstract business logic file, wherein the abstract business logic file is provided with a plurality of calculation conditions or business conditions;
and filtering effective data source files from all required data source files according to the calculation conditions or the service conditions, executing simulation calculation at event time to generate a debugging result, outputting an error feedback log when the debugging result fails, and outputting a simulation result file when the debugging result succeeds.
Preferably, the method for debugging abstract business logic or modifying corresponding error codes on line according to the simulation result file or the error feedback log comprises the following steps:
when the simulation result file is output after simulation calculation, the calculation condition or the service condition set in the abstract service logic file can be adjusted reversely by referring to the simulation result file;
when the error feedback log is output after simulation calculation, the error codes in the abstract service logic file can be modified on line according to the error feedback log.
Optionally, the event time and the event data are distinguished and combined by separators, and the combined data source file is packaged in a CSV file format.
Compared with the prior art, the visualized development online debugging method based on Flink provided by the invention has the following beneficial effects:
the invention provides a method for online debugging of visualized development based on Flink, which comprises the steps of firstly presetting a data source file format and a service logic file format, wherein the data source comprises event time and event data, executing format conversion on the data source according to the preset data source file format, outputting the data source file and uploading the data source file to a server, then constructing an abstract service logic by using a Flink visualized development technology and referring to the service logic file format, executing simulation calculation on an effective data source file based on a filter condition set in the abstract service logic, when the simulation result file is output by the simulation calculation, reversely adjusting the filter condition set in the abstract service logic file by referring to a simulation result file, or when an error feedback log is output by the simulation calculation, modifying error codes in the abstract service logic file online according to the error feedback log.
In conclusion, the Flink visualization development technology can reduce the development threshold of the model task and accelerate the development efficiency, and on the basis, the invention can further improve the development efficiency by debugging the abstract business logic on line and modifying the corresponding error codes.
Another aspect of the present invention provides a Flink-based online debugging device for visual development, to which the above-mentioned technical solution is applied, the method comprising:
the format setting unit is used for presetting a data source file format and a service logic file format, wherein the data source comprises event time and event data;
the format conversion unit is used for acquiring a data source, executing format conversion according to the format of the data source file and uploading the converted data source file to the server for storage;
the processing unit is used for constructing an abstract service logic based on the service logic file format, filtering effective data source files from the server according to set conditions in the abstract service logic, executing simulation calculation and then outputting simulation result files or error feedback logs;
and the feedback output unit is used for debugging the abstract service logic on line or modifying the corresponding error code according to the simulation result file or the error feedback log.
Preferably, the format conversion unit includes:
the data acquisition module is used for acquiring a plurality of data sources, and respectively combining and converting the event time and the event data in each data source according to the data source file format to correspondingly obtain a plurality of data source files;
the data checking module is used for checking the data source file and positioning the data source file with the wrong format to prompt modification;
and the data uploading module is used for packaging and uploading the verified data source files to a server for storage.
Preferably, the processing unit includes:
the environment configuration module is used for configuring a uniform debugging environment and acquiring all required data source files from the server;
the business logic construction module is used for visually selecting or editing abstract business logic based on a business logic file format to generate an abstract business logic file, and a plurality of calculation conditions or business conditions are set in the abstract business logic file;
and the screening calculation module is used for filtering effective data source files from all required data source files according to the calculation conditions or the service conditions, executing simulation calculation at event time to generate a debugging result, outputting an error feedback log when the debugging result fails, and outputting a simulation result file when the debugging result succeeds.
Preferably, the point feedback output unit includes:
the reverse adjustment module is used for reversely adjusting the calculation conditions or the service conditions set in the abstract service logic file by referring to the simulation result file when the simulation result file is output after the simulation calculation;
and the code modification module is used for modifying the error codes in the abstract service logic file on line according to the error feedback log when the error feedback log is output after the simulation calculation.
Compared with the prior art, the beneficial effects of the visualized development online debugging device based on the Flink provided by the invention are the same as those of the visualized development online debugging method based on the Flink provided by the technical scheme, and the detailed description is omitted here.
A third aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, executes the steps of the above-mentioned Flink-based visualization development online debugging method.
Compared with the prior art, the beneficial effect of the computer-readable storage medium provided by the invention is the same as that of the visualized development online debugging method based on Flink provided by the technical scheme, and the detailed description is omitted here.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a schematic flowchart of a method for online debugging of visualization development based on Flink in the first embodiment;
fig. 2 is a logic example diagram of a visualization development online debugging method based on Flink in the first embodiment.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Referring to fig. 1, the present embodiment provides a method for online debugging of visualization development based on Flink, including:
presetting a data source file format and a service logic file format, wherein the data source comprises event time and event data; acquiring a data source, performing format conversion according to the format of the data source file, and uploading the converted data source file to a server for storage; constructing abstract business logic based on a business logic file format, filtering effective data source files from a server according to set conditions in the abstract business logic, and outputting simulation result files or error feedback logs after performing simulation calculation; and debugging abstract service logic or modifying corresponding error codes on line according to the simulation result file or the error feedback log.
In the visualized development online debugging method based on Flink provided by this embodiment, a data source file format and a service logic file format are preset first, wherein the data source comprises event time and event data, the format conversion is executed by the data source according to a preset data source file format, the data source file is output and uploaded to the server, then constructing abstract business logic by using a Flink visual development technology and referring to a business logic file format, executing simulation calculation on the effective data source file based on the filter condition set in the abstract business logic, and when the simulation calculation outputs a simulation result file, the filter conditions set in the abstract business logic file may be adjusted in reverse with reference to the simulation result file, alternatively, when the error feedback log is output by the simulation computation, the error code in the abstract business logic file can be modified online according to the error feedback log.
In summary, the Flink visualization development technology can reduce the development threshold of the model task and accelerate the development efficiency, and on the basis, the development efficiency can be further improved by debugging the abstract business logic on line and modifying the corresponding error code. In addition, compared with the existing debugging method that various Flink dependencies need to be configured, the online debugging scheme provided by the embodiment can remove the dependencies, avoid the occurrence of conflict problems, shield the difference between the debugging environment and the real environment by online debugging, and enable research and development personnel to perform task testing without perception.
Illustratively, the preset data source file format is "event time, event data", such as: "year-month-day, name, Sex, age, address", a preset service logic file format is an accumulation of a plurality of nodes, and generally includes a data source node, a filter node, a statistical node, and an output source node, where the filter node is provided with a plurality of filter conditions, such as "Sex: male, age: 20-40, address: beijing, finally calculating the number of people meeting the requirements of male, age 20-40 years and Beijing address in the data source through calculation and screening of statistical nodes, and outputting the number of people through an output source node.
It can be understood that the preset data source file format and the service logic file format are various, the embodiment does not limit the specific form thereof, and a user can autonomously set the specific form according to the service requirement in the specific implementation process.
In the above embodiment, the method for acquiring a data source, performing format conversion according to a data source file format, and uploading the converted data source file to a server for storage includes:
acquiring a plurality of data sources, and respectively carrying out combined conversion on event time and event data in each data source according to a data source file format to correspondingly obtain a plurality of data source files; verifying the data source file, and positioning the data source file with an error format to prompt modification; and packaging the data source files passing the verification and uploading the data source files to a server for storage.
In specific implementation, because the formats of the acquired multiple data sources are different, format conversion needs to be performed on the data sources according to a preset data source file format, for example, the acquired data sources "2019, 09, 25, name 1", "2019-09-22-03-25-00, name 2" and "09 month 25 in 2019 and 25 days in 2019 and name 3" are uniformly converted into data source files "2019-09-25, name 1", "2019-09-22, name 2" and "2019-09-25 and name 3" according to the preset data source file format, in order to ensure the validity of data, format verification needs to be further performed on the data source files, the data source files in an incorrect format are located, developers are prompted to modify manually, and finally the data source files passing the verification are uploaded to a packaging server for storage, for subsequent invocation. Therefore, through the application of the online debugging scheme, the data source file with the wrong format can be quickly modified, and the development process is accelerated.
Specifically, in the above embodiment, the method for constructing an abstract service logic based on a service logic file format, filtering an effective data source file from a server according to a set condition in the abstract service logic, and outputting a simulation result file or an error feedback log after performing simulation calculation includes:
configuring a uniform debugging environment, and acquiring all required data source files from a server; visually selecting or editing abstract business logic based on a business logic file format to generate an abstract business logic file, wherein the abstract business logic file is provided with a plurality of calculation conditions or business conditions; and filtering effective data source files from all required data source files according to the calculation conditions or the service conditions, executing simulation calculation at event time to generate a debugging result, outputting an error feedback log when the debugging result fails, and outputting a simulation result file when the debugging result succeeds.
When the method is concretely implemented, firstly, a uniform debugging environment is established, so that a model task developed based on a Flink visualization technology can be debugged in the environment, then all data source files required by the model task are obtained from a server, abstract business logic is constructed based on a business logic file format, wherein the construction modes comprise two modes, one mode is that nodes required by selection are directly and visually utilized from preset nodes, the other mode is that the nodes required by selection are manually edited and then used based on the selected preset nodes, abstract business logic files are correspondingly generated after the abstract business logic is constructed, the actual task logic of the model task can be reversely deduced by analyzing the abstract business logic files, finally, effective data source files and the abstract business logic files are used as input, simulation calculation is executed by taking event time as a limiting condition, and debugging results are output, for example, the method comprises the steps of inquiring the number of people of a single clothing category of a Beijing user in the double eleven whole days, wherein corresponding nodes sequentially comprise an input source node, an inquiry node, a filtering node, a counting node and an output source node under the scene, wherein the filtering node comprises a plurality of filtering conditions, for example, the number of people meeting the screening conditions is counted by the counting node, and the number of people output and counted by the output source node is counted by the counting node, wherein the corresponding conditions of a mouth field in a data source are Beijing, the corresponding conditions of a time field in the double eleven whole days are time ranges, and the corresponding conditions of a type field are clothing. The effective data source file is corresponding to 'ordering time data and ordering data of a user', the simulation result file is directly output through an output source node after debugging is successful, an error feedback log is output when debugging is failed, and the positioning of error codes in the model task is recorded in the error feedback log.
In addition, in order to expand the flexibility of the application of the online debugging scheme in this embodiment, the user may also select a local branch of the model task to debug, and the specific implementation process is not described herein again.
Specifically, the method for online debugging abstract service logic or modifying corresponding error codes according to the simulation result file or the error feedback log in the embodiment includes:
when the simulation result file is output after simulation calculation, the simulation result file can be displayed to the front end for downloading, correspondingly comprises a plurality of downloading formats, such as pages, texts, Execl and the like, and can also be used for reversely adjusting the calculation conditions or service conditions set in the abstract service logic file by referring to the simulation result file so as to obtain a more accurate simulation result file; when the error feedback log is output after the simulation calculation, the system can automatically check out the nodes containing the error codes so as to prompt a developer to modify the error codes on line according to the error feedback log.
Preferably, the event time and the event data in the above embodiments are distinguished and combined by separators, and the combined data source file is packaged in a CSV file format.
Referring to fig. 2, the implementation process may be summarized as that, a service program is written according to a specific service logic, a data source file is uploaded after writing, the data source file is in a CSV file format, the content of the data source file includes event time and event data, the data source file is analyzed by a background after triggering and debugging, and a service logic file is abstracted according to the service program, and at this time, the data source file and the service logic file are sent to a unified debugging environment. The method comprises the steps that an actual debugging process is carried out, a unified debugging environment has all data and dependence required by debugging, a system firstly creates a Flink execution environment in the debugging environment, then a task logic is generated through analysis according to a service logic file, then a program is executed through the simulated Flink environment, data are subjected to simulation calculation according to event time, an execution result is stored in a file, if the debugging is successful, the data are displayed according to the requirement, and if the debugging is failed, the system can automatically check nodes containing error codes. The method has the technical effects that a user does not need to care about the difference between the debugging environment and the online environment, a data source file is uploaded, and a result can be generated by clicking for debugging, so that the online visualization programming model of the Flink is perfected, and the problem of debugging of a service dependent time model in real-time visualization development is solved.
Example two
The embodiment provides a visualized development online debugging device based on Flink, which comprises:
the format setting unit is used for presetting a data source file format and a service logic file format, wherein the data source comprises event time and event data;
the format conversion unit is used for acquiring a data source, executing format conversion according to the format of the data source file and uploading the converted data source file to the server for storage;
the processing unit is used for constructing an abstract service logic based on the service logic file format, filtering effective data source files from the server according to set conditions in the abstract service logic, executing simulation calculation and then outputting simulation result files or error feedback logs;
and the feedback output unit is used for debugging the abstract service logic on line or modifying the corresponding error code according to the simulation result file or the error feedback log.
Preferably, the format conversion unit includes:
the data acquisition module is used for acquiring a plurality of data sources, and respectively combining and converting the event time and the event data in each data source according to the data source file format to correspondingly obtain a plurality of data source files;
the data checking module is used for checking the data source file and positioning the data source file with the wrong format to prompt modification;
and the data uploading module is used for packaging and uploading the verified data source files to a server for storage.
Preferably, the processing unit includes:
the environment configuration module is used for configuring a uniform debugging environment and acquiring all required data source files from the server;
the business logic construction module is used for visually selecting or editing abstract business logic based on a business logic file format to generate an abstract business logic file, and a plurality of calculation conditions or business conditions are set in the abstract business logic file;
and the screening calculation module is used for filtering effective data source files from all required data source files according to the calculation conditions or the service conditions, executing simulation calculation at event time to generate a debugging result, outputting an error feedback log when the debugging result fails, and outputting a simulation result file when the debugging result succeeds.
Preferably, the point feedback output unit includes:
the reverse adjustment module is used for reversely adjusting the calculation conditions or the service conditions set in the abstract service logic file by referring to the simulation result file when the simulation result file is output after the simulation calculation;
and the code modification module is used for modifying the error codes in the abstract service logic file on line according to the error feedback log when the error feedback log is output after the simulation calculation.
Compared with the prior art, the beneficial effects of the visualized development online debugging device based on Flink provided by the embodiment are the same as those of the visualized development online debugging method based on Flink provided by the embodiment, and are not repeated herein.
EXAMPLE III
The embodiment provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program executes the steps of the above-mentioned Flink-based visualization development online debugging method.
Compared with the prior art, the beneficial effect of the computer-readable storage medium provided by the embodiment is the same as that of the method for visually developing online debugging based on Flink provided by the above technical scheme, and details are not repeated here.
It will be understood by those skilled in the art that all or part of the steps in the method for implementing the invention may be implemented by hardware that is instructed to be associated with a program, the program may be stored in a computer-readable storage medium, and when the program is executed, the program includes the steps of the method of the embodiment, and the storage medium may be: ROM/RAM, magnetic disks, optical disks, memory cards, and the like.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.