Automatic time-based configuration

Variable configuration is used to automatically change LSF configuration based on time windows. It is supported in the following files:

  • lsb.hosts

  • lsb.params

  • lsb.queues

  • lsb.resources

  • lsb.users

  • lsf.licensescheduler

You define automatic configuration changes in configuration files by using if-else constructs and time expressions. After you change the files, reconfigure the cluster with the badmin reconfig command.

The expressions are evaluated by LSF every 10 minutes based on mbatchd start time. When an expression evaluates true, LSF dynamically changes the configuration based on the associated configuration statements. Reconfiguration is done in real time without restarting mbatchd, providing continuous system availability.

In the following examples, the #if, #else, #endif are not interpreted as comments by LSF but as if-else constructs.

lsb.hosts example

Begin Host 
HOST_NAME   r15s   r1m   pg 
host1       3/5    3/5   12/20 
#if time(5:16:30-1:8:30 20:00-8:30) 
host2       3/5    3/5   12/20 
#else 
host2       2/3    2/3   10/12 
#endif 
host3       3/5    3/5   12/20 
End Host

lsb.params example

# if 18:30-19:30 is your short job express period, but 
# you want all jobs going to the short queue by default
# and be subject to the thresholds of that queue
# for all other hours, normal is the default queue
#if time(18:30-19:30)
DEFAULT_QUEUE=short
#else
DEFAULT_QUEUE=normal
#endif

lsb.queues example

Begin Queue 
... 
#if time(8:30-18:30) 
   INTERACTIVE  = ONLY  # interactive only during day shift 
#endif 
... 
End Queue

lsb.resources example

# Example: limit usage of hosts in 'license1' group and time based configuration
# - 10 jobs can run from normal queue
# - any number can run from short queue between 18:30 and 19:30
#  all other hours you are limited to 100 slots in the short queue
# - each other queue can run 30 jobs
Begin Limit
PER_QUEUE               HOSTS       SLOTS     # Example
normal                  license1    10
# if time(18:30-19:30)     
short                   license1    -  
#else
short                   license1    100
#endif    
(all ~normal ~short)    license1    30     
End Limit

lsb.users example

From 12 - 1 p.m. daily, user smith has 10 job slots, but during other hours, user has only 5 job slots.

Begin User
USER_NAME          MAX_JOBS     JL/P
#if time (12-13)
smith               10           -
#else
smith               5            -
default             1            -
#endif
End User

lsf.licensescheduler example

Begin Feature
NAME = f1 
#if time(5:16:30-1:8:30 20:00-8:30)
DISTRIBUTION=Lan(P1 2/5  P2 1)
#elif time(3:8:30-3:18:30)
DISTRIBUTION=Lan(P3 1)
#else
DISTRIBUTION=Lan(P1 1 P2 2/5)
#endif
End Feature

Create if-else constructs

The if-else construct can express single decisions and multi-way decisions by including elif statements in the construct.

If-else

The syntax for constructing if-else expressions is:

#if time(expression)statement#elsestatement#endif

The #endif part is mandatory and the #else part is optional.

elif

The #elif expressions are evaluated in order. If any expression is true, the associated statement is used, and this terminates the whole chain.

The #else part handles the default case where none of the other conditions are satisfied.

When you use #elif, the #else and #endif parts are mandatory.

#if time(expression)
statement
#elif time(expression)
statement
#elif time(expression)
statement
#else
statement
#endif