LSF Handbook
搜索文档…
基于时间的自动配置
Variable time-based configuration is used in both project mode and cluster mode to automatically change configuration that is set in lsf.licensescheduler based on time windows. For example, if you have design centers in remote locations, one use of time-based configuration is to switch ownership of license tokens that are based on local time of day.
You define automatic configuration changes in lsf.licensescheduler by using if-else constructs and time expressions. After you change the files, reconfigure the cluster with the bladmin reconfig command.
The expressions are evaluated by License Scheduler every 10 minutes based on bld start time. When an expression evaluates true, License Scheduler dynamically changes the configuration that is based on the associated configuration statements and restarts bld
The #if, #else, #endif keywords are not interpreted as comments by License Scheduler, but as if-else constructs.

Syntax

1
time = hour | hour:minute | day:hour:minute
Copied!
  • hour
    Specify an integer from 0 to 23, representing the hour of the day.
  • minute
    integer from 0 to 59, representing the minute of the hour.If you do not specify the minute, License Scheduler assumes the first minute of the hour (:00).
  • day
    Specify an integer from 0 to 7, representing the day of the week, where 0 represents every day, 1 represents Monday, and 7 represents Sunday.If you do not specify the day, License Scheduler assumes every day. If you do specify the day, you must also specify the minute.

Specify time values

Procedure

Specify at least the hour.
Day and minutes are optional.

Specify time windows

Procedure

Specify two time values that are separated by a hyphen (-), with no space in between.
1
time_window = time1-time2
Copied!
time1 is the start of the window and time2 is the end of the window. Both time values must use the same syntax.
Use one of the following ways to specify a time window:
  • hour-hour
  • hour:minute-hour:minute
  • day:hour:minute-day:hour:minute
For example:
  • Daily window
    To specify a daily window, omit the day field from the time window. Use either the hour-hour or hour:minute-hour:minute format. For example, to specify a daily 8:30 a.m. to 6:30 p.m. window:
    1
    8:30-18:30
    Copied!
  • Overnight window
    To specify an overnight window, make time1 greater than time2. For example, to specify 6:30 p.m. to 8:30 a.m. the following day:
    1
    18:30-8:30
    Copied!
  • Weekend window
    To specify a weekend window, use the day field. For example, to specify Friday at 6:30 p.m to Monday at 8:30 a.m.:
    1
    5:18:30-1:8:30
    Copied!

Specify time expressions

About this task

Time expressions use time windows to specify when to change configurations.

Procedure

Define a time expression.
A time expression is made up of the time keyword followed by one or more space-separated time windows that are enclosed in parentheses. Use the &&, ||, and ! logical operators to combine time expressions.
1
expression = time(time_window[ time_window ...])
2
| expression && expression
3
| expression || expression
4
| !expression
Copied!
For example:
Both of the following expressions specify weekends (Friday evening at 6:30 p.m. until Monday morning at 8:30 a.m.) and nights (8:00 p.m. to 8:30 a.m. daily).
1
time(5:18:30-1:8:30 20:00-8:30)
2
time(5:18:30-1:8:30) || time(20:00-8:30)
Copied!

Create if-else constructs

About this task

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

Procedure

  • Define an if-else expression.
    1
    #if time(expression)
    2
    statement
    3
    #else
    4
    statement
    5
    #endif
    Copied!
    The #endif part is mandatory and the #else part is optional.
  • Define an elif expression.
    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 no other conditions are satisfied.
    1
    #if time(expression)
    2
    statement
    3
    #elif time(expression)
    4
    statement
    5
    #elif time(expression)
    6
    statement
    7
    #else
    8
    statement
    9
    #endif
    Copied!
    When you use #elif, the #else and #endif parts are required.

Restart to implement configuration changes

About this task

All time-based configuration is within the lsf.licensescheduler file, so restarting the bld applies all changes.

Procedure

  1. 1.
    Run bladmin ckconfig to check configuration.
  2. 2.
    Run lsadmin limrestart or bladmin restart to restart the bld.

Verify configuration

About this task

Verify time-based configuration by viewing License Scheduler information.

Procedure

  1. 1.
    Run blinfo.
  2. 2.
    Run blstat.

Examples

Project configuration in project mode

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

Project group configuration in project mode

1
#
2
# ProjectGroup section
3
#
4
Begin ProjectGroup
5
GROUP SHARES OWNERSHIP LIMITS NON_SHARED
6
(group1 (A B)) (1 1) (5 -) () ()
7
End ProjectGroup
8
9
Begin ProjectGroup
10
GROUP SHARES OWNERSHIP LIMITS NON_SHARED
11
(group2 (A B)) (1 1) (- 5) () ()
12
End ProjectGroup
13
14
#
15
# Feature section
16
#
17
Begin Feature
18
NAME = f1
19
#if time(5:16:30-1:8:30 20:00-8:30)
20
GROUP_DISTRIBUTION=group1
21
#elif time(3:8:30-3:18:30)
22
GROUP_DISTRIBUTION=group2
23
#else
24
GROUP_DISTRIBUTION=group2
25
#endif
26
SERVICE_DOMAINS=Lan1 Lan2
27
End Feature
Copied!

Cluster distribution configuration in cluster mode

1
Begin Feature
2
NAME = f1
3
#if time(5:16:30-1:8:30 20:00-8:30)
4
CLUSTER_DISTRIBUTION=Wan(Cl1 1 Cl2 1)
5
#elif time(3:8:30-3:18:30)
6
CLUSTER_DISTRIBUTION= Wan(Cl1 2 Cl2 1/2/100) Lan(Cl2 1)
7
#else
8
CLUSTER_DISTRIBUTION= Wan(Cl1 10 Cl2 1/1/10) Lan(Cl1 1)
9
#endif
10
End Feature
Copied!