About Scheduling Queries

How Does the Scheduling Feature Work?

When you have a query open on the workspace, you can click Schedule query to schedule the query. When you schedule a query, SAS Visual Data Builder performs the following operations:
  1. creates a job that performs the query operations
  2. creates a deployed job from the job
  3. places the job into a new deployed flow
  4. schedules the flow on a scheduling server
You can also use SAS Visual Data Builder to reschedule the query based on specified conditions (for example, run immediately or run whenever a trigger condition is met).
The job, deployed job, and deployed flow are metadata objects. The application stores them in the same metadata folder with the query. The objects are named according to the following pattern:
vdb_query_id_timestamp

Editing Queries That Are Already Scheduled

If you edit a query that is already scheduled, you must click Schedule again so that the SAS statements for the query are regenerated and saved.

Caution About Scheduling Queries to Run Now

When you schedule a query, one of the choices for configuring the schedule is to run the query immediately. You can use this option by selecting Run now on the Schedule window.
Be aware that performing the following steps results in an error condition:
  1. Use a SAS data set for the output table of the query.
  2. Run the query.
  3. Open the Results view to look at the output.
  4. Schedule the query and choose Run now.
The previous sequence of steps results in an error because SAS opens a lock when a SAS data set is opened for reading. When step 3 is performed, the output table is locked an no other process can overwrite the output table. The following message is included in the SAS log:
Locked Data Set Error Message
ERROR: A lock is not available for OUTPUTTABLE.
ERROR: Lock held by process xxxx.
You can avoid receiving the error message. If you want to schedule the query to run now, close the query, open it again, and then schedule it to run now. Alternatively, you can schedule the query to run in the future and close the query.

Scheduling Preferences

Default Scheduling Server

You can specify a different scheduling server in your application preferences. Any queries that you schedule after the change are set to use the scheduling server that you specify.
Use the Server Manager plug-in to SAS Management Console to identify the scheduling servers that are included in your deployment. By default, your deployment includes a server that is named Operating System Services - hostname.example.com. This server is used as the default server.
The SAS Distributed In-Process Services Scheduling Server is an alternative server. To use this server, change the scheduling server preference. The default name is SAS Distributed In-Process Services Scheduling Server.
Some deployments include Platform Suite for SAS. To use this server, change the scheduling server preference. The default name is Platform Process Manager.
In all cases, when you schedule a new query, the SAS Visual Data Builder retrieves your default scheduling server preference and uses that value to look up the scheduling server in SAS metadata. The application uses the first server that matches the pattern. Including the host name, such as Operating System Services — hostname.example.com ensures that the application uses the server that you specify.

Default Batch Server

You can specify a different batch server in your application preferences. Understand the following considerations before you change the default batch server:
  • The batch server must be registered in metadata as a component of a SAS Application Server that you can access.
  • You must specify the same SAS Application Server as your default application server in your preferences.
As with the default scheduling server, SAS Visual Data Builder retrieves the value for the default batch server preference the first time you schedule the query. The application uses the value as a pattern and uses the first server that matches the pattern.

Default Deployment Directory

A deployment directory is a SAS metadata object that represents the following items:
  • the name of the SAS Application Server with which the directory is associated (default value: SASApp)
  • a name for the directory (default value: Batch Jobs)
  • the path to the directory (default value: SAS-config-dir/Lev1/SASApp/SASEnvironment/SASCode/Jobs)
When you schedule a query, the SAS statements for the query are saved in a file. The file is saved at the path that is associated with the deployment directory. The file is named according to the same pattern that is described in How Does the Scheduling Feature Work?.
SAS Visual Data Builder retrieves your deployment directory preference and uses that value to look up the deployment directory in SAS metadata. The application uses the first directory that matches the pattern.
You can specify a different name for the default deployment directory preference. For more information about deployment directories and using the Schedule Manager plug-in to SAS Management Console, see Scheduling in SAS.

When Are the Scheduling Preferences Used?

Any of the preferences that you change are used the next time you create a query and schedule it. If you edit an existing query that is already scheduled, the existing settings for scheduling server, batch server, and deployment directory are not updated with the new preferences. To change the setting for queries that are already scheduled, use SAS Management Console to redeploy the deployed job for the query.