GRDSVC_NNODES Function

Reports the total number of job slots that are available for use on a grid.
Valid in: %SYSFUNC or %QSYSFUNC Macro, DATA step
Category: Grid

Syntax

grdsvc_nnodes(argument;option)

Without Arguments

Required Argument

SASAPPSERVER=SAS-application-server
specifies the name of the SAS Application Server that has been defined in the SAS Metadata Repository. The SAS Application Server contains the definition for the logical grid server that is used to access the grid environment. The name of the SAS Application Server is passed to Platform Suite for SAS as a required resource. Platform Suite for SAS selects the grid nodes that meet the requirements for the specified SAS Application Server and returns the total number of job slots in the grid.
An exception to this behavior is when the SAS Application Server is disabled as a required resource for the grid server. For details see the SASAPPSERVER= option for the GRDSVC_ENABLE function.
Alias:SERVER=, RESOURCE=
Interaction:If SAS-application-server contains one or more spaces, the spaces are converted to underscores before the name is passed to Platform Suite for SAS.
Example:
%let
numofnodes%sysfunc(grdsvc_nnodes(server=SASApp));

Optional Argument

WORKLOAD=workload-value
identifies the resource for the type of job to be executed on the grid. This value specifies the workload requirements for which Platform Suite for SAS selects the grid nodes that contain these resources.
The specified workload value should match one of the workload values that is defined in the SAS Application Server in the SAS Metadata Repository.
Requirement:If you specify WORKLOAD=, you must also specify the SASAPPSERVER= option. Workload values are case sensitive.
Interaction:If workload-value contains one or more spaces, the spaces are converted to underscores before the value is passed to Platform Suite for SAS. If workload-value is not located in the SAS Application Server definition and no other errors occur, a 0 result code is returned. A 0 result code means that no grid nodes contain the requested resources. Also, this note is displayed:
NOTE: Workload value "gridResource" does not exist in the SAS Metadata Repository.
If workload-value is undefined to Platform Suite for SAS, the GRDSVC_NNODES function returns the result code 0.
Tip:For Platform Suite for SAS, this workload-value corresponds with the resource that the LSF administrator has configured in the lsf.cluster.cluster-name file and the lsf.shared file on the grid-control computer.
Example:
%let
numofnodes=%sysfunc(grdsvc_nnodes(server=SASApp; workload=em));
The workload value, EM , specifies the resource name. EM must be assigned to a grid node in order to process this job. An example is assigning EM to machines that can process SAS Enterprise Miner jobs.

Details

When a grid environment is available, the GRDSVC_NNODES function returns the total number of job slots (busy and idle) that are available for job execution. This value is resolved at the time that the function is called. Because of this, the value might vary over time, according to whether job slots have been added or removed from the grid. It can also vary based on the user, the queue that is being used, or other slot limits that are defined in the LSF configuration.
Here are the result codes:
GRDSVC_NNODES Function Result Codes
Result Code
Explanation
nnn
If a grid environment is available, reports the total number of job slots (idle and busy) that have been configured in a grid environment. The grid contains the resources that are specified by the SASAPPSERVER= argument and the WORKLOAD= option.
If a grid environment is not available, assumes a multi-processor (SMP) environment, and reports the value of the CPUCOUNT system option. In this case, the lowest value that can be reported is 1.
1
If a grid environment is not available, assumes a multi-processor (SMP) environment, and reports the value of the CPUCOUNT system option. In this case, the lowest value that can be reported is 1.
0
reports that no grid nodes contain the requested resources.
–1
reports a syntax error in the function call. For example, a syntax error would result from supplying no value, or an empty string, to the SASAPPSERVER= option.

Example

/*-----------------------------------------------------------------------*/
/* Get the number of grid nodes that have 'SASApp' as a resource         */
/*-----------------------------------------------------------------------*/
%let NumNodes=%sysfunc(grdsvc_nnodes(server=SASApp));
/*-----------------------------------------------------------------------*/
/* Get the number of grid nodes that have 'SASApp'  'EM' as resources    */
/*-----------------------------------------------------------------------*/
%let
numofnodes=%sysfunc(grdsvc_nnodes(server=SASApp;workload=EM));

See Also

RSUBMIT statement
SAS/CONNECT User's Guide
SIGNON statement
SAS/CONNECT User's Guide
DATA step
SAS Language Reference: Dictionary
CPUCOUNT= system option
SAS Language Reference: Dictionary