About Scheduling Queries

How Does the Scheduling Feature Work?

When you have a query open in 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 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 data builder stores them in the same metadata folder with the query. The metadata objects are named based on 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 query 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 options is to run the query immediately. Select Run now in the Schedule window.
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. Click the Results tab to look at the output.
  4. Schedule the query by selecting Run now.
These steps result in an error condition because SAS unlocks a SAS data set when it is opened for reading. When step 3 is performed, the output table is locked, and no other process can overwrite the output table. The following message is included in the SAS log:
Locked Error Message
ERROR: A lock is not available for OUTPUTTABLE.
ERROR: Lock held by process xxxx.
You can avoid this error condition. 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 then 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 you specify a different scheduling server will use the new scheduling server.
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 scheduling server.
The SAS Distributed In-Process Services Scheduling Server is an alternative server. To use this server, change the scheduling server. The default name is SAS Distributed In-Process Services Scheduling Server.
Some deployments include the Platform Suite for SAS server. To use this server, change the scheduling server. The default name is Platform Process Manager.
In all cases, when you schedule a new query, SAS Visual Data Builder retrieves your default scheduling server, and uses that value to look up the scheduling server in SAS metadata. The data builder uses the first server that matches the value in SAS metadata. Including the host name, such as Operating System Services – hostname.example.com ensures that the data builder uses the server that you specify.

Default Batch Server

You can specify a different batch server in your application preferences. Consider the following 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 your default batch server, and uses that value to look up the batch server in SAS metadata the first time you schedule the query. The data builder uses the first server that matches the value in SAS metadata.

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 deployment directory is associated (the default value is SASApp)
  • a name for the deployment directory (the default value is Batch Jobs)
  • the path to the deployment directory (the default value is 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 in the path that is associated with the deployment directory. The file is named based on the same pattern that is described in How Does the Scheduling Feature Work?.
SAS Visual Data Builder retrieves your deployment directory, and uses that value to look up the deployment directory in SAS metadata the first time you schedule a query. The data builder uses the first server that matches the value in SAS metadata.
You can specify a different name for the default deployment directory. For more information about deployment directories and using the Server 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 the scheduling server, batch server, and deployment directory are not updated with the changes. To change the settings for existing queries that are already scheduled, use SAS Management Console to redeploy the deployed job for the query.