Creating a Maintenance Window in JAMS

Follow

Maintenance windows can be created in JAMS by utilizing a Resource definition (see: Using Resources).

First, create a new Resource. Call it "Maintenance_Window".

During the creation wizard, set the initial Quantity Available to "999999".

Once the Resource has been created, open the Properties of the root folder in JAMS, then navigate to the Properties Tab>Resources Section. Add the Maintenance_Window resource and define Quantity Required to "1".

Setup of the maintenance window is now complete. When you are ready to "enable" your maintenance window, change the Quantity Available within the Properties of Maintenance_Window from "999999" to "0". This will allow Jobs to continue to enter the schedule, but they will not execute. When you are finished with your maintenance window, change the Quantity Available back to "999999" and your Jobs will be allowed to begin executing again.

Note: Jobs already executing when you set your resource to 0 will be allowed to finish executing. Keep this in mind so Jobs have enough time to complete prior to patching/taking down servers, etc. during the maintenance period.

Have more questions? Submit a request

Comments

  • Avatar
    Wesley Lee

    Thanks for this great tip.

    In a similar fashion, after "releasing" the maintenance window and seeing all the jobs having queued up, if we set the "Resource Quantity Available" to 1, does that mean that all the queued jobs will release one by one in the order that they entered into the overall queue ie by EntryID. I'm assuming that the dependencies will also hold.

  • Avatar
    Kevin Vliet

    Hi Wesley,

    That is absolutely correct. Setting the "Resource Quantity Available" to 1 creates a single-threaded resource and will allow the schedule to catch up one by one, rather than "opening the flood gates".

    Edited by Kevin Vliet
  • Avatar
    Gary Baker

    I tried setting the "Resource Quantity Available" to 1, nothing started. Setting it to 10 only allowed 3 jobs to run. Is there some way to check to see how many resources a job uses?

  • Avatar
    Randy Richmond

    This is a wonderful feature. It would be even more wonderful if there was a way to schedule a start and end time for the maintenance window. Any thoughts on that?

  • Avatar
    Randy Richmond

    I am certain I can create jobs to adjust the "Resource Quantity Available" from 999,999 to 0 (and vice versa) in scripts running against the DB at a pre-defined time, and similarly run another job to adjust the setting back to 999,999 from 0 at a later time. But that seems risky making adjustments like this directly on the SQL Server. Sure would be nice if we could instead schedule effective datetimes (start and end times, effective dates, except for dates, etc.) for resources.

    Edited by Randy Richmond
  • Avatar
    Gennaro Piccolo

    Hello Randy, you may submit a request for enhancement to support@jamsscheduler.com or log into your support portal and submit a ticket for a request for enhancement as well.

    Gary, regarding your question, the Resources section in the Properties tab on a job will list the net required resources while it is running. If anyone has further questions or concerns please contact support directly using support@jamsscheduler.com.

    Edited by Gennaro Piccolo
  • Avatar
    Pat Marshall

    Randy, you can handle this directly through a scheduled PowerShell job. For the resource "Maintenance", the below will take it offline.

    import-module JAMS

    $resource = gci JAMS::localhost/Resources/Maintenance
    $resource.QuantityAvailable = 0
    $resource.Update()

    Just schedule this when you want your maintenance window to start. To exit the maintenance window, just run a variant of it where QuantityAvailable is set to the threshold you would prefer (we usually use 9999).

    Obviously, make sure the END MAINTENANCE job is not dependent on the resource!