Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to check the flag file from S3 folder

Hi Everyone,

 

I have a scenario in which i am running a job from Talend which is pulling all the files from AWS S3 folder.But before doing so ,i need to check if the Flag file is present there then only i can proceed.

Suppose ,I have files like this:

 

File_trigger.Flag

abc.csv

bcd.csv

efg.csv

 

If the file_trigger.flag is present on AWS S3 then only my job starts pulling the files abc.csv ,bcd.csv etc...

 

I have made my job which is pulling all the files from S3 but now this is a new scenrio. Could you please let me know how to proceed with that?

 

Regards,

Mohit

Labels (3)
7 Replies
vapukov
Master II
Master II

you could install aws cli commandline client, and setup it

 

after use tSystm with command 

 aws s3 ls s3://bucket/File_trigger.Flag

 

tSystem will return 0 if file exists, and 1 if not, use it in tRunIf trigger as value

((Integer)globalMap.get("tSystem_1_EXIT_VALUE"))>0
Anonymous
Not applicable
Author

Hi Vapukov,

 

AWS CLI command line is installed already.

Still i need to connect to AWS before using tsystem command.I know the connection and other things.

But How tsystem will fetch AWS connection details and trigger the above command from Talend.

 

regards,

Mohit

vapukov
Master II
Master II

if you have installed aws-cli, you know - it self-contained, it do not need anything for work, you must configure it separate

 

so in you job:

preJob - connection

Job:

- tSystem

- and after RunIf all other

Anonymous
Not applicable
Author

Thanks,I will try it 0683p000009MACn.png

Anonymous
Not applicable
Author

Hi,

 

    Below is another solution for your query. I have setup two sample files in S3 for testing.

0683p000009M1F6.png

 Below is the output of the flow with only flag file as output.

0683p000009M1Mu.png

 

 

Below are the details of each components. I have added tLogrow components for printing and you can remove them in actual code.

0683p000009M1Mz.png

 

0683p000009M1N4.png

 

0683p000009M1Ip.png

 

 

Both approaches provide same result but one is employing command line method and other through GUI. 

 

If the reply has helped you, could you please mark the topic as resolved? Kudos are also welcome 🙂

 

Warm Regards,

 

Nikhil Thampi

 

vapukov
Master II
Master II

I exclude this variant because as is it requires double reading for all files (as on picture) and with 1000 files it could be long

 

 

but, if using the full Flag file name as a Key prefix in tS3List - it could reduce the number of iteration to 1

unfortunately, right now I have not S3 access and cannot test it, but it could be a best choice if work

Anonymous
Not applicable
Author

@vapukov - Perfect idea !

 

I added the flag file name in the Key prefix and it reduced the number of iterations to 1.

 

0683p000009M1N9.png

 

 

The modified job flow is as below.

 

0683p000009M1NE.pngJob Output

 

 

Warm Regards,

 

Nikhil Thampi