Main Content

stopworker

R2026b

Stop MATLAB worker process

When you need to remove a worker from the cluster, use the stopworker script to stop it. You can stop the worker immediately, or wait for it to finish its current task by using the --onidle option.

The stopworker executable resides in the folder matlabroot\toolbox\parallel\bin (Windows® operating system) or matlabroot/toolbox/parallel/bin (Linux® operating system). Enter the command at a Windows or Linux command-line prompt, respectively.

Syntax

stopworker
stopworker --options

Description

stopworker stops a MATLAB® worker process that is running under the mjs service.

stopworker --options accepts the following options. You can use multiple options together in the same command. Precede each option with two dashes (--).

Before R2026b: To specify an option, use a single dash (-).

OptionOperation
--name <worker_name>

Specify the name of the MATLAB worker to stop. The default is the value of the DEFAULT_WORKER_NAME parameter in the mjs_def file.

--jobmanager

Specify the name of the job manager that manages the worker you want to stop. The default is the value of DEFAULT_JOB_MANAGER_NAME in the mjs_def file.

--onidle

Stop the MATLAB worker after it has finished its current task. If the MATLAB worker is idle, stop the worker immediately.

--clean

Delete all checkpoint information associated with this worker name after stopping it.

--remotehost <hostname>

Specify the host on which to stop the MATLAB worker. If you do not specify a host, the command stops the worker on the local host.

--baseport <port_number>

Specify the base port used by the mjs service on the remote host. Use this option only when the remote host's base port differs from the local BASE_PORT value in the mjs_def file.

--secretfile <path_to_shared_secret_file>

Specify the path to the shared secret file to use to sign the command. This option is required when the mjs_def file of the mjs service has REQUIRE_SCRIPT_VERIFICATION=true. If you do not use this option and the mjs services requires script verification, the command attempts to use the secret file in the default location:

$CHECKPOINTBASE/security/secret

--verbose, -v

Display detailed progress information about the command execution.

Examples

Stop the worker with the default name on the local host.

stopworker

Stop the worker with the default name, running on the host WorkerHost.

stopworker --remotehost WorkerHost

Stop the workers named worker01 and worker02, running on the host WorkerHost.

stopworker --name worker01 --remotehost WorkerHost 
stopworker --name worker02 --remotehost WorkerHost