wait (cluster) - Wait for cloud cluster to change state - MATLAB (original) (raw)
Wait for cloud cluster to change state
Syntax
Description
wait([cluster](#d126e106583))
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](#d126e106583),[state](#d126e106620))
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 thestart()
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.
[OK](#d126e106678) = wait([cluster](#d126e106583),[state](#d126e106620),[timeout](#d126e106654))
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.
Examples
In , selectMATLAB® 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.
In , selectMATLAB 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
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
Check if state
has been reached, specified as a Boolean. OK
is true
ifstate
has been reached or a terminal state such as 'error
' occurs. OK
isfalse
in case of a timeout.
Example: OK = wait(cluster,'waitingforworkers',10);
Version History
Introduced in R2017a