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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tFileExist not waiting for tSSH to complete

Our client recently started using CloudFlare protection and it blocked the use of tFileFetch. I am able to work around this by using cURL in a tSSH component.

I am iterating through a file list and passing the file names in the form of a variable to a tSSH component to do the curl to download the files from a website and then I use tFileExist to check that the file downloaded successfully to populate another variable which serves as a flag to let my job know when all required files are downloaded.

 

What I get is that the tFileExist component is not waiting until the file is done downloading before executing. I have tried fix this by adding a IF condition which checks the exit code of the tSSH ( ((Integer)globalMap.get("tSSH_2_EXIT_CODE")) == 0 ) but this does not help. 

 

I think what might be happening is that the tSSH is sending the success code before finishing the file download.

 

How can I handle this? Any help would be much appreciated.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hmmmm, this looks like the terminal response is indicating the command has finished while the file is still downloading. A good way of resolving this would be to add a tLoop with your tFileExist component. Set a globalMap variable of "found" to be set to false. Set the tLoop's logic to fire while "found" is false. When the tFileExist returns true, set "found" to be true. 

 

Essentially the flow after the tSSH would be .....

 

tJava (to set the boolean "found" globalMap)

|

(iterate link)

|

tLoop (with a while loop based on the "found" variable)

|

(iterate link)

|

tFileExist

|

(run if link based on the tFileExist result)

|

tJava (to set "found" to true)

 

Then you would trigger the rest of the code from the tLoop.

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Can you post a screenshot of your job?

Anonymous
Not applicable
Author

Here is the relevant part of the job. If I put in a sleep component instead of the selected IF then the Check happens as expected after the file is done. But if a very large file or slow internet causes it to not finish the download then it will obviously fail.

0683p000009M6qS.png

Anonymous
Not applicable
Author

Hmmmm, this looks like the terminal response is indicating the command has finished while the file is still downloading. A good way of resolving this would be to add a tLoop with your tFileExist component. Set a globalMap variable of "found" to be set to false. Set the tLoop's logic to fire while "found" is false. When the tFileExist returns true, set "found" to be true. 

 

Essentially the flow after the tSSH would be .....

 

tJava (to set the boolean "found" globalMap)

|

(iterate link)

|

tLoop (with a while loop based on the "found" variable)

|

(iterate link)

|

tFileExist

|

(run if link based on the tFileExist result)

|

tJava (to set "found" to true)

 

Then you would trigger the rest of the code from the tLoop.

Anonymous
Not applicable
Author

Thank you for your suggestion. I will try and see if it works!