Page History

Turn Off History

Introduction

Condor can be used to run COM automation jobs using the Windows Scripting Host (WSH). This means, for example, Condor can run jobs that automate Microsoft Excel. What follows is a step-by-step introduction to running Excel 'jobs' in Condor.

Configuration

First, you need to create a new administrative user that will be used to run Excel jobs under. We assume, for convenience, that this account name is excel.

To configure the Excel DCOM object, do the following:

  1. Login to the server as a Administrator.
  2. Click, Start, click Run and enter dcomcnfg.
  3. This will bring up the Component Services window.
  4. Click Console Root, click Component Services, click Computers, finally, click DCOM Config.
  5. Right click on the Microsoft Excel Application component and select Properties.
  6. In the General tab, select None in the Authentication Level drop-down.
  7. In the Identity tab, select This user, and type the name of the administrative account, excel, and its password.
  8. Click the OK button.

NOTE: This will render Excel almost inoperative on this machine for any interactive users.

Example


  universe     = vanilla
  executable   = excel.simple.vbs
  log          = excel.simple.log.txt
  error        = excel.simple.err.txt
  output       = excel.simple.out.txt
  load_profile = true
  queue 1


  On Error Resume Next

  WScript.Echo "Creating Excel Application Object"

  Set objExcel = CreateObject("Excel.Application")
  Set objBooks = objExcel.Workbooks

  WScript.Echo "Creating a Workbook"

  Set objWorkbook = objBooks.Add()

  WScript.Echo "Generating Data"

  For i = 1 to 10
      objExcel.Cells(i, 1).Value = i
  Next

  WScript.Echo "Document Filed"

  Set objFS = CreateObject("Scripting.FileSystemObject")
  sCurPath  = objFS.GetAbsolutePathName(".")
  sFileName = sCurPath & "\" & "test.xlsx"

  objWorkbook.SaveAs(sFileName)

  WScript.Echo "Document Saved"

  objWorkbook.Close()

  WScript.Echo "Document Closed"

  objExcel.Quit()
  WScript.Echo "Done"
  WScript.Exit 0


Test Run

Let's take a look at what the script returns. First, submit the job:

  C:\condor-jobs\scripts>condor_submit excel.simple.sub
  Submitting job(s).
  Logging submit event(s).
  1 job(s) submitted to cluster 77.

Once the job has completed, dump the output file:

  C:\condor-jobs\scripts>more excel.simple.out.txt
  Microsoft (R) Windows Script Host Version 5.7
  Copyright (C) Microsoft Corporation. All rights reserved.

  Creating Excel Application Object
  Creating a Workbook
  Generating Data
  Document Filed
  Document Saved
  Document Closed
  Done