Allocator Usage Examples
This section contains simple examples about using Allocator to solve common problems of sharing licenses between sites.
In the following examples, the sites are called A B C D and the licenses to be shared are called x y z. It is assumed that all features are "WAN-able", that they can be shared across all sites.
A config.tcl file for Allocator typically contains elements from all the examples below.
Share One License Between Two Sites
In this example, the feature x coming from FlexNet Publisher is
represented by the resource License:x. If there is contention between the two sites,
more licenses will be allocated to B than to A because the weight for B is 200 and
the weight for A is 100, so the ratio of the allocation will be 2 to 1 in favor of
B. It is to be hoped that there are at least 3 tokens to share, otherwise the
rounding errors may affect the sharing.
LA::AddResource License:x FLEXLM/x ""
LA::AddSite vnc@hostA A {} -version SAME
LA::AddSite vnc@hostB B {} -version SAME
LA::SetResourceWeight A License:x 100
LA::SetResourceWeight B License:x 200
Below is is an equivalent way of setting the weights directly in the
AddSite
procedure. This is an older
style.LA::AddResource License:x FLEXLM/x ""
# Older way of specifying the weights.
LA::AddSite vnc@hostA A {
License:x 100
}
LA::AddSite vnc@hostB B {
License:x 200
}
Share One License Between Two Sites, with Minimum Allocations
In this example, even if there is no demand in site A, there will always be at least
2 tokens allocated to A. Similarly, 3 tokens are allocated to B regardless of the
demand. We assume that there are at least 5 tokens to share.
LA::AddResource License:x FLEXLM/x ""
LA::AddSite vnc@hostA A {}
LA::AddSite vnc@hostB B {}
LA::SetMinQuantity A License:x 2
LA::SetMinQuantity B License:x 3
Share One License that Comes From Two Sources
In this example, the feature x is provided by two FlexNet Publisher
daemons, identified by the tags TAG1 and TAG2 in Allocator. We
do not care about the individual pools of licenses, but we want the aggregate number
of licenses to be balanced between sites A and B.
LA::DefineResourceGroup License:x {
LA::AddResource License:TAG1_x FLEXLM/TAG1/x ""
LA::AddResource License:TAG2_x FLEXLM/TAG2/x ""
}
LA:AddSite vnc@hostA A {}
LA:AddSite vnc@hostB B {}
The resource "License:x" is called the "group" while "License:TAG1_x" and
"License:TAG2_x" are called the "components of the group". The resource "License:x"
maps to the following expression:
"License:TAG1_x OR License:TAG2_x"
Note: When a feature
comes from multiple daemons, remember to use the VOV_LM_VARNAMES variable so that Accelerator can
automatically set LM_LICENSE_FILE to point to the correct daemon.
Do Not Share with One Site
Sometimes one license cannot be shared with one of the sites, such as for contractual
reasons. In this example, the license with tag TAG2 can be shared between sites A
and B, but not with C.
LA::DefineResourceGroup License:x {
LA::AddResource License:TAG1_x FLEXLM/TAG1/x ""
LA::AddResource License:TAG2_x FLEXLM/TAG2/x ""
}
LA::AddSite vnc@hostA A {}
LA::AddSite vnc@hostB B {}
LA::AddSite vnc@hostB C {}
LA::SetResourceWeight C License:TAG2_x DO_NOT_SHARE
LA::SetResourceWeight C License:TAG1_x FROM_SITE
Reserve Some Licenses for Use Outside the Queue
Sometimes it is acceptable for some licenses to be used outside the queues. For
example, user john may be working on a special project and he is running on a
machine that is not managed by the site scheduler. We always want to make sure that
john has at least 6 licenses reserved for this project.
LA::AddResource License:x FLEXLM/x ""
LA::AddSite vnc@hostA A {}
LA::AddSite vnc@hostB B {}
LA::SetReserveForUser License:x john 6
Change Weights Depending on Job Priority
If a site has high priority jobs that are SCHEDULED and waiting for resources, then
we may want to increase the weight for that site. The priority of a jobs in queue
for a site can be retrieved with
LA::GetResourcePriority
as in the
following example:
LA::AddResource License:x FLEXLM/x ""
LA::AddSite vnc@hostA A {} -access vtk
LA::AddSite vnc@hostB B {} -access vtk
proc myUpdateWeights {} {
foreach site { A B } {
set pri [LA::GetResourcePriority $site License:x]
if { $pri >= 8 } {
LA::SetResourceWeight $site License:x 500
} else {
LA::SetResourceWeight $site License:x 100
}
}
}
# The registered script will be evaluated once for each cycle.
LA::RegisterScript "myUpdateWeights"
Change Weights Depending on Time with TIMEVAR
We want to use different weights for sharing depending on the time of day. In this
simple case, we just change weights on Saturday and
Sunday.
LA::AddResource License:x FLEXLM/x ""
LA::AddSite vnc@hostA A {}
LA::AddSite vnc@hostB B {}
TIMEVAR changeWeightsOnWeekend {
Sat,Sun {
LA::SetResourceWeight A License:x 100
LA::SetResourceWeight B License:x 100
}
default {
LA::SetResourceWeight A License:x 400
LA::SetResourceWeight B License:x 100
}
}
Share All Licenses between Three Sites
LA::AddAllResources -resmapType License
LA::AddSite vnc@hostA A {} -version SAME -defaultweight 300
LA::AddSite vnc@hostB B {} -version SAME -defaultweight 200
LA::AddSite vnc@hostC C {} -version SAME -defaultweight 200
Note: Allocator provides the ability define resource groups which
are a logical OR of components resources potentially hosted on different license
servers. Further, licenses from specific servers can be excluded from distribution
to specific sites.