Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Digvijay_Singh

Qlik Sense Script failed due to REST API connection failure while monitoring nprinting tasks run

Hi,

I have experienced intermittent failing of nPrinting Get connector. (Error message at the bottom of below script.)

Has anyone seen this while monitoring nprinting tasks via Qlik Sense script?

In the excerpt of script below you can see, it works successfully almost all the time as I am calling API every 30 sec to check the task status, it failed once only may be after 100 successful attempts.

***************************

 2020-06-10 16:28:50 0133 Loop
2020-06-10 16:28:50 0076 LIB CONNECT TO 'Generic_nPrinting_GET_Connector'
2020-06-10 16:28:52 Connected.
2020-06-10 16:28:52 0078 RestNPExecutionsTable:
2020-06-10 16:28:52 0079 SQL SELECT
2020-06-10 16:28:52 0080 "id",
2020-06-10 16:28:52 0081 "result",
2020-06-10 16:28:52 0082 "progress",
2020-06-10 16:28:52 0083 "status",
2020-06-10 16:28:52 0084 "completed"
2020-06-10 16:28:52 0085 FROM
2020-06-10 16:28:52 0086 JSON (wrap off) "data"
2020-06-10 16:28:52 0087 WITH
2020-06-10 16:28:52 0088 CONNECTION( URL "Server Name/api/v1/tasks/37c410fb-108e-4018-9949-f7ca306de237/executions/b2856ead-45bf-466d-931b-75654350be10", HTTPHEADER "cookie" "NPWEBCONSOLE_SESSION=6667fa54a9b17012e3eca53518dd55e26fe0f4f4-%00_TS%3Asession%00%00userid%3A8457c0dba3af4133a937ae8af3a05374%00%00userlogin%3A2020-03-18T19%3A19%3A34.1370931Z%00%00NPWEBCONSOLE_XSRF-TOKEN%3Arsxu7ztK3Ei7IMVdSLLDP1%2BhboS4q9U9odsZ2Vj4QlQ%3D%00; ")
2020-06-10 16:28:52 6 fields found: id, result, progress, status, completed, __extra_,
2020-06-10 16:28:52 1 lines fetched
2020-06-10 16:28:52 0091 executions:
2020-06-10 16:28:52 0092 LOAD
2020-06-10 16:28:52 0093 id as execution_id,
2020-06-10 16:28:52 0094 result as execution_result,
2020-06-10 16:28:52 0095 progress as execution_progress,
2020-06-10 16:28:52 0096 status as execution_status,
2020-06-10 16:28:52 0097 completed as execution_completed
2020-06-10 16:28:52 0098 RESIDENT
2020-06-10 16:28:52 0099 RestNPExecutionsTable
2020-06-10 16:28:52 0100 WHERE
2020-06-10 16:28:52 0101 id='b2856ead-45bf-466d-931b-75654350be10'
2020-06-10 16:28:52 5 fields found: execution_id, execution_result, execution_progress, execution_status, execution_completed,
2020-06-10 16:28:52 1 lines fetched
2020-06-10 16:28:52 0104 DROP TABLE RestNPExecutionsTable
2020-06-10 16:28:52 0106 vExecutionResult = Peek('execution_result',0,'executions')
2020-06-10 16:28:52 0107 vExecutionProgress = Peek('execution_progress',0,'executions')
2020-06-10 16:28:52 0108 vExecutionStatus = Peek('execution_status',0,'executions')
2020-06-10 16:28:52 0109 vExecutionCompleted = Peek('execution_completed',0,'executions')
2020-06-10 16:28:52 0111 Trace Execution Result: | Execution Progress: 0 | Execution Status: Running | Execution Completed?:
2020-06-10 16:28:52 0111 Execution Result: | Execution Progress: 0 | Execution Status: Running | Execution Completed?:
2020-06-10 16:28:52 0112
2020-06-10 16:28:52 0112 Drop Table executions
2020-06-10 16:28:52 0114 IF 'Running' = 'Enqueued' OR 'Running' = 'Assigned' THEN
2020-06-10 16:28:52 0119 IF 'Running' = 'Completed' THEN
2020-06-10 16:28:52 0130 Sleep 30000
2020-06-10 16:29:22 0131 ENDIF
2020-06-10 16:29:22 0133 Loop


2020-06-10 16:29:22 0076 LIB CONNECT TO 'Generic_nPrinting_GET_Connector'
2020-06-10 16:29:23 Error: Failed to start connector: QvRestConnector.exe (System error: Access is denied.)
2020-06-10 16:29:23 Execution Failed
2020-06-10 16:29:23 Execution finished.

******************

@Lech_Miszkiewicz 

@JonnyPoole 

@Frank_S 

Thanks in advance!

DJ,

2 Solutions

Accepted Solutions
JonnyPoole
Employee
Employee

i've heard a report or two of this . 

I'll make some inquiries for more ideas but suppressing the error and adding a retry may help . If it fails on one or more retries you could exit the script with an error.   

https://community.qlik.com/t5/Qlik-NPrinting-Discussions/Error-Unable-to-connect-for-result-set-NPri...

Any other information about whether this just cropped up or started happening after a change , like an upgrade would help.

 

View solution in original post

Digvijay_Singh
Author

Thanks so much @Lech_Miszkiewicz  I have used your script from the blog but in the process of making it simpler I removed the retry logic, I am sure that will help in my situation.

Thanks,

DJ

View solution in original post

7 Replies
Frank_S
Support
Support

Hi @Digvijay_Singh 

Check the following summarized setup requirements.

Permission denied 'may' be due to the domain user account you are inserting in your rest connection is not associated to any NPrinting user account. The user account must also be an 'active' domain user and an 'active' NPrinting user account.

https://support.qlik.com/articles/000059611

hope this helps...

 

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Digvijay_Singh
Author

Thanks for the response @Frank_S , I am sorry if I couldn't explain it properly, You may remember from our last call that I trigger nprinting tasks from Qlik sense script on some scheduled days in a month.

The whole integration between nprinting and QlikSense works perfectly fine almost all the time, occasionally I see this error, (2nd time today in last 3 months) that means User set up in REST connection and in nprinting is perfectly fine. I use service account in my REST connector and the same is available as Nprinting user account.

Each of my task normally takes around 80-90 minutes to finish, during then after every 30 secs I check the task status using REST API, so the connection works perfectly fine in a loop of 30 secs  approx 99.9% of the time. I just need to know why it failed after more than 100 times of successful execution.

Hope I explained things better this time. 🙂

Thanks,

DJ

 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Just few thoughts around this:

  • Is it possible that there is another session opened via API call or Web interface using the same user when this task run
  • Do you use Enterprise or SMB NPrinting instance? if it is SMB maybe you are reaching number of "developers" (usually 2)
  • I know it is very rare and hard to debug, but if this repeats you may want to introduce call to login/authenticate/obtain cookie within that loop which checks your connection status. Just in case something closed the existing session.
  • or maybe there was a network issue?

nothing else I can think of.

cheers

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
JonnyPoole
Employee
Employee

i've heard a report or two of this . 

I'll make some inquiries for more ideas but suppressing the error and adding a retry may help . If it fails on one or more retries you could exit the script with an error.   

https://community.qlik.com/t5/Qlik-NPrinting-Discussions/Error-Unable-to-connect-for-result-set-NPri...

Any other information about whether this just cropped up or started happening after a change , like an upgrade would help.

 

Digvijay_Singh
Author

Thanks so much! @JonnyPoole , As Lech suggested I will apply retry logic, I feel that should be the best option in my situation, we have not upgraded for a long time ( Still on nprinting Sep 2018 version )so I know it could be one of the reason in the background.

 

Thanks,

DJ

Digvijay_Singh
Author

Thanks so much @Lech_Miszkiewicz  I have used your script from the blog but in the process of making it simpler I removed the retry logic, I am sure that will help in my situation.

Thanks,

DJ

Digvijay_Singh
Author

Hi @JonnyPoole,

I think I missed responding on the question you asked, no, nothing new has been added, no upgrade for last one and half years, I started using Lechs task monitoring script code around 3 months before with some customization. Ignored this error thinking may be a network issue happened in the background, but today I got it twice.

Thanks,