When our code eventually runs as a production job, it is expected that it will be robust, reliable, and bug free. For this to happen, it will usually pass through various stages of testing, including the unit test stage performed by the developer.
This section shows some of the methods that can be used to ensure that developers can find and fix problems quickly during this testing phase.
If you would like to Enrich your career with a Talend certified professional, then visit Mindmajix - A Global online training platform: “Talend Online Training” Course. This course will help you to achieve excellence in this domain.
The ability to find and locate issues within code quickly and efficiently is the key to successful delivery of projects. Talend provides methods for debugging, and so does Eclipse.
Talend debugging instructions are as below:
Talend provides useful components for logging and capturing errors in tWarn, tDie, and tFlowMeter. It also provides mechanisms for logging information to the console, which can be a quick and valuable debugging tool, and is a vital part of the developers’ armory. It is often quicker to send and view messages and information to the log output during development than it is to do the same to say a database or files.
tLogRow
The component tLogRow allows you to write row data to the Job log file, or console window, if you’re running your Job from within Talend Studio.
If you’re running your Job from within TalenD STUDIO, remember that, writing a large volume of data to the console windows, makes Talend Studio very unresponsive.
Testing
It is obvious that the code needs to be tested, and creation of unit testing data is usually part of the developer’s responsibilities. In many cases, Talend can be utilized as part of the test data creation process to enable jobs to be properly tested.
When you begin working with Talend, you will inevitably hit compilation errors when you run a job. This recipe will show you how to easily identify the errors using Talend.
Getting ready
Open the jo_cook_ch10_0010_findCompilationErrors job.
How to accomplish it…
The steps for finding the location of compilation errors using the Problems tab is as follows:
How it works…
When Talend recognizes that there are one or more compilation errors during execution, it will populate the Problems tab with the errors. Crossing over to the Java code enables the exact lines to be located and fixed.
To fix the problems mentioned previously, replace the ] with ) in the first tMap, and change the type of yearOfBirth to Integer in the output schema of the second tMap.
There’s more…
If you follow the best practice regarding keeping changes small and executing often, then you won’t have to use this method often, because you should be aware of what changes you have made since the last successful execution.
That said, it is a very quick and easy way to find lines that have errors and very useful when you have lots of fields within a tMap or other component.
Frequently Asked TALEND Interview Questions & Answers
This recipe shows that the often complex errors returned by Java can, in the main, be located fairly easily if you know how.
Getting ready
Open the jo_cook_ch10_0020_findExecutionError job.
How to achieve it…
The steps for locating execution errors from the console output are as follows:
How it works…
It is fairly obvious from the message that the error occurred in tMap_1, but it’s not so obvious unless you know Java error messages. Unlike compilation errors, Talend does not list the error in the problems log, so a bit of combined Talend and Java understanding is required here.
In most cases, the first line of the main body of the error message will show the job and line number for the error. In our case, you will see that the first line ends with:
jo_cook_ch10_0020_findExecutionError.java:2636
There’s more…
This method is a general rule of thumb and works for many Talend errors. Sometimes, the error message occurs within a Java method for which there is no source code.
Tip
Sometimes for deployed jobs in different environments the line numbers in the errors do not match the line numbers in the Studio version of the code. It is thus a good idea when deploying the code to ensure that the source code is also deployed. The line number in the error will always match the line number in the deployed code.
Name | Dates | |
---|---|---|
Talend Training | Nov 02 to Nov 17 | View Details |
Talend Training | Nov 05 to Nov 20 | View Details |
Talend Training | Nov 09 to Nov 24 | View Details |
Talend Training | Nov 12 to Nov 27 | View Details |
Ravindra Savaram is a Technical Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.