Code to Control a Model Build

This section shows how to retrieve the status of a build, and how to pause, resume, and stop the build. Additionally, the priority of the build is retrieved and then increased.

  1. Using the PredModelBuilder object, oPredModelBuilder, check the status of the build thread, lBuildID, started in Code to Build a New Model. For information on the enumerated build states, see PredModelBuilder.Status.

    Response.Write "Build " & lBuildID & " is "
    Select Case oPredModelBuilder.Status(lBuildID)
    Case PredBldRunning
    Response.Write "Running <P>"
    Case PredBldPaused
    Response.Write "Paused <P>"
    Case PredBldShuttingDown
    Response.Write "ShuttingDown <P>"
    Case Else
    Response.Write "No status <P>"
    End Select
    
  2. Assume the build is running. Pause the build.

    If oPredModelBuilder.Status(lBuildID) = PredBldRunning Then
    oPredModelBuilder.Pause(lBuildID)
    End If
    
  3. Resume the paused build.

    If oPredModelBuilder.Status(lBuildID) = PredBldPaused Then
    oPredModelBuilder.Resume(lBuildID)
    End If
    
  4. Check the priority of the build. For information about the enumerated build priorities, see PredModelBuilder.Priority.

    Dim ePriority
    ePriority = oPredModelBuilder.Priority(lBuildID)
    
    Response.Write "Build " & lBuildID & " has a priority of "
    Select Case ePriority
    Case PriLowest
    Response.Write "PriLowest <P>"
    Case PriBelowNormal
    Response.Write "PriBelowNormal <P>"
    Case PriNormal
    Response.Write "PriNormal <P>"
    Case PriAboveNormal
    Response.Write "PriAboveNormal <P>"
    Case PriHighest
    Response.Write "PriHighest <P>"
    Case Else
    Response.Write "Bad Priority <P>"
    End Select
    
  5. Increase the priority of the build.

    If ePriority <> PriHighest Then
    ePriority = ePriority + 1
    End If
    
  6. Stop the build.

    If oPredModelBuilder.Status(lBuildID) = PredBldRunning Or _
          oPredModelBuilder.Status(lBuildID) = PredBldPaused Then
    oPredModelBuilder.Stop(lBuildID)
    End If
    
  7. Stop all the builds.

    oPredModelBuilder.StopAllBuilds
    

Copyright © 2005 Microsoft Corporation.
All rights reserved.