|
set_server_refresh(refresh)
This function allows you to prevent _load_tokens from actually
hitting the license servers/files again. |
|
|
|
_single_job_capacity(reqs,
tokens)
Calculate the number of jobs that can be run, for a job with the
given token requirements and the given set of available tokens. |
|
|
|
healthier(health1,
health2)
Return True if health1 is healthier than health2. |
|
|
|
tokens(licenses)
Report number of tokens provided by and currently available from the
given license resources. |
|
|
|
job_capacity(resources)
Report number of jobs that can be run with the tokens available on
the given license resources. |
|
|
|
get_hostid()
Get the hostid for the current machine using "lmutil
lmhostid". |
|
|
str
|
|
|
execute_lmutil(args)
Execute the lmutil program with the given commandline arguments. |
|
|
|
execute_lictest(args)
Execute the lictest program with the given commandline arguments. |
|
|
|
parse_lmhostid_output(lines)
Parse the output from "lmutil lmhostid", provided as a list
of output lines. |
|
|
|
run_lmstat(license_file,
parsefeatures=False)
Get license usage information from a server via "lmutil lmstat". |
|
|
|
parse_lmstat_output(lines)
Parse the output from "lmutil lmstat", provided as a list of output lines. |
|
|
|
run_lmdiag(locations)
Get diagnostic information regarding one or more license resources
via "lmutil lmdiag". |
|
|
|
parse_lmdiag_output(lines)
Parse the output from "lmutil lmdiag", provided as a list
of output lines. |
|
|
|
join_cont_lines(lines)
Returns the input list of lines, after joining any logical lines that
were split across two (or more) physical lines, and stripping leading
and trailing whitespace. |
|
|
|
parse_lmdiag_entry(lines)
Returns a LicenseFeature object, representing the information
reported by lmdiag for that feature. |
|
|
|
load_job_reqs(filename='
' )
Read a json document describing the license requirements for each job
that a user could launch. |
|
|
|
load_job_products(filename='
' )
Read a json document listing the product names under which job types
should be grouped. |
|
|
|
|
|
find_license_resources()
Returns a list of lists of all license resources (license files or
servers) that would be available to a job trying to check out a license. |
|
|
|
_unique_resources(lics)
Filter the given list of LicenseResources to remove redundant resources. |
|
|
|
resources_from_path(search_path,
source='
' )
Parse the given search path (PATH-style) into components and return a
list with the LicenseResource object for each item. |
|
|
|
resources_from_list(license_list,
source)
Return a list with the LicenseResource object for each item (server
hostport, license file or license directory) in the given list. |
|
|
|
|
|
hostid_is_local(lic_hostid)
Returns True if the given hostid matches the local hostid. |
|
|
|
hostname_is_local(hostname)
Determine whether the given hostname refers to the current host. |
|
|
|
is_ipv4_addr(addr)
Determine whether the given string is an IPv4 address. |
|
|
|
server_log(licfile)
Return the standard pathname for the lmgrd log file associated with
the given license file. |
|
|
|
writable_server_log(licfile,
prefer_logfile='
' )
Return the pathname for the log file to use when launching a server
for the given license file. |
|
|
|
can_write_file(pathname)
Returns true if the filesystem permissions appear to allow the
specified file to be written. |
|
|
|
create_stub_license(host,
port='
' )
Create a stub license file, which points to a remote license server. |
|
|
|
parse_lmgrd_log(filename,
offset=0) |
|
|
|
parse_lmgrd_lines(lines)
Parse an lmgrd log file for messages related to the health of the
lmgrd and SCHROD daemons. |
|
|
|
version_uptodate(version)
Returns True unless the given lmgrd version number is older than
v11.12. |
|
|
|
parse_lmgrd_event(eventdict,
line) |
|
|
|
lmgrd_lines(lines)
A generator to perform initial parsing of lmgrd logfile lines. |
|
|
|
resources()
Return a list of all license resources found. |
|
|
|
|
|
|
|
|
|
get_working_resources(license_resources=None)
Returns list of LicenseResources without any all-expired files. |
|
|
|
refresh()
Force license-resource info to be re-loaded. |
|
|
|
local_server_files(dirname)
Given the name of a license directory, return a list of the license
files found therein that can be used to start a local license server. |
|
|
|
job_capacity_by_product(res_list=None)
Return a dict of lists of tuples, reporting the number of
jobs of each type that can be run, grouped by product. |
|
|
|
license_directory()
Return the pathname of the directory into which license files
should be installed. |
|
|
|
parse_args(args)
Parse the commandline arguments for the licadmin utility. |
|
|
|
handle_start_action(opts)
Start a local license server. |
|
|
|
handle_stop_action(opts)
Stop a local license server. |
|
|
|
handle_stat_action(opts)
Execute "lmutil lmstat -a" for the specified license. |
|
|
|
handle_diag_action(opts)
Execute "lmutil lmdiag -n" for the specified license. |
|
|
|
|
|
handle_list_action(opts)
List all known license resources. |
|
|
|
handle_check_action(opts)
Report the status of all known license resources. |
|
|
|
handle_verify_action(opts)
Verify the signatures in the specified license file, using lictest. |
|
|
|
handle_generic_action(action,
opts)
Execute the lmutil subcommand for the given action. |
|
|
|
|
|
install_netsuite_license(key)
Download a license from Netsuite using the given key, and install it
in the license directory. |
|
|
|
|
|
download_server_license(key,
hostname=None,
hostid=None,
lmgrdport=27008,
schrodport=53000)
Retrieves the server license corresponding to the key and saves it to
disk, in the license directory. |
|
|
|
download_nodelocked_license(key,
hostname=None,
hostid=None)
Retrieves the license corresponding to the key and saves it to disk,
in the licenses directory. |
|
|
|
|
|
install_license(filename)
Copy the given license file to the standard licenses directory and
give it its canonical filename. |
|
|
|
installed_pathname(filename)
Check whether the given license file is already installed in the
licenses directory under a different name. |
|
|
|
file_dirname(pathname)
Return the name of the directory containing the given file. |
|
|
|
write_file(filename,
contents)
Writes the given content into a file in the CWD. |
|
|
|
|
|
temporary_directory(*args,
**kwds)
Create a temporary directory and make that the current directory in
this context. |
|
|
|
handle_info_action(opts)
Create an archive of information for troubleshooting license issues. |
|
|
|
options_file(licfile='
' )
Return the pathname of the FLEXlm options file associated with the
given license. |
|
|
|
system_hosts_file()
Return the pathname of the /etc/hosts file, or its equivalent. |
|
|
|
get_machid_output()
Return the output of the machid utility |
|
|
|
get_network_info()
Return network configuration info from ifconfig. |
|
|
|
get_mmshare_listing()
Return info about the mmshare directory. |
|
|
|
get_schrod_file_listing()
Return info about license-related files installed under $SCHRODINGER. |
|
|
|
get_shared_file_listing()
Return info about files installed in the shared license directory. |
|
|
|
get_server_processes()
Return info about any running lmgrd and SCHROD processes. |
|
|
|
process_attributes(proc,
attrs)
Return a dict containing the specified attributes for the given
psutil.Process object. |
|
|
|
|
|
|
|
_find_server_logs(licenses)
Return a list of all server logfiles found on the standard search path. |
|
|
|
create_archive_file(archive_file,
archive_dir)
Create a zip archive with the contents of archive_dir |
|
|
|
shorthost(hostname)
Return the short hostname for the given hostname, without the domain
name. |
|
|
|
get_flexlm_search_path()
Execute "lmutil lmpath" to determine the actual search path
used for license checkouts. |
|
|
|
has_license_file_suffix(filename) |
|
|
|
|
|
install_schrod_plist()
Install FLEXlm plist to /Library/LaunchDaemons which allow to
autostart lmgrd and SCHROD on boot. |
|
|
|
|
|
|
|
fmt = logging.Formatter('%(message)s')
|
|
log = logging.getLogger("licadmin")
|
|
console_handler = logging.StreamHandler(stream= sys.stdout)
|
|
SCHRODINGER = ' /scr/buildbot/savedbuilds/2017-2/NB/build-142 '
|
|
MMSHARE_EXEC = ' /scr/buildbot/savedbuilds/2017-2/NB/build-142/ ...
|
|
MMSHARE_DATA = ' /scr/buildbot/savedbuilds/2017-2/NB/build-142/ ...
|
|
SCHROD_DAEMON_CHECK_TIMEOUT = 60
|
|
LICENSE_DIRNAME = ' licenses '
|
|
LICENSE_FILENAME = ' license '
|
|
LMGRD_LOG = ' lmgrd.log '
|
|
LMGRD_ALTLOG = ' lmgrd.buildbot.log '
|
|
VERSION_UNKNOWN = ' Unknown '
|
|
SHARED_LICENSE_DIR = ' /opt/schrodinger '
|
|
JOB_REQS_FILE = ' /scr/buildbot/savedbuilds/2017-2/NB/build-142 ...
|
|
JOB_PRODUCTS_FILE = ' /scr/buildbot/savedbuilds/2017-2/NB/build ...
|
|
SCHROD_DAEMON_NOT_STARTED = ' License server machine is down '
|
|
EXPIRED_MESSAGE = ' License has expired '
|
|
REQUIRED_MAJOR_VERSION = 11
|
|
REQUIRED_MINOR_VERSION = 13
|
|
TEMPORARY_LICENSE = ' downloaded.lic '
|
|
UNCOUNTED = -1
|
|
_resources = None
hash(x)
|
|
_local_server = None
hash(x)
|
|
_job_reqs = { }
|
|
_job_products = [ ]
|
|
_tokens_loaded = defaultdict(<type 'dict'>, {})
|
|
_features_loaded = defaultdict(<type 'dict'>, {})
|
|
_server_refresh = True
hash(x)
|
|
RESOURCE_OK = License OK
|
|
RESOURCE_PROBLEMS = License may have problems
|
|
RESOURCE_HAS_FUTURE_START = License has start date in the future
|
|
RESOURCE_UNAVAILABLE = License is unusable
|
|
LMGRD_EVENTS = OrderedDict([('LMGRD_PRE_START', (0, <_sre.SRE_...
|
|
SCHROD_EVENTS = OrderedDict([('SCHROD_START', (0, <_sre.SRE_Pa...
|
|
NSERROR_GET_FAILED = ' Failed to retrieve license '
|
|
NSERROR_BAD_KEY_TYPE = ' Unexpected key type: %s '
|
|
NSERROR_KEY_EXHAUSTED = ' The key you entered has already been ...
|
|
NSERROR_KEY_USED = ' The server key you entered has already bee ...
|
|
parser = None
hash(x)
|
|
GENERIC_ACTIONS = ( ' CKSUM ' , ' NEWLOG ' , ' REREAD ' , ' REMOVE ' , ' SWI ...
|
|
LICENSE_ACTIONS = ( ' CKSUM ' , ' DIAG ' , ' INFO ' , ' NEWLOG ' , ' REREAD ' ...
|
|
GENERAL_INFO_FILE = ' general-info.txt '
|
|
GENERAL_INFO_TEMPLATE = Template("""Gene...
|
|
server_ps_attrs = [ ' pid ' , ' ppid ' , ' name ' , ' exe ' , ' memory_info ' ...
|
|
server_ps_head_fmt = ' %-6s %-8s %6s %6s %4s %4s %6s %7s %s '
|
|
server_ps_body_fmt = ' {name:<6s} {username:<8s} {pid:6d} {ppid ...
|
|
LMGRD_ERROR = 1
|
|
LMGRD_INFO = 0
hash(x)
|
|
SCHROD_ERROR = 1
|
|
SCHROD_INFO = 0
hash(x)
|
|
__package__ = ' schrodinger.application.licensing '
|