You can expand on the functionality of SAS Visual Data Builder in SAS Visual Analytics by editing the query code, adding code for pre- and post-processing, or even writing your own query. You can process single tables or join multiple tables, writing the output to a LASR library, a SAS library, or a DBMS library. But you can also easily schedule your queries, right from the Visual Data Builder interface.
The scheduling server used is determined by the SAS Visual Data Builder Scheduling preferences setting, shown below.
By default, the Visual Analytics deployment includes the Operating System Services scheduling server, so it appears automatically as the default.
The Server Manager plug-in to SAS Management Console identifies the scheduling servers that are included in your deployment. You can specify a different scheduling server, such as Platform Suite for SAS server, if your deployment includes it.
Note: The Distributed In-process scheduling server is not supported.
Any scheduling preferences that you change are used the next time you create and schedule a query. If you need to change the settings for a query that is already scheduled, you can use SAS Management Console Schedule Manager to redeploy the deployed job for the query.
When you schedule a query, the SAS statements are saved in a file in the default deployment directory path: SAS-config-dir/Lev1/SASApp/SASEnvironment/SASCode/Jobs.
In the examples in this blog, the SAS-config-dir is /opt/sasinside/vaconfig.
The metadata name of the directory is Batch Jobs.
The default SAS Application Server name associated with the directory is SASApp.
If you are working in a VA environment where multiple application servers are defined, you should be aware of the following SAS Notes at the links below, relating to the application’s choice of application servers for scheduling.
SAS Note 58186: SAS® Visual Data Builder might use the wrong application server for scheduling
SAS Note 52977: SAS® Visual Data Builder requires the default SAS® Application Server and the default scheduling servers to be located on the same physical machine
To schedule a query, open the query and select the Schedule (clock) icon. (The clock is grayed out if you have not saved the query.)
You can schedule the query to run immediately (Run now) or at a specified time event. To define a time event, select the Select one or more triggers for this query button and click New Time Event. Grouping events are not supported for the default server, but may be supported for other scheduling servers, such as Platform Suite.
You can schedule for One time only, or More than once, running Hourly, Daily, Weekly, Monthly, or Yearly. The appearance of the interface and scheduling parameters change with your specification.
In this example, a One time only event is specified.
The time event specification gets recorded in the Trigger list on the Schedule page, and is selected in the Used column.
After you click OK in the Schedule window, you will get the confirmation below.
After the time event has passed, you can verify that the table has been loaded on the LASR Tables tab of the Visual Analytics Administrator.
When you schedule, the Visual Data Builder:
- creates a job that executes the query.
- creates a deployed job from the job.
- places the job into a new deployed flow.
- schedules the flow on a scheduling server.
The files are named according to vdb_query_id_timestamp.
In this example the files are named vdb_CustomerInfoData_1490112883364_timestamp.
When the query executes at the scheduled time, the SAS code that is written to the /opt/sasinside/vaconfig/Lev1/SASApp/SASEnvironment/SASCode/Jobs directory. The query is run with the user ID that scheduled it.
If you right-click on Server Manager in SAS Management Console and view Deployment Directories, you will see that this is the Deployment directory (Batch Jobs) for SASApp.
In the /opt/sasinside/vaconfig/Lev1/SASApp/BatchServer/Logs directory, you can view the SAS Log.
The scheduling server script and log are in /opt/sasinside/vaconfig/Lev1/SchedulingServer/Ahmed/vdb_CustomerInfoData_14900112883364
Observe that the script was written to this location at the time the job was scheduled, rather than at execution time.
If you edit a data query that is already scheduled, you must click the schedule icon again so that the SAS statements for the data query are regenerated and saved.
If you edit the query again and specify additional time events, each event appears in the trigger list, and you can check which time event is to be used for scheduling.
If scheduling a query according to time events, you should also be aware of this Usage note:
And to add to the fun, also keep in mind that if your deployment includes SAS Data Integration Studio, you can also export a query as a Job and then perform the deployment steps using DI Studio.
Just right-click on the query in the SAS folder panel in Visual Data Builder and Select Export as a Job!