domino logo
Tech Ecosystem
Get started with Python
Step 0: Orient yourself to DominoStep 1: Create a projectStep 2: Configure your projectStep 3: Start a workspaceStep 4: Get your files and dataStep 5: Develop your modelStep 6: Clean up WorkspacesStep 7: Deploy your model
Get started with R
Step 0: Orient yourself to Domino (R Tutorial)Step 1: Create a projectStep 2: Configure your projectStep 3: Start a workspaceStep 4: Get your files and dataStep 5: Develop your modelStep 6: Clean up WorkspacesStep 7: Deploy your model
Get Started with MATLAB
Step 1: Orient yourself to DominoStep 2: Create a Domino ProjectStep 3: Configure Your Domino ProjectStep 4: Start a MATLAB WorkspaceStep 5: Fetch and Save Your DataStep 6: Develop Your ModelStep 7: Clean Up Your Workspace
Step 8: Deploy Your Model
Scheduled JobsLaunchers
Step 9: Working with Domino Datasets
Domino Reference
Projects
Projects Overview
Revert Projects and Files
Revert a ProjectRevert a File
Projects PortfolioReference ProjectsProject Goals in Domino 4+
Git Integration
Git Repositories in DominoGit-based Projects with CodeSyncWorking from a Commit ID in Git
Jira Integration in DominoUpload Files to Domino using your BrowserCopy ProjectsFork and Merge ProjectsSearchSharing and CollaborationCommentsDomino Service FilesystemCompare File RevisionsArchive a Project
Advanced Project Settings
Project DependenciesProject TagsRename a ProjectSet up your Project to Ignore FilesUpload files larger than 550MBExporting Files as a Python or R PackageTransfer Project Ownership
Domino Runs
JobsDiagnostic Statistics with dominostats.jsonNotificationsResultsRun Comparison
Advanced Options for Domino Runs
Run StatesDomino Environment VariablesEnvironment Variables for Secure Credential StorageUse Apache Airflow with Domino
Scheduled Jobs
Domino Workspaces
WorkspacesUse Git in Your WorkspaceUse Visual Studio Code in Domino WorkspacesPersist RStudio PreferencesAccess Multiple Hosted Applications in one Workspace Session
Spark on Domino
On-Demand Spark
On-Demand Spark OverviewValidated Spark VersionConfigure PrerequisitesWork with your ClusterManage DependenciesWork with Data
External Hadoop and Spark
Hadoop and Spark OverviewConnect to a Cloudera CDH5 cluster from DominoConnect to a Hortonworks cluster from DominoConnect to a MapR cluster from DominoConnect to an Amazon EMR cluster from DominoRun Local Spark on a Domino ExecutorUse PySpark in Jupyter WorkspacesKerberos Authentication
On-Demand Ray
On-Demand Ray OverviewValidated Ray VersionConfigure PrerequisitesWork with your ClusterManage DependenciesWork with Data
On-Demand Dask
On-Demand Dask OverviewValidated Dask VersionConfigure PrerequisitesWork with Your ClusterManage DependenciesWork with Data
Customize the Domino Software Environment
Environment ManagementDomino Standard EnvironmentsInstall Packages and DependenciesAdd Workspace IDEsAdding Jupyter Kernels
Partner Environments for Domino
Use MATLAB as a WorkspaceUse Stata as a WorkspaceUse SAS as a WorkspaceNVIDIA NGC Containers
Advanced Options for Domino Software Environment
Install Custom Packages in Domino with Git IntegrationAdd Custom DNS Servers to Your Domino EnvironmentConfigure a Compute Environment to User Private Cran/Conda/PyPi MirrorsUse TensorBoard in Jupyter Workspaces
Publish your Work
Publish a Model API
Model Publishing OverviewModel Invocation SettingsModel Access and CollaborationModel Deployment ConfigurationPromote Projects to ProductionExport Model Image
Publish a Web Application
App Publishing OverviewGet Started with DashGet Started with ShinyGet Started with FlaskContent Security Policies for Web Apps
Advanced Web Application Settings in Domino
App Scaling and PerformanceHost HTML Pages from DominoHow to Get the Domino Username of an App Viewer
Launchers
Launchers OverviewAdvanced Launcher Editor
Assets Portfolio Overview
Model Monitoring
Model Monitoring APIsAccessing The Model MonitorGet Started with Model MonitoringModel Monitor DeploymentIngest Data into The Model MonitorModel RegistrationMonitoring Data DriftMonitoring Model QualitySetting Scheduled Checks for the ModelConfigure Notification Channels for the ModelUse Model Monitoring APIsProduct Settings
Connect to your Data
Data in Domino
Datasets OverviewDatasets Best Practices
Data Sources Overview
Connect to Data Sources
External Data Volumes
Work with Data Best Practices
Work with Big Data in DominoWork with Lots of FilesMove Data Over a Network
Advanced User Configuration Settings
User API KeysDomino TokenOrganizations Overview
Use the Domino Command Line Interface (CLI)
Install the Domino Command Line (CLI)Domino CLI ReferenceDownload Files with the CLIForce-Restore a Local ProjectMove a Project Between Domino DeploymentsUse the Domino CLI Behind a Proxy
Browser Support
Get Help with Domino
Additional ResourcesGet Domino VersionContact Domino Technical SupportSupport Bundles
domino logo
About Domino
Domino Data LabKnowledge BaseData Science BlogTraining
User Guide
>
Get Started with MATLAB
>
Step 8: Deploy Your Model
>
Launchers

Launchers

Launchers are simple web forms that you can use to run templatized scripts. They are especially useful if your script has command line arguments that dynamically change the way the script executes. For heavily customized scripts, those command line arguments can quickly get complicated. Use Launchers to expose all that as a simple web form.

To do this with MATLAB, you will refactor the .m file used in your scheduled job as a function, and give Launcher users the ability to specify the following parameters:

  • The NOAA station ID (station IDs are listed here: GHCND Stations

  • A "hot day" temperature threshold

Step 7.1: Update the scheduled job code

  1. Start a new MATLAB Workspace.

  2. Open the file you previously created, predictWeatherReport.m, and save it as predictWeatherReportLauncher.m.

  3. Copy and paste the following to the top of the script. This wraps the previous code with a function statement.

    Note
    function result = predictWeatherReport(weatherStationId, hotDayThreshold)
  4. Copy and paste the following over lines in the Initial setup section in the existing script to refactor the code:

    result = struct;
    
    %% Download data file
    baseUrlString = "https://www.ncei.noaa.gov/data/global-historical-climatology-network-daily/access/";
    
    % compose the URL for the NOAA station ID specified as an input parameter
    urlString = sprintf("%s%s%s", baseUrlString, weatherStationId, ".csv");
    % save the data into the /data subfolder
    savedFileName = sprintf("%s%s%s%s", "data", filesep, weatherStationId, ".csv");
    websave(savedFileName, urlString);
    Note
  5. Because those using Launcher will be able to request predictions for any weather station, copy and paste the following code to verify whether a model for the station exists.

    Note
    %% Check if we have a model for this weather station
    modelFileName = sprintf("%s%s%s%s", "models", filesep, ...
        weatherStationId, ".mat");
    
    % make sure we have a folder for the models
    if ~isfolder('models')
        mkdir('models')
    end
    
    if ~isfile(modelFileName)
      disp('Training model for weather station...')
      cv = cvpartition(stationWeatherTbl.year, 'Holdout', 0.3);
      dataTrain = stationWeatherTbl(cv.training, :);
    
      [weatherModel, validationRMSE] = trainRegressionModel(dataTrain);
    
      % display prediction precision
      doneMessage = sprintf('%s%d', "Done. Model RMSE:", validationRMSE);
      disp(doneMessage);
      save(modelFileName, 'weatherModel');
    else
      load(modelFileName, 'weatherModel');
    end
    Note
    Note
  6. Add the end statement for the function.

    %% Function end
    end % This is the end of the function
  7. Click the Save and then Sync All Changes to save your work. Stop the workspace.

Step 7.2: Set up the shell script for the Launcher

  1. Close the workspace tab in your browser.

  2. In the navigation pane, go to Files to create a shell script that will tell the Launcher which MATLAB script to run. The shell script will also identify the parameters to pass to the script from the launcher.

    files nav pane

  3. Click the new file icon to create a new file. Name the file weather_launcher.sh.

    new file icon

  4. Add the following code starting on line 1 of the file:

    matlab -nodisplay -nodesktop -nosplash -r " predictWeatherReportLauncher('$1', $2)"

    This line of code instructs Domino to run MATLAB from the command line and execute the predictWeatherReportLauncher script with two arguments. MATLAB will look for the function in an .m file with the same name as the function.

  5. Click Save.

Step 7.3: Create the Launcher

  1. From the navigation pane, click Launchers, then click New Launcher.

  2. Type a descriptive title (for example, Weather Predictor), a description, and select a hardware tier. In the Command to run section, enter weather_launcher.sh.

    new launcher

  3. Click Add Parameter. The parameter options open.

  4. In the "Command to run" field, replace parameter1 with station_id. You’ll notice the parameter’s name updates in the form. Confirm that the parameter name remains enclosed within ${}, such that the parameter is formatted as such: ${name_of_the_parameter}.

    station id in form

  5. Give the parameter a default value of MXM00076680 (for Mexico City) for the station ID. The default value will be used if the user doesn’t enter a value in the Launcher form. In the description, enter "The ID of the station for which to predict weather".

    station id var

  6. Click Add Parameter.

  7. In the Command to run field, enter hot_temp as the parameter’s name between the curly brace4s \{}. This parameter represents the hot temperature threshold.

  8. Click hot_temp in the table. Leave the parameter’s type as Text and enter a default value (for example, 30) and a description for the parameter.

    hot temp

  9. Click Save Launcher, then click Back to Launchers. The new launcher is listed.

    complete launcher

  10. Click Run. The launcher form opens. Type a title for your run (for example, "First launcher run") and click Run.

    first launcher run

  11. The Jobs view opens while your launcher executes the job. The job number is listed in the No. column. Double-click the row to see the results as Domino runs the job.

    launcher job

  12. The job produces a PDF report. To access the PDF report:

    • Go to the navigation pane and click Files.

    • Open the results folder and open the folder created by your job (in this example, it is folder 36/).

      access pdf

  13. Click the PDF file to open it.

    pdf output

Domino Data LabKnowledge BaseData Science BlogTraining
Copyright © 2022 Domino Data Lab. All rights reserved.