Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Sanjay5
Contributor III
Contributor III

How to include a file in Project Resource

Hi,

 

I want to include a file which i am referring in my Talend Job. 

I created a talend Routine which uses a file, I have loaded the file to routine along with jar file.

Now when i run the job in Local mode, Job is able to fetch the data from file, but when i run in job Server, It does not get the file.

 

help needed to resolve the issue

How to include the file in my project resources for remote run?

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Generally Routines require static methods.  Hence, yes, you can pass the path of the file to your routines. It can be an extra parameter to your routine method, which is the path of the file, that you pass when calling the routine.

If you call the routine frequently, you can setup a static private variable, create a method to set that variable, and call that method first thing in your job.  Then every other routine methods can refer to the static variable which contains the path of the file.  And then you load it as usual in your routine.

 

You will need a folder on your jobserver or on a shared drive (locked down so that only the job can access it if the content needs to be secured) where you will put this file.

View solution in original post

12 Replies
Anonymous
Not applicable

Hi
It does not support relative file path. You can have a shared directory (through NFS or SMB mount) to have all necessary files accessible for all servers where your job runs.

Regards
Shong
Sanjay5
Contributor III
Contributor III
Author

Hi Shong,

 

How to point my job to look for the files which are needed for Project Resource?

 

In other words, How my job will understand the location of the file.

Sanjay5
Contributor III
Contributor III
Author

Please find attached email for detailed explanation on what is the issue i am trying to resolve


Question on Project Resource location for Talend Job.zip
vapukov
Master II
Master II

You can change path to files for context variables

 

Spoiler
context.path_to_files+"/file_name1.csv"
context.path_to_files+"/file_name2.xls"

and etc

 

with implicit context loading it allow refer to different path on different servers

Sanjay5
Contributor III
Contributor III
Author

Thanks for the information.

 

I am not looking to share the files between different servers.

 

I want to access a file which is located in Java Project Resource folder. (Same as Eclipse)

See my attached screenshot. (File Name is vmkeys.xml)

 

I want to access this file when i run the job in JobServer. Not sure where should i keep the file.

 


Eclipse Screen shot.png
Question on Project Resource location for Talend Job.zip
Anonymous
Not applicable

This functionality exists for ESB services since we have resources there.  In DI, it doesn't.  You will need to put the file somewhere on disk on your jobserver, and read the file as the first operation of your job.

vapukov
Master II
Master II

I also mean - not share file between servers, but have unique location for same file on different environment

for example - when Dev machine windows, and Prod Server Linux it is hard to have same PATH to resources

and context variables - help to resolve this

 

 

Sanjay5
Contributor III
Contributor III
Author

My Java code routine in the job automatically searches for the file "vmkeys.xml" in project resources folder:

I.e. C:\Talend\workspace\.Java\src\main\resources

 

In my local workspace file is located under below path

C:\Talend\workspace\.Java\src\main\resources\vmkeys.xml

I do not have to specifically change anything in my job to read data from this file, for local run.

 

 

Now for remote run, If i keep the file in job server in below location

/ABC/vmkeys.xml

I am not sure how i change my job to look for this file in any other location in job server:

I am not sure how to make this work, I believe in Eclipse as well files are read from "Project Resources" folder.

 

Any suggestions would be really helpful.

 

 

vapukov
Master II
Master II

what is the problem with context variables?

 

0683p000009LvBD.png0683p000009LvZr.png

 

no one fixed value, in properties:

0683p000009LvVg.png

 

and csv file on each machine:

 

0683p000009LvYz.png

 

that all
when Job start, it read OS variable, it it not NULL - take config file from there, if not from default (for me) place

Configuration could be changed without re-build the Job