Main Content

Update MATLAB Job Scheduler Startup Parameters

The scripts for the mjs service run using several default parameters that you can define in the mjs_def file. The parameters in the mjs_def file allow you to customize the features in your MATLAB® Job Scheduler.

For example, you can modify the mjs_def file to:

  • Set cluster security.

  • Adjust job scheduling and resource utilization settings.

  • Configure parameters to support dynamic scaling based on workload requirements.

  • Export metrics for live cluster monitoring and alerts.

If this is the first time you start MATLAB Job Scheduler, modify the mjs_def file before you start the mjs service, job manager, and workers. If you already have a MATLAB Job Scheduler running in your cluster, follow these instructions to stop the existing scheduler service, modify the mjs_def file, and restart the mjs service to apply your changes.

In the following instructions, matlabroot refers to the location of your installed MATLAB Parallel Server™ software. Where you see this term used in the instructions that follow, substitute the path to your location.

Modify mjs_def File

You can find the mjs_def file in these locations:

  • matlabroot\toolbox\parallel\bin\mjs_def.bat on Microsoft® Windows® operating systems

  • matlabroot/toolbox/parallel/bin/mjs_def.sh on Linux® operating systems.

You can edit the mjs_def file to update the default parameters before starting the mjs service. To learn more about all the user configurable parameters in the mjs_def file, see Define MATLAB Job Scheduler Startup Parameters.

The mjs service reads the mjs_def file when you start or stop the mjs service, run the mjs service with the console option, or install or uninstall the mjs service on a Windows operating system. When you start and stop workers and job managers, they contact the mjs service they are running under to obtain the values of the definitions and defaults stored in this file. Thus, the mjs service does not read the mjs_def file again when you start and stop workers and job managers. When you make a change to the mjs_def file, you must restart the mjs service, job manager and workers on each node to apply your changes.

Note

For a working cluster setup, the mjs_def file must use consistent settings across all nodes of the cluster. If you have a shared file system, all nodes can point to the same mjs_def file.

If this is the first time you start MATLAB Job Scheduler, to start the mjs service, job manager, and workers, see Start MATLAB Job Scheduler Services.

If you already have a MATLAB Job Scheduler running in your cluster, stop the mjs service, job manager and workers of the existing MATLAB Job Scheduler, edit the mjs_def file, then restart the mjs service, job manager, and workers to apply your changes. For instructions, see Stop and Restart MATLAB Job Scheduler Services.

Stop and Restart MATLAB Job Scheduler Services

  1. To stop the mjs service, job manager, and workers, select one of these options:

  2. Make the required changes to the mjs_def file.

  3. To restart the mjs service, job manager, and workers, select one of these options:

Start MATLAB Job Scheduler Services

If this is the first time you start MATLAB Job Scheduler, after you have made the required changes to the mjs_def file, select one of these options to start the mjs service, job manager and workers.

Specify an Alternative mjs_def File

Alternatively, you can make a copy of the mjs_file file, modify the copy, and specify that this copy be used for the default parameters.

To start the mjs service with the alternative defaults file, specify the file in the mjs command.

On Linux operating systems, enter the command:

mjs start -mjsdef my_mjs_def.sh

On Windows operating systems, enter the command:

mjs install -mjsdef my_mjs_def.bat
mjs start -mjsdef my_mjs_def.bat

If you specify a new mjs_def file instead of the default file for the service on one computer, the new file is not automatically used by the mjs service on other computers. If you want to use the same alternative file for all your mjs services, you must specify it for the mjs service you start on each cluster node.

Note

The startup script flags take precedence over the settings in the mjs_def file.

Start in a Clean State

When a job manager or worker starts up, it normally resumes its session from the past. This way, a job queue is not destroyed or lost if the job manager machine crashes or if the job manager is inadvertently shut down. However, there are situations where an admin might want to start a job manager in a clean state. For instance, if the job manager's state is corrupted or contains errors, starting from a clean state can resolve these issues.

To start up a job manager or worker from a clean state, with all history deleted, use the -clean flag on the startjobmanager and startworker commands. This deletes all checkpoint information stored on disk from previous instances of this job manager and workers before starting. The job manager initializes with no existing jobs or tasks.

startjobmanager -clean -name MyJobManager
startworker -clean -jobmanager MyJobManager

Note

Using the -clean flag permanently removes all existing job data. Be sure this data is no longer needed before removing it.

See Also

Topics