Are there any component that can support us lock a file or check if that file is open?
We don't have such component as you mentioned. As we known that Talend is a code generator ETL which use JAVA as the underline technology generated to perform the Data Extraction, Transformation and Loading.
Hi
Thanks for reply,
I'm having problem with file locking. I must run 2 parallel subjob which will access the same file. If subjob 1 run first then subjob 2 will be pause; and if subjob 2 run first, subjob 1 must be pause.
Thus, at each subjob, I must check if the file is opened by another or not.
And because there aren't any supported component, I use tJava with the following code, but it's seem not right. Can u help me solve this problem? Thanks
Here is the code:
java.io.File file = new java.io.File(fileName);
java.nio.channels.FileChannel channel = new java.io.RandomAccessFile(file, "rw").getChannel();
// Get an exclusive lock on the whole file
java.nio.channels.FileLock lock = channel.lock();
try {
lock = channel.tryLock();
System.out.println("lock success");
} catch (java.nio.channels.OverlappingFileLockException e) {
System.out.println("pause");
} finally {
lock.release();
}
Hi
You can try this job design without adding any Java code to check the file status.
Parent job:
tRunJob_1
tRunJob_2
tRunJob_1: call a child job that run the processing1, uncheck the 'die on error' option on tRunJob.
tRunJob_1: call a child job that run the processing2, uncheck the 'die on error' option on tRunJob.
Open the Job view of parent job, click Extra tab, and check the 'Mutiple thread execution' option.
Hi,
The tWaitForFile is not working for ftp transfer. I have two job. One is getting a file from remote server using tFTPGet.
Other reading the file which is read from remote server. Both job running parallely.
Job 2: tWaitForFile----on subjob ok----> tFileList--- >tFileInputDelimited--->tMap--->tLogRow.
Problem here, second job is not waiting ftp to complete. I have used "Include present file" and "Wait for file to be released" option in tWaitForFile and checked but still its not working.
As i know there is no file lock component in Talend, how to resolve this problem. Anybody know how to solve it. Please let me know the solution.
Regards,
Akki
Hi,
I want to know whther there is any component for this scenario in TIS?? if yes please suggest me the component and its use. And please reply for above questions. i hope Most of people are expecting the answer for these questions.
Regards,
Akki
Hi
There is a job design problem in your job, you should use iterate instead of onSubjobOk link from tWaitForFile, eg:
tWaitForFile----iterate---> tFileList--- >tFileInputDelimited--->tMap--->tLogRow.
If you select 'continue loop' otion in the Then list, tWaitForFile keeps working forever without end.
Shong
Hi shong,
Thank you for reply shong. i have checked with iterate in tWaitForFile. But it will not wait file transfer to complete.
"tWaitForFile should wait file transfer to complete, after complete transfer only it should take transferred file".
Please help to resolve this problem. If you reply quick it will be very helpful for us.