Driverless AI Licenses¶
A valid license is required for running Driverless AI and for running the scoring pipelines.
About Licenses¶
Driverless AI is licensed per a single named user. Therefore, in order, to have different users run experiments simultaneously, they would each need a license. Driverless AI manages the GPU(s) that it is given and ensures that different experiments from different users can run safely simultaneously and don’t interfere with each other. So when two licensed users log in with different credentials, neither of them will see the other’s experiment. Similarly, if a licensed user logs in using a different set of credentials, that user will not see any previously run experiments.
Adding Licenses for the First Time¶
Specifying a License File for the Driverless AI Application¶
A license file to run Driverless AI can be added in one of three ways when starting Driverless AI.
Specifying the license.sig file during launch in native installs
Using the DRIVERLESS_AI_LICENSE_FILE and DRIVERLESS_AI_LICENSE_KEY environment variables when starting the Driverless AI Docker image
Uploading your license in the Web UI
Specifying the license.sig File During Launch¶
By default, Driverless AI looks for a license key in /opt/h2oai/dai/home/.driverlessai/license.sig. If you are installing Driverless AI programmatically, you can copy a license key file to that location. If no license key is found, the application will prompt you to add one via the Web UI.
Specifying Environment Variables¶
You can use the DRIVERLESS_AI_LICENSE_FILE or DRIVERLESS_AI_LICENSE_KEY environment variable when starting the Driverless AI Docker image. For example:
nvidia-docker run \
--pid=host \
--init \
--rm \
--shm-size=256m \
-u `id -u`:`id -g` \
-p 12345:12345 \
-e DRIVERLESS_AI_LICENSE_FILE="/license/license.sig" \
-v `pwd`/config:/config \
-v `pwd`/data:/data \
-v `pwd`/log:/log \
-v `pwd`/license:/license \
-v `pwd`/tmp:/tmp \
h2oai/dai-centos7-x86_64:TAG
or
nvidia-docker run \
--pid=host \
--init \
--rm \
--shm-size=256m \
-u `id -u`:`id -g` \
-p 12345:12345 \
-e DRIVERLESS_AI_LICENSE_KEY="Y0uRl1cens3KeyH3re" \
-v `pwd`/config:/config \
-v `pwd`/data:/data \
-v `pwd`/log:/log \
-v `pwd`/license:/license \
-v `pwd`/tmp:/tmp \
h2oai/dai-centos7-x86_64:TAG
Uploading Your License in the Web UI¶
If Driverless AI does not locate a license.sig file during launch, then the UI will prompt you to enter your license key after you log in the first time.
Click the Enter License button, and then paste the entire license into the provided License Key entry field. Click Save when you are done. Upon successful completion, you will be able to begin using Driverless AI.
Specifying a License for Scoring Pipelines¶
Driverless AI requires a license to be specified in order to run the Scoring Pipelines.
Python Scoring Pipeline¶
The license can be specified via an environment variable in Python:
# Set DRIVERLESS_AI_LICENSE_FILE, the path to the Driverless AI license file
%env DRIVERLESS_AI_LICENSE_FILE="/home/ubuntu/license/license.sig"
# Set DRIVERLESS_AI_LICENSE_KEY, the Driverless AI license key (Base64 encoded string)
%env DRIVERLESS_AI_LICENSE_KEY="oLqLZXMI0y..."
You can also export
the license file when running the scoring pipeline:
export DRIVERLESS_AI_LICENSE_FILE="/path/to/license.sig"
bash run_example.sh
MOJO Scoring Pipeline¶
Driverless AI requires a license to be specified in order to run the MOJO Scoring Pipeline. The license can be specified in one of the following ways:
- Via an environment variable:
DRIVERLESS_AI_LICENSE_FILE
: Path to the Driverless AI license file, orDRIVERLESS_AI_LICENSE_KEY
: The Driverless AI license key (Base64 encoded string)
- Via a system property of JVM (
-D
option): ai.h2o.mojos.runtime.license.file
: Path to the Driverless AI license file, orai.h2o.mojos.runtime.license.key
: The Driverless AI license key (Base64 encoded string)
- Via a system property of JVM (
- Via an application classpath:
The license is loaded from a resource called
/license.sig
.The default resource name can be changed via the JVM system property
ai.h2o.mojos.runtime.license.filename
.
For example:
java -Dai.h2o.mojos.runtime.license.file=/etc/dai/license.sig -cp mojo2-runtime.jar ai.h2o.mojos.ExecuteMojo pipeline.mojo example.csv
Driverless AI Licenses in Production via AWS Lambdas¶
Driverless AI deployment pipelines to AWS Lambdas automatically set the license key as an environment variable based on the license key that was used in Driverless AI.
Updating Licenses¶
If your current Driverless AI license has expired, you will be required to update it in order to continue running Driverless AI, in order to run the scoring pipeline, in order to access deployed pipelines to AWS Lambdas, etc.
Updating the License for Driverless AI¶
Similar to adding a license for the first time, you can update your license for running Driverless AI either by replacing your current license.sig file or via the Web UI.
Updating the license.sig File¶
Update the license key in your /opt/h2oai/dai/home/.driverlessai/license.sig file by replacing the existing license with your new one.
Updating the License in the Web UI¶
If your license is expired, the Web UI will prompt you to enter a new one. The steps are the same as adding a license for the first time via the Driverless AI Web UI.
Updating the License for Scoring Pipelines¶
For the Python Scoring Pipeline, simply include the updated license file when setting the environment variable in Python. Refer to the above Python Scoring Pipeline section for adding licenses.
For the MOJO Scoring Pipeline, the updated license file can be specifed using an environment variable, using a system property of JVM, or via an application classpath. This is the same as adding a license for the first time. Refer to the above MOJO Scoring Pipeline section for adding licenses.
Updating Driverless AI Licenses on AWS Lambda¶
Users can manually update each of their Driverless AI licenses deployed in production on AWS Lambda. For users with many MOJOs in production, though, H2O provides a script that will update Driverless AI licenses for all of your MOJOs currently deployed on AWS Lambda.
Manual Update¶
The Driverless AI deployment pipeline to AWS Lambdas explicitly sets the license key as an environment variable. Replace the expired license key with your updated one.
Automatic Update¶
H2O provides a script that can be used to update Driverless AI licenses for all of your MOJOs deployed on a specific AWS Lambda region. This script can be run for any machine.
Requirements¶
New Driverless AI license
The following Python packages are required for this script:
boto3
argparse
os
Update Steps¶
Perform the following steps to update your Driverless AI license for MOJOs on AWS Lambda.
Copy the following code and save it as update_lambda.py.
import boto3 import argparse import os def load_license(license_path): with open(license_path, 'r') as license_file: license_key = license_file.read() return license_key def update_function(client, license_key, function_names): for name in function_names: config = client.get_function_configuration(FunctionName=name) config['Environment']['Variables']['DRIVERLESS_AI_LICENSE_KEY'] = license_key response = client.update_function_configuration( FunctionName= name, Environment= config['Environment'] ) print("{} License Key updated successfully! ".format(name)) def list_functions(client): response = client.list_functions() dai_functions = [] for funct in response['Functions']: if 'h2oai' in funct['FunctionName']: dai_functions.append(funct['FunctionName']) return dai_functions def main(): parser = argparse.ArgumentParser() parser.add_argument("--list", action='store_true', required=False, help="List all DAI lambda functions on the selected region. ") parser.add_argument("--update_all", action='store_true', required=False, help="Update all DAI Lambda functions on the selected region. ") parser.add_argument("--region", type=str, required=True, help="Region where the lambda function is deployed.") parser.add_argument("--name", type=str, required=False, help="The name of the Lambda function. ") parser.add_argument("--license_path", type=str, required=False, help="Location of the license.sig file") parser.add_argument("--aws_access_key_id", type=str, required=False, help="AWS Credentials") parser.add_argument("--aws_secret_access_key", type=str, required=False, help="AWS Credentials") args = parser.parse_args() if None not in (args.aws_access_key_id, args.aws_secret_access_key): os.environ['aws_access_key_id'] = args.aws_access_key_id os.environ['aws_secret_access_key'] = args.aws_secret_access_key client = boto3.client('lambda', region_name=args.region) if args.update_all or args.list: dai_functions = list_functions(client) print("H2O Driverless AI Lambda Functions in {}: {}".format(args.region, dai_functions)) _functions = [] if args.update_all: _functions = dai_functions elif args.name is not None: _functions.append(args.name) else: print("Please set a name of a function to update") if args.license_path is not None: license_key = load_license(args.license_path) elif "DRIVERLESS_AI_LICENSE_FILE" in os.environ: license_key = load_license(os.environ['DRIVERLESS_AI_LICENSE_FILE']) elif "DRIVERLESS_AI_LICENSE_KEY" in os.environ: license_key = os.environ['DRIVERLESS_AI_LICENSE_KEY'] else: print("No License Found") return 0 update_function(client, license_key, _functions) if __name__ == '__main__': main()
To run the script, you will need to provide the following:
The region where the MOJOs have been deployed. Note that this script must be run for each region that includes deployed MOJOs.
The Lambda function name
The Driverless AI license path
You AWS secret key ID
Your AWS secret access key
# run the upgrade script python update_lambda.py --update_all --region [deployed_region] --name [Lambda_function_name] --license_path [path_to_license_file] --aws_access_key_id [AWS_ACCESS_KEY_ID] --aws_secret_access_key [AWS_SECRET_ACCESS_KEY] # optionally view the help using either python or python3 python update_lambda.py --help