Using a Command Line to Deploy Jobs

Overview of Using a Command Line to Deploy Jobs

You can deploy jobs in batch mode by using a command-line deployment tool. This tool enables you run an Ant script to deploy jobs through a simple command-line interface. You can create a manifest file that contains 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.
Note: You cannot use this command-line tool to deploy a job that resides on a z/OS system. Jobs that are to be deployed on UNIX servers should not have blanks in the job name. In addition, the batch deployment feature does not work when the host name contains a space or hyphen (-) character.
To deploy jobs using this command-line tool, perform the following steps:

Review the Prerequisites

These are the prerequisites for deploying jobs using the command tool:
  • This command line tool requires Ant, a popular scripting tool. If you do not already have Ant on your system, you can download it at http://ant.apache.org/bindownload.cgi.
    Note: The Ant executable directory (Ant/bin) must be in your path.
  • The files that are necessary to deploy jobs from the command line are distributed at [SASHome]/SASITResourceManagementClient/3.7. Make a copy of the original versions of these files before editing them.
    Even though the command line itself is run from a client Windows machine, the jobs to be deployed might be on a Windows or UNIX server machine.
    To use the command-line tool to deploy jobs, you need to obtain certain site-related information such as server addresses, passwords, and other information. The following three tables (installation properties, connection properties, and deployment information) show lists of the properties for which you should obtain values.
    Installation Properties
    Property
    Value
    Default
    InstallRoot
    The physical location where SAS products were installed
    C:\Program Files\SASHome
    ConfigRoot
    The physical location where the SAS server tier is configured
    C:\SAS\Config\Lev1
    PlatformVJR
    The physical location of the SAS Versioned JAR Repository plug-in directory
    ${InstallRoot}\SASVersionedJarRepository\eclipse
    WorkingDirectory
    The physical location of the most recent copy of the sas.etl.migration.batch JAR directory. Examine your copy of the Platform VJR for the most recent version in the plug-ins list.
    Note: Make sure you do not accidentally select the equivalent NLS JAR.
    ${PlatformVJR}\plugins\sas.etl.migration.batch_<your— installed— version>
    Note: You are required to edit this field and supply a correct value.
    PickList
    The SAS Data Integration Studio picklist for batch migration
    ${InstallRoot}\SASDataIntegrationStudio\4.7\plugins\sas.etl.migration.batch\picklist
    SASLauncher
    The SAS launcher JAR
    ${PlatformVJR}\plugins\sas.launcher.jar
    DISLocation
    The root location for SAS Data Integration Studio
    ${InstallRoot}\SASDataIntegrationStudio\4.7
    ITRMLocation
    The root location for SAS IT Resource Management client
    ${InstallRoot}\SASITResourceManagementClient\3.7
    Connection Properties
    Property
    Value
    Default
    metaserver
    Metadata server address
    (none)
    metaport
    Metadata server port
    8561
    metauser
    Metadata server user name
    Note: This name can be a SAS internal account.
    (none)
    metapass
    Metadata server password
    (none)
    metarepository
    Metadata repository name
    Note: The repository must be the repository that is the required metadata store for a SAS Metadata Server. Each metadata server has one foundation repository. (If you performed a custom installation, then you might have assigned a name other than Foundation.)
    Foundation
    metaserverid
    Metadata ID of the application server. (The ID should be in 8.8 format, such as A5GIT9NP.AS000002.)
    Note: This is the top-level application server object.
    (none)
    servermachine
    Application server address
    (none)
    serverport
    Application server port
    8591
    username
    Application server user name
    Note: This name cannot be the name of a SAS internal account. It must be a user name that is recognized by the operating system.
    (none)
    password
    Application server password
    (none)
    batchserver
    Batch server name to use for deployment
    SASApp - SAS DATA Step Batch Server
    Deployment Information
    Property
    Value
    Default
    deploymentdir
    Directory where files are deployed to
    Note: This directory must be registered as a deployment directory for the specified application server in SAS Management Console.
    ${ConfigRoot}\SASApp\SASEnvironment\SASCode\Jobs
    sourcedir
    Directory where SAS code is pulled from
    Note: This directory is usually the same as deploymentdir.
    ${ConfigRoot}\SASApp\SASEnvironment\SASCode\Jobs
    manifest
    Manifest file location
    ${ITRMLocation}\batchdeploy\samplemanifest.txt

Modify the Ant Script XML

To prepare the Ant script, perform the following steps:
  1. Locate the deployITRMJobs.xml Ant script. This script is deployed by default in the SASHome/SASITResourceManagementClient/3.7/batchdeploy directory.
    Tip
    For best results, create a copy of the file to configure so that the original script retains the default settings.
  2. Open your copy of deploySASJobs.xml. Update the script with the values that you obtained for the prerequisite information that was listed in the three previous tables.
  3. Save the values and close the deploySASJobs.xml script.

Modify the Manifest File

After you prepare 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. The file that you create must match the manifest file specification in the XML script that you previously modified.
Each line of the manifest file is deployed individually. A line can specify a folder or a specific job to deploy.
Note: This specification is for a folder in metadata or a complete path (folder and object name) to a location in metadata.
  • If you specify a folder, all of the jobs within that folder are deployed. The folder path should be completely specified. This is an example of a completely specified path: /Shared Data/SAS IT Resource Management/IT Data Marts/MyDTMart/DT Perf Sentry 1.
  • If you specify a job, only the matching job is deployed (if it exists). The specification should include the complete folder and job path, such as /Shared Data/SAS IT Resource Management/IT Data Marts/MyDTMart/DT Perf Sentry 1/DT Perf Sentry 1 Staging.
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.

Execute the Command

After you modify the Ant script XML to reflect your system and user settings, and the manifest file to specify the jobs to deploy, you can execute the deployITRMJobs batch file from the command line.