Using a Batch File to Deploy Jobs

Problem

You want to deploy one or more jobs in batch mode.

Solution

You can use the command-line batch deployment tool. This tool enables you to batch 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 batch deployment tool along with the appropriate parameters.

Tasks

Prepare the Batch File

Perform the following steps to prepare the batch file:
  1. Locate the deploySASJobs file that is deployed by default in the SASHomethen selectSASDataIntegrationStudiothen select4.3then selectbatchdeploy directory. Consider creating a copy of the file to configure so that the original retains the default settings.
  2. Open your copy of deploySASJobs.
  3. Enter appropriate values for the following arguments:
    • user name
    • password
    • metadata server location
    • if necessary, Java install location
    • the location of the manifest file
    Note: If you do not want to store your credentials in an openly available batch file, you can also pass the user name and password through the command line. Use the following syntax:
    deploySASJobs.bat -username myusername -password mypassword
    (where each argument is preceded by a - (minus sign or hyphen), and the name of the parameter matches the name being set inside the batch file).
  4. Save the values and close the deploySASJobs file.

Prepare the Manifest

Once you have prepared the batch file, you need to 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 will be 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 batch file. Note that you can also modify one of the sample manifest files provided in the SASHomethen selectSASDataIntegrationStudiothen select4.3then 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 Batch File

Perform the following steps to run the batch file:
  1. Locate the copy of the batch file that you prepared.
  2. Double-click the batch file and verify that it completed processing successfully.
  3. If errors are displayed, correct them and run the file again.
    Note: When you deploy jobs with this batch method, you cannot deploy jobs with the same name to the same location, even if the jobs have different physical paths. If you try, you will get an error indicating that a job with that name already exists at the deployment location.
Also note that you can also run the batch deployment from a command line window.
Perform the following steps to run the batch deployment from a command line window:
  1. Open a command prompt (Startthen selectProgramsthen selectAccessoriesthen selectCommand Prompt in Windows XP).
  2. Navigate to the folder where the batch file is stored.
  3. Enter the name of the batch file (such as deploySASJobs.bat) at the prompt and execute the file.
Finally, you can pass in arguments at the command line (for example,
deploySASJobs.bat -metauser myusername -metapass 
password -username myusername -password mypassword
).