marcusspitzmiller / QlikSenseTask

Active - QlikSenseTask is a tool for starting Qlik Sense tasks from the command line.
24 stars 13 forks source link

Asynchronous execution not functioning #16

Closed KyleGershman closed 6 years ago

KyleGershman commented 6 years ago

Per the instructions, I omit the -wait parameter, but despite having removed the default -wait from config.txt, the default remains 600 seconds. If I put the parameter -wait:0, it has the desired effect of an asynchronous task submission, but does finish with Error Level 8. Using debug and overriding timeout to 0 will then give Error Level 4.

Ideally, it would honor the lack of the -wait parameter and consider it a successful execution even if it's simply to kick off a Task.

KyleGershman commented 6 years ago

A small edit worked for me, passing -wait:0 as a parameter: logger.Log(LogLevel.Information, "Task is starting..."); QlikSenseTaskExecutionGuid taskexecutionguid = qs.StartTaskByName(task, synchronous);

            if (timeout == 0)
            {
                logger.Log(LogLevel.Information, "Task submitted asynchronously...");
                logger.End();
                Environment.Exit(retval);
            }
marcusspitzmiller commented 6 years ago

I just added a new branch - https://github.com/eapowertools/QlikSenseTask/tree/async - where if you add -wait:0 it should come back with return code 0 automatically. i need to consider backward compatability for other people using this, so i will not change the defaults, but let me know if this works for you and i will merge it.

marcusspitzmiller commented 6 years ago

oh, we overlapped notes. i did it a little differently but the result should be the same

KyleGershman commented 6 years ago

Thanks for jumping on the message and branch so quickly. In my testing, It's giving me error level 4, which is what I got when I did make sure that a -wait:0 parameter set the timeout global to 0.

qliksensetask -proxy:"https://localhost" -task:"Test Task" -wait:0

2018_03_26_03_10_11,Information,"Task is starting..." 2018_03_26_03_10_12,Debug,"setting headers" 2018_03_26_03_10_12,Debug,"constructing query string" 2018_03_26_03_10_12,Debug,"calling https://localhost/qrs/task" 2018_03_26_03_10_12,Information,"Task finished with status: Started" 2018_03_26_03_10_12,Information,"Returning Errorlevel 4"

I totally understand that this command program may too become a series of scheduled server tasks, but my objective to rely on the Qlik logging itself so I just want to get the task kicked off and then rely on reviewing script logs within Qlik.

marcusspitzmiller commented 6 years ago

d'oh. it would help if i committed the code change. try now.

KyleGershman commented 6 years ago

Still having a challenge. I try it with the full command line so I don't rely on the config.txt (since I noticed it getting pulled in despite my original wish). I have tried with the config.txt as defaulted and I've tried it renaming the config.txt so only the command line parameters are taken.

The log does show that the wait is 0, which is good...and it still does start the task, but again, it's coming back with Error Level of 4.

marcusspitzmiller commented 6 years ago

Hi Kyle, i changed it to use your approach. Try now.

KyleGershman commented 6 years ago

Yes, that works as expected. Thanks for your rapid response and willingness to adopt. Will you merge your branches?

marcusspitzmiller commented 6 years ago

done