Main Content

wait (cluster)

Wait for cloud cluster to change state

Description

wait(cluster) blocks execution in the client MATLAB session until cluster reaches the 'online' state. The 'online' state indicates that the cluster is running and you can use all requested workers to run jobs.

wait(cluster,state) blocks execution in the client session until cluster changes state. For a cluster object, the valid states are:

  • 'online': The cluster is running and you can use all requested workers to run jobs.

  • 'waitingforworkers': The cluster is running, and you can use some but not all of the requested workers to run jobs. You can still use the cluster in this state with the workers that are available.

  • 'offline': The cluster is not running, but you can restart using the start() command or via https://cloudcenter.mathworks.com. If the cluster has shared persisted storage, then any previous jobs in the queue are still present when you restart the cluster.

example

OK = wait(cluster,state,timeout) blocks execution in the client session until cluster changes state, or until timeout seconds have elapsed, whichever happens first. OK is true if state has been reached or a terminal state such as 'error' occurs. OK is false in case of a timeout.

example

Examples

collapse all

In Cluster Profile Manager, select MATLAB® Parallel Server™ for Amazon EC2® as your default cluster profile.

Create and start a cloud cluster using the default profile.

cluster = parcluster;
start(cluster);

Wait until the cluster is running. Use all requested workers to run jobs.

wait(cluster,'online');

In Cluster Profile Manager, select MATLAB Parallel Server for Amazon EC2 as your default cluster profile.

Create and start a cloud cluster using the default profile.

cluster = parcluster;
start(cluster);

Wait 100 seconds for the head node and all workers to start.

OK = wait(cluster,'online',100);

Input Arguments

collapse all

MATLAB Parallel Server for Cloud Center cluster, specified as cluster object created using parcluster.

Example: wait(cluster);

Cloud cluster state, specified as a cluster object, for which the valid states are 'online', 'waitingforworkers', and 'offline'.

Example: wait(cluster,'online');

Time elapsed before cloud cluster changes state, specified in seconds.

Example: wait(cluster,'online',100);

Output Arguments

collapse all

Check if state has been reached, specified as a Boolean. OK is true if state has been reached or a terminal state such as 'error' occurs. OK is false in case of a timeout.

Example: OK = wait(cluster,'waitingforworkers',10);

Version History

Introduced in R2017a