| Trees | Indices | Help | 
 | 
|---|
|  | 
| 
 | |||
| Status A Status object represents the "health" of a license resource. | |||
| MissingExecutableError If the requested path doesn't point to a valid executable. | |||
| stat_info stat_info(total, used) | |||
| LicenseFeature A LicenseFeature object represents a particular license feature provided by a LicenseResource. | |||
| LicenseResource A LicenseResource object represents a single license file or license server (port@host). | |||
| LocalServerProcess | |||
| ServerInfo A ServerInfo object represents the information reported in the lmgrd log when a license server is started. | |||
| UsageError This exception is thrown when unrecognized or incompatible commandline options are used. | |||
| NetsuiteError This exception is raised when there's a problem obtaining a license from the NetSuite server. | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| str | 
 | ||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| 
 | |||
| fmt = logging.Formatter('%(message)s') | |||
| log = logging.getLogger("licadmin") | |||
| console_handler = logging.StreamHandler(stream= sys.stdout) | |||
| SCHRODINGER =  | |||
| MMSHARE_EXEC =  | |||
| MMSHARE_DATA =  | |||
| LICENSE_DIRNAME =  | |||
| LICENSE_FILENAME =  | |||
| LMGRD_LOG =  | |||
| LMGRD_ALTLOG =  | |||
| VERSION_UNKNOWN =  | |||
| SHARED_LICENSE_DIR =  | |||
| JOB_REQS_FILE =  | |||
| JOB_PRODUCTS_FILE =  | |||
| EXPIRED_MESSAGE =  | |||
| REQUIRED_MAJOR_VERSION = 11 | |||
| REQUIRED_MINOR_VERSION = 13 | |||
| TEMPORARY_LICENSE =  | |||
| UNCOUNTED = -1 | |||
| _resources = Nonehash(x) | |||
| _local_server = Nonehash(x) | |||
| _job_reqs =  | |||
| _job_products =  | |||
| _tokens_loaded = defaultdict(<type 'dict'>, {}) | |||
| _features_loaded = defaultdict(<type 'dict'>, {}) | |||
| _server_refresh = Truehash(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 =  | |||
| NSERROR_BAD_KEY_TYPE =  | |||
| NSERROR_KEY_EXHAUSTED =  | |||
| NSERROR_KEY_USED =  | |||
| parser = Nonehash(x) | |||
| GENERIC_ACTIONS =  | |||
| LICENSE_ACTIONS =  | |||
| GENERAL_INFO_FILE =  | |||
| GENERAL_INFO_TEMPLATE = Template("""Gene | |||
| server_ps_attrs =  | |||
| server_ps_head_fmt =  | |||
| server_ps_body_fmt =  | |||
| LMGRD_ERROR = 1 | |||
| LMGRD_INFO = 0hash(x) | |||
| SCHROD_ERROR = 1 | |||
| SCHROD_INFO = 0hash(x) | |||
| __package__ =  | |||
| 
 | |||
| 
 This function allows you to prevent _load_tokens from actually hitting the license servers/files again. This is dangerous unless you're sure you're the only user of licadmin.py, and you really don't want to reload the tokens. PANEL-5146 
 | 
| 
 Calculate the number of jobs that can be run, for a job with the given token requirements and the given set of available tokens. Returns -1 if an unlimited number of jobs can be run. The requirements are a dict, mapping token name to the number required. The tokens are also a dict, mapping token names to the number of available tokens. A token count of -1 indicates an unlimited number of tokens. | 
| 
 Report number of tokens provided by and currently available from the given license resources. Returns a dict mapping token name to stat_info tuple for each token. | 
| 
 Report number of jobs that can be run with the tokens available on the given license resources. Returns a dict mapping the jobtype to the number of jobs that can be run, with licenses available from the given resources. | 
| 
 Get the hostid for the current machine using "lmutil lmhostid". Generally, this will be the MAC address(es) for the ethernet interface. Returns the hostid string reported for the current host. | 
| 
 Get the hostid for the current machine using get_hostid(). This will always return the first MAC address found by 'lmutil lmhostid' for the current host. 
 | 
| 
 Execute the lmutil program with the given commandline arguments. The arguments must be specified as list. The raw output of the command is returned. If the exit code is non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, the output in the output attribute, and the command in the cmd attribute. If lmutil cannot be executed, raises a MissingExecutableError or an OSError. | 
| 
 Execute the lictest program with the given commandline arguments. The arguments must be specified as list. The raw output of the command is returned. If the exit code is non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, the output in the output attribute, and the command in the cmd attribute. | 
| 
 Parse the output from "lmutil lmhostid", provided as a list of output lines. Returns the hostid string for the current host. | 
| 
 
Get license usage information from a server via "lmutil lmstat".
@type license_file: str
@param license_file
    Path to the license file to use with 'lmutil lmstat'.
@type parsefeatures: bool
@param parsefeatures:
    If set to True, the returned dict will have a mapping of the token
    name to a stat_info named tuple for each license feature.
    A stat_info tuple has integer fields 'total' and 'used', recording
    the total tokens provided and the number in use.
@returntpe: dict
@return:
    Dictionary containing the metadata of license server and
    vendor daemon corresponding to the given license file.
 | 
| 
 
Parse the output from "lmutil lmstat", provided as a list of output lines.
@type lines: list
@param lines:
    Output of 'lmutil lmstat'.
@returntype: dict
@return:
    Dictionary of license server, vendor daemon metadata containing the
    following information -
    "address"           port@host address of the license server.
    "server_version"    lmgrd version number, e.g., "v11.10.2" or
                        VERSION_UNKNOWN if indeterminate. This is only
                        returned in the case of
                        running lmstat on a remote server.
    "server_up"         True, if lmgrd is UP; else, False.
    "version"           SCHROD daemon version number or VERSION_UNKNOWN if
                        indeterminate.
    "schrod_up"         True, if SCHROD is up; False if down.
    "tokens"            tokens dict is a mapping of the feature name to
                        a stat_info named tuple for that feature. A
                        stat_info tuple has integer fields 'total' and
                        'used', recording the total tokens provided and
                        the number in use. If the output lines doesn't
                        have users of feature(s), this will be empty.
 | 
| 
 Get diagnostic information regarding one or more license resources via "lmutil lmdiag". The argument 'locations' is a string representing a FLEXLM search path, such as $SCHROD_LICENSE_FILE. Returns a dict with an entry for each license resource that was examined. For each resource, returns a dict mapping the feature name to a list of LicenseFeature objects, each representing the diag info for a single license line for that feature. (There may be more than one.) | 
| 
 Parse the output from "lmutil lmdiag", provided as a list of output lines. Returns a dict with an entry for each license resource that was examined. For each resource, returns a dict mapping the feature name to a list of LicenseFeature objects, each representing the diag info for a single license line for that feature. (There may be more than one.) | 
| 
 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. A continued line is indicated by a trailing comma. | 
| 
 Read a json document describing the license requirements for each job that a user could launch. The license requirements for a given job are represented as a dict, mapping the token name to the number of tokens required for that job. A job may accept more than one combination of tokens. Return a dict mapping the job type to a list of dicts, each representing an acceptable set of licenses for that job. If the file can't be loaded, an exception will be thrown. | 
| 
 Read a json document listing the product names under which job types should be grouped. Returns a list of product names. If the file can't be loaded, an exception will be thrown. | 
| 
 Return the table of license requirements for each job. The requirements are returned as a dict. The keys are the full internal job names. The license requirements for each job are recorded as a list of dicts, where each list item describes a set of requirements. A set of requirements is a dict mapping a license token name to the number of tokens required for that job. | 
| 
 
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.
License resources may be specified using the environment variables
    $SCHROD_LICENSE_FILE
    $LM_LICENSE_FILE
... which can each specify a list of license files and/or license servers.
License resources will also be found automatically if installed in one of
the standard locations that mmlic3 is hard-wired to search.  These are
    $SCHRODINGER/licenses/*.lic
    $SCHRODINGER/license{,.txt}
... and, depending on the platform,
    MacOSX:
    /Library/Application Support/Schrodinger/licenses/*.lic
    /Library/Application Support/Schrodinger/license{,.txt}
    Windows:
    C:\ProgramData\Schrodinger\licenses\*.lic
    C:\ProgramData\Schrodinger\license{,.txt}
    Linux
    /opt/schrodinger/licenses/*.lic
    /opt/schrodinger/license{,.txt}
Returns the tuple (license_file, source)
 | 
| 
 Filter the given list of LicenseResources to remove redundant resources. Rules: 1. If both a port@host reference and license file are found for the same server, we keep the license file. 2. If we have both a port@host and an @host reference to a server, keep the port@host reference. 3. If a stub license and a full license file are found, keep the full license file. 4. If there's more than one full license file for a given server, all are kept. | 
| 
 Provide a condensed list of license resources. Each license server is listed, but the existence of node-locked licenses. The health of each listed resource is indicated with a status code, which will be one of RESOURCE_OK, RESOURCE_PROBLEMS, RESOURCE_UNAVAILABLE. | 
| 
 Return the standard pathname for the lmgrd log file associated with the given license file. If the license is just a port@host server address, the empty string is returned, because we have no idea where the logs would be. | 
| 
 Return the pathname for the log file to use when launching a server for the given license file. The returned pathname will be writable by the current user. This differs from server_log() in that it will check for alternative locations and filenames if the standard lmgrd.log file can't be written. A suggested logfile pathname can be specified. If this file is writable, it will be returned. | 
| 
 Parse an lmgrd log file for messages related to the health of the lmgrd and SCHROD daemons. The log file is supplied as a list of lines. A ServerInfo object is returned | 
| 
 A generator to perform initial parsing of lmgrd logfile lines. A sequence of tuples (timestamp, prog, text) is returned. Lines for any prog other than "lmgrd" or "SCHROD" are discarded. | 
| 
 Returns the first license resource found for the local license server, if any. There may be multiple license servers, but only one that can run on the current machine. Only a local license server can be started or stopped by the user. Returns None if no local license server is found. NOTE: To start or stop a local license server, you'll need all of the license files for that server - there may be more than one. Use the local_server_resources() function to get the complete list. | 
| 
 Returns the license resources that represent the local license server. There may be multiple license servers, but only one that can run on the current machine. Only a local license server can be started or stopped by the user. Returns the empty list if no local license server files are found. | 
| 
 
Returns list of LicenseResources without any all-expired files.
This is useful for user-facing presentation.
@param license_resources list of license resource, if none specified
                         search all available
@type license_resources list of LicenseResource objects
 | 
| 
 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. Because the directory is a license directory, license files need to have a .lic suffix. | 
| 
 
Return a dict of lists of tuples, reporting the number of
jobs of each type that can be run, grouped by product.
The structure of the return value is
{ <product1>: [ (<jobtype1>, <number of jobs>),
                (<jobtype2>, <number of jobs>),
              ... ],
  <product2>: [ (<jobtype1>, <number of jobs>),
                (<jobtype2>, <number of jobs>),
              ... ],
}
By default, checks all available resources, but the res_list parameter can
be used to restrict the report to a specified collection of resources.
 | 
| 
 Return the pathname of the directory into which license files should be installed. The first writable directory found among the following will be returned: 1. the shared license directory, 2. $SCHRODINGER/licenses, and 3. $HOME/licenses The returned license directory will be created, as a side effect, if it doesn't already exist. | 
| 
 Parse the commandline arguments for the licadmin utility. If incompatible options are specified a UsageError is thrown. Returns a namespace object with the values of the commandline options. The subcommand ("START", "INFO", etc.) is returned as the "action" attribute of the namespace object. | 
| 
 Execute "lmutil lmver" for the specified executable. Lines containing "lmutil" are stripped from the result. | 
| 
 Install a license in the license directory. If a license key is given, download the license from Netsuite, first. | 
| 
 Download a license from Netsuite, using the given key. Returns the pathname of the downloaded file. A NetsuiteError is raised if there's a problem using the given license key. | 
| 
 Retrieves the server license corresponding to the key and saves it to disk, in the license directory. The lmgrd and SCHROD ports to use in the license may be specified. Returns the pathname of the downloaded file. A NetsuiteError is raised if there's a problem using the given license key. 
 | 
| 
 Retrieves the license corresponding to the key and saves it to disk, in the licenses directory. Returns the pathname of the downloaded file. A NetsuiteError is raised if there's a problem using the given license key. 
 | 
| 
 Install the given text as a license file, with the canonical filename. If it's already installed, nothing is done. The pathname of the installed license is returned. | 
| 
 Copy the given license file to the standard licenses directory and give it its canonical filename. If it's already in the licenses directory, it's just renamed. If its name already matches the canonical pattern, it is not renamed. | 
| 
 Check whether the given license file is already installed in the licenses directory under a different name. Return the pathname of the installed license, if it's found there, otherwise, return None. | 
| 
 Writes the given content into a file in the CWD. The full pathname of the written file is returned. | 
| 
 Change the CWD within some limited context 
 | 
| 
 Create a temporary directory and make that the current directory in this context. When the context is exited, chdir back to the original directory and delete the temporary directory. 
 | 
| 
 Return a dict containing the specified attributes for the given psutil.Process object. Make sure that filler values for unavailable data are of the correct type (LIC-548) | 
| 
 Copy license files to the specified subdirectory. All licenses found on the standard search path are copied. If a subdir is specified, the files are copied to that subdirectory, which will be created if necessary. | 
| 
 Copy license server logs to the current directory. All server logs found on the standard search path are copied. If a subdir is specified, the files are copied to that subdirectory, which will be created if necessary. | 
| 
 Return a list of all server logfiles found on the standard search path. The standard search path includes... 1. Any directory in which a license is installed 2. The parent directory of a licenses/ directory in which a license is installed 3. The user's home directory 4. The current directory | 
| 
 Return the short hostname for the given hostname, without the domain name. If hostname is an IP address, it is returned unmodified. | 
| 
 Install FLEXlm plist to /Library/LaunchDaemons which allow to autostart lmgrd and SCHROD on boot. This require root privilege to install to the location. | 
| 
 | |||
| MMSHARE_EXEC
 | 
| MMSHARE_DATA
 | 
| JOB_REQS_FILE
 | 
| JOB_PRODUCTS_FILE
 | 
| LMGRD_EVENTS
 | 
| SCHROD_EVENTS
 | 
| NSERROR_KEY_EXHAUSTED
 | 
| NSERROR_KEY_USED
 | 
| GENERIC_ACTIONS
 | 
| LICENSE_ACTIONS
 | 
| GENERAL_INFO_TEMPLATE
 | 
| server_ps_attrs
 | 
| server_ps_body_fmt
 | 
| Trees | Indices | Help | 
 | 
|---|
| Generated by Epydoc 3.0.1 on Wed Aug 3 07:59:07 2016 | http://epydoc.sourceforge.net |