Using a Command Line to Deploy Jobs

Problem

You want to deploy jobs in batch mode.

Solution

You can use the command-line deployment tool. This tool enables you run an Ant script to deploy many jobs at once through a simple command-line interface. You can create a manifest file containing one or more paths and pass that file into the deployment script along with the appropriate parameters. Use other software to schedule the job for execution. For more information, see Scheduling in SAS.
Perform the following tasks:
Note: You cannot use a command line to deploy a job that resides on a z/OS system. Also, the batch deployment feature does not work when the host name contains a dash (-) character.

Tasks

Review the Prerequisites

In order to use the command-line tool to deploy jobs, you must meet the prerequisites described in Prerequisites for Deploying a Job for Scheduling. You must also gather server addresses, passwords, and other information that you will need.
For example, you should review the installation properties listed in the following table
Installation Properties
Property
Value
-InstallRoot
C:\Program Files\SASHome
-PlatformVJR
${InstallRoot}\SASVersionedJarRepository\eclipse
-WorkingDirectory
${PlatformVJR}\plugins\sas.etl.migration.batch_904000.1.0.20121105190000_v940>
-PickList
${InstallRoot}\SASDataIntegrationStudio\4.7\plugins\sas.etl.migration.batch\picklist
-SASLauncher
${PlatformVJR}\plugins\sas.launcher.jar
-DISLocation
${InstallRoot}\SASDataIntegrationStudio\4.7
Specify the following properties for the SAS Metadata Server and the SAS Application Server that will be used to deploy the job in the deploySASJobs.xml file:
Server-Specific Properties
Property
Description
The properties that follow are specified for the SAS Metadata Server:
-metaserver
IP address of the SAS Metadata Server.
-metaserverid
Metadata ID for the SAS Metadata Server.
-metaport
Port for the specified server.
-metarepository
Metadata ID for the SAS Metadata Server repository.
-metauser
A registered user of the SAS Metadata Server.
-metapass
Password for the specified user.
The properties that follow are specified for the SAS Application Server that will be used to deploy the job:
-servermachine
IP address of the SAS Workspace Server that will deploy the job.
-serverport
Port for the specified server.
-username
A registered user of the SAS Workspace Server. This user must be an external user, such as a real person. It cannot be an internal user such as the SAS Trusted User.
-password |
Password for the specified user.
-batchserver
Name of the batch server to use for deployment. The default value is the SAS DATA Step Batch Server component of the SAS Application Server.
-sourcedir
Location of the SAS source code.
-manifest
Location of the manifest file.
-deploymentdir
Fully qualified path to the job deployment directory that is specified in the Ant script. This directory also must be specified in the metadata for the SAS Application Server that is associated with the SAS Workspace Server. To view this directory, you can use the Schedule Manager module in SAS Management Console. Alternatively, an administrator can supply you with the value.

Prepare for Windows Deployment

Perform the following steps to prepare the script:
  1. Locate the deploySASJobs.xml Ant script that is deployed by default in the SASHome/SASDataIntegrationStudio/<version>/batchdeploy directory. Consider creating a copy of the file to configure so that the original retains the default settings.
  2. Open your copy of deploySASJobs.xml.
  3. Enter appropriate values for the following arguments. See Review the Prerequisites for information about appropriate values.
  4. Save the values and close the deploySASJobs.xml script.

Prepare for Other Operating System Deployments

If you want to use the command-line deployment in an operating system other than Microsoft Windows, verify that a folder called Security is installed in the installation folder for SAS Management Console. SAS Management Console must be installed on the computer where you will be running command-line deployment.
If you do not see a Security folder, then copy the <PlatformVJR>then selectpluginsthen selectsas.etl.migration.batch <version> folder from the computer where SAS Data Integration Studio is installed. Put these folders in the installation folder for SAS Management Console. After you do this, update the paths to these locations inside the deploySASJobs.xml file. See Review the Prerequisites for information about appropriate values for other operating system deployments.

Prepare the Manifest

Once you have prepared the Ant script, you must create the manifest file that lists the jobs that you want to deploy. The manifest file should be formatted as a standard text file, but name and extension do not matter. Each line of the manifest file is deployed individually. A line can specify a directory to deploy, a specific job to deploy, or a regular expression to deploy.
When you specify a directory, all of the jobs within that directory are deployed. When you specify a specific job, only the matching job is deployed (if it exists). When you specify a regular expression, any job in the given path that matches the regular expression passed in by the user is deployed. You can also deploy jobs recursively by adding the argument -r to the end of the line. When recursion is enabled, all subdirectories of the given directory are deployed in the same manner as the given directory.
Perform the following steps to prepare the manifest:
  1. Create a new text file to contain the manifest and save in the location specified in the deployment script file. Note that you can also modify one of the sample manifest files provided in the SASHomethen selectSASDataIntegrationStudiothen select<version>then selectbatchdeploy directory.
  2. Enter the information about the jobs that you want to deploy. For example, samplemanifest2 contains the following information:
    /SampleFolder/SampleJob -r
    /SampleFolder/^[A-Za-z]+$ -r
    
  3. Save the manifest file.

Run the Script

You must install Ant, which you can obtain from http://ant.apache.org/, to run a deployment script.
Perform the following steps to run the deployment script from a command line:
  1. Open a command line.
  2. Run the script in Ant, by specifying the script file as follows:
    ant –f deploySASJobs.xml
    .
Note: If you do not want to store your credentials in an openly available script file, you can also pass the user name and password through the command line. Use the following syntax:
ant -f deploySASJobs.xml -Dusername=mysuername -Dpassword=mypassword
(where each argument is preceded by a -D, the name of the parameter matches the name being set inside the ANT script, and key and value pairs are separated by the equal sign).