9 Replies Latest reply on Nov 16, 2017 6:42 AM by Jonathan Drummey

    Multiple VizAlerts Subscription Help

    Kevin White

      Hello,

       

      I'm currently using VizAlerts to send out an advanced alert every Sunday at 7:00pm. I set the Windows task and the vizalerts subscription to both run at 7:00pm and the alerts run perfectly.

       

      However I now have an ask to run an alert based on the completion of a job that runs in our system. The job doesnt complete at the exact same time everyday, somedays it may complete at 7:11am other days at 7:25am but typically it will finish before 9:00am. I can create a batch file that will trigger the vizalerts python script and schedule this batch file to wait for the completion of the job but I'm not sure how I should setup the subscription so that when the python script batch file runs it doesnt miss picking up the alert.

       

      Any suggestions?

       

      Thanks!

        • 1. Re: Multiple VizAlerts Subscription Help
          Matt Coles

          Hey Kevin. "Working perfectly"! That's what I like to hear.

           

          With regards to your question, there are multiple ways to solve this problem. But first, before we get to those, I have to point out some fundamental things about how VizAlerts is designed:

           

          1. The Windows Task runs all the time (every minute). It determines when VizAlerts checks for when you VizAlerts Tableau Server schedules should be run.

          2. The VizAlerts subscription schedules in Tableau Server determine when the alerts associated with them should be *checked* for an alert condition.

          3. The alert condition itself is then defined by whether any data exists in your viz, and if you're using 2.1.0, if the Email Action calc evaluates to "1".

           

           

          So, your Windows task should really not be set to run only once daily. While it may work fine for your one-off report alert, doing so can yield unexpected results with other functionality we've built in. For example, testing your alert via comments won't work, and running multiple Alerts at different times won't either. VizAlerts is designed to be run every minute. It may seem like it's too much, but the impact to Tableau Server should be very minor. It should certainly run at least every five minutes. Scheduling of the alerts should be done with Tableau Server schedules, not with the Windows Task schedule.

           

          So, for your alert that you want to run when your job completes. Is this the only condition for the email going out? Meaning, is the ask to basically just have a report that goes out right after the data job completes? Or, is there a condition beyond just the job completing, such as a threshold condition that you want to have checked just after the job is done? I'll provide answers for both situations.

           

          I just want to send a report when the data is ready each day.

           

          Option 1: Create a VizAlerts subscription schedule in Tableau Server that is set to run every fifteen minutes. If you know that the data job will always finish between 7am and 9am, you can restrict your schedule to run between those times when you create it. Use Tableau to connect to a source of data that provides a datetime value as to when the job completed. This would be an audit table or log file. Use this calc to detect whether or not the job completed within the previous 15-minute window, and either add that to the filter shelf as True, or build it into your Email Action calc logic, if you're using 2.1.0. Now, just add the appropriate Action Fields to the viz to define what report should be sent, to who, and what vizzes it should contain in it. Subscribe that viz to the 15-minute schedule that you created, and you are now good to go.

           

          Option 2: If you're using v2.1.0, and the workbook has an extract that is being refreshed when the job you spoke of completing, then the solution is even easier--just subscribe your VizAlert to a schedule designed for that purpose ( see the bottom of this section of the install guide for details on this feature )

           

           

          I want to make sure the data my report uses is ready to go, AND I want to trigger an alert only when some condition applies to the new data.

           

          You can use either Option 1 or Option 2 above for this, with the additional change that you'll still need to build in your alert criteria to either your Filter shelf, or if you're using v2.1.0, to the Email Action calc logic. Both criteria (report data ready AND alert condition satisfied) would have to apply for the email to go out.

           

           

           

           

           

           

          Option 1: Create a VizAlerts subscription schedule in Tableau Server that is set to run every fifteen minutes. If you know that the data job will always finish between 7am and 9am, you can restrict your schedule to run between those times when you create it. Use Tableau to connect to a source of data that provides a datetime value as to when the job completed. This would be an audit table or log file. Use this calc to detect whether or not the job completed within the previous 15-minute window, and either add that to the filter shelf as True, or build it into your Email Action calc logic, if you're using 2.1.0. Now, just add the appropriate Action Fields to the viz to define what report should be sent, to who, and what vizzes it should contain in it. Subscribe that viz to the 15-minute schedule that you created, and you are now good to go.
          Option 2: If you're using v2.1.0, and the workbook has an extract that is being refreshed when the job you spoke of completing, then the solution is even easier--just subscribe your VizAlert to a schedule designed for that purpose ( see the bottom of this section for this feature: https://github.com/tableau/VizAlerts/blob/master/docs/install_guide.md#custom-subscription-schedules )

          I want to make sure the data my report uses is ready to go, AND I want to trigger an alert only when some condition applies to the new data.
          You can use either Option 1 or Option 2 above for this, with the additional change that you'll still need to build in your alert criteria to either your Filter shelf, or if you're using v2.1.0, to the Email Action calc logic. Both criteria (report data ready AND alert condition satisfied) would have to apply for the email to go out.

          • 2. Re: Multiple VizAlerts Subscription Help
            Kevin White

            Matt,

             

            Thanks for the quick response.  I have a few more questions/comments before I try to set this up.

             

            1. There should only be one Windows task that runs the script and is setup to run essentially 24/7 but most of the checks dont do anything. Correct?

            2. Setting up and scheduling the data source as an Extract is 100% essential to triggering the alert of the refresh success? Live connections wont work?

            3. How do I know which Vizalerts version I have installed?

            4.If I do have the latest version installed I can just setup the Subscription schedule with the Refresh Success naming convention and vizalerts will somehow know when the refresh completes and I dont have to setup some sort of filter in the workbook?

            5. If I want to use the refresh success subscription is it limited to only working for one extract in the workbook? So if one extract refreshes and the another refreshes 5 minutes later will it send the alert before the second refreshes or will it wait for all extracts to refresh in the workbook?

             

            Thanks again for your help!

            • 3. Re: Multiple VizAlerts Subscription Help
              Matt Coles

              1. Exactly, yes. Just looking for some actual work to do each time.

              2. No, it's not. You could also connect directly to the Tableau Server PostgreSQL repository database, and trigger your alert off direct information about when your extract refreshed. I'd point you to the TS Background Tasks data source to save you some time, if you want to go that route.

              3. Fire off the vizalerts.py script, and the first line of output will tell you the version. You can also check the logs, as the same output is added there.

              4. Yes, exactly--assuming you don't have any criteria for sending the email, other than your data being ready to go. This only works if the extract being refreshed is local to the workbook your alert is on, though (i.e., can't trigger based on the extract refresh for a published data source completing).

              5. To Tableau Server, refreshing all the extracts in a single workbook is a single Background Task. So it isn't "complete" until all the extracts in the workbook are complete. It's all or nothing.

              • 4. Re: Multiple VizAlerts Subscription Help
                Kevin White

                Hey Matt,

                 

                We resolved this issue and everything seems to be working fine now!

                 

                On a different note, is it possible to merge pdf's automatically in portrait or landscape or does the pdf only represent how the dashboard itself is positioned. So if the dashboard is in portrait mode it can only generate PDF's in portrait mode and vice versa?

                 

                Thanks!

                • 5. Re: Multiple VizAlerts Subscription Help
                  Matt Coles

                  Glad to hear it! Can I ask, what was your solution?

                   

                  I don't do any printing of dashboards to PDF, myself, so I'm not the best person to ask your question to. My understanding is that there's no way to customize the print orientation for a dashboard dynamically--I think you're stuck with what the orientation was set to when it was published. Jonathan Drummey may have some ideas though.

                  • 6. Re: Multiple VizAlerts Subscription Help
                    Jonathan Drummey

                    The Page Setup option sets the default layout of the dashboard. When merging PDFs from multiple dashboards VizAlerts will retain the layout of each so you can have landscape & portrait in the same view. If you want to override, that, tho, then you’re out of luck in the current VizAlerts. The way VizAlerts presently downloads views doesn’t give us any control over that. There are options using tabcmd export to get that kind of control along with changing page size on the fly.

                     

                    Jonathan

                    • 7. Re: Multiple VizAlerts Subscription Help
                      Kevin White

                      Thanks for the responses. I had a feeling this was going to be something that is difficult to develop a workaround for. Is it possible to change the sizing of the images that are in the PDFs? I think it would solve the main issue if we could maybe make those a little bigger or possibly append the inline png image but keep the same sizing as whats in the dashboard.

                       

                      Thanks again!

                      • 8. Re: Multiple VizAlerts Subscription Help
                        Kevin White

                        Jonathan,

                         

                        I'm going down the tabcmd route and I'm able to export the pdf's in all of the formats I need but I'm a little stuck on how to integrate the tabcmd into the actual vizalerts config file. I'm referencing the github article but I feel like I need a little more guidance.

                         

                        Is there another article available that has the steps laid out in more detail?

                         

                        Thanks!

                        • 9. Re: Multiple VizAlerts Subscription Help
                          Jonathan Drummey

                          I'm sorry I wasn't more clear, tabcmd is separate from VizAlerts, so there are three options:

                           

                          1) Do your own scheduling.

                          2) If you are handy with Python or know someone who is you could edit the requests.get() call in the export_view() function in .../vizalert/tabhttp.py to call tabcmd instead. If you're really into it and want to contribute code to the VizAlerts project that would be welcome!

                          3) Last year Bryant Howell created GitHub - bryantbhowell/Behold--Emailer: A Windows application for e-mailing PDFs generated from tabcmd to Tableau Server… which is similar to VizAlerts but explicitly uses tabcmd. I'm not sure of the present status, maybe Bryant can chime in?

                           

                          Cheers,

                           

                          Jonathan