BookmarkSubscribeRSS Feed

SAS Grid Manager for Hadoop: test program for your environment

Started ‎07-19-2021 by
Modified ‎07-19-2021 by
Views 4,167

Customers that want to co-locate analytic workload on their Hadoop clusters typically, if not always, require an integration of the workload with YARN. SAS Grid Manager for Hadoop was created specifically for those customers who wish to co-locate their SAS Grid jobs on the same hardware used for their Hadoop cluster. It provides integration with YARN and Oozie such that the submssion of any SAS Grid job is under the control of YARN. 

 

This program will get a list of hosts available to a SAS Application Server Context and SIGNON to each of the hosts using YARN.

 

options nosource; /* Do not show source when running... */
options linesize=MAX; /* Try not to wrap output */

/********************************************************************
 ** Set the name of the SAS Application Server context to use.
 */
%let appsrv=SASApp;

/********************************************************************
 ** Setup metadata values if not running in a workspace server
options metaserver="myServer.myDomain.com";
options metaport=8561;
options metauser="myUser";
options metapass="myPassword";
*/

/********************************************************************
 ** Make sure we can use the grid.
 */
%put rc=%sysfunc(grdsvc_enable(_ALL_,"server=&appsrv;jobname=jobNameVar;jobopts=jobOptVar;"));
%let jobNameVar=SAS Grid Manager for Hadoop Test Program;

/********************************************************************
 ** Get a list of the hosts we want to verify
 */
%let hostList = %sysfunc(grdsvc_hostlist(server=&appsrv));
%put ==>>GRIDTEST<<======================================================;
%put ==>>GRIDTEST<<== Host List is "&hostList";
%put ==>>GRIDTEST<<======================================================;

/********************************************************************
 ** Macro that will perform the SIGNONs and RSUBMITS
 */
%macro runjobs(hostList);
	%let i=1;

	/******************************************************************
	 ** For each host in the list, perform an asynchronous SIGNON
	 */
	%do %while (&i > 0);
		%let host=%scan(%BQUOTE(&hostList),&i,',');

		%if ("&host" ne "") %then
			%do;
				%global host&i.Name;
				%global host&i.Signon;
				%global host&i.Rsubmit;
				%let host&i.Name=&host;
				%let host&i.Signon=0;
				%let host&i.Rsubmit=0;
				%put ==>>GRIDTEST<<======================================================;
				%put ==>>GRIDTEST<<== Performing SIGNON to host "&host";
				%put ==>>GRIDTEST<<======================================================;
				%let jobOptVar=testHost=&host;
				SIGNON host&i SIGNONWAIT=NO CMACVAR=host&i.Signon;
				%let hostCount=&i;
				%let i=%eval(&i+1);
			%end;
		%else %let i=0;
	%end;

	%put There are &hostCount hosts in the grid;

	/******************************************************************
	 ** Wait for each host to finish the SIGNON and when one finishes,
	 ** RSUBMIT code for it to report its name
	 */
	%let hostRsubmits=0;
	%let waitList=;
	%let loops=0;

	%do %while (&hostRsubmits < &hostCount and &loops < 10);
		%let i=1;

		%do %while (&i le &hostCount);

			%* %put Host &i (&&host&i.Name) Submit is &&host&i.Signon and Rsubmit is &&host&i.Rsubmit;
			%if (&&host&i.Signon eq 0) and (&&host&i.Rsubmit eq 0) %then
				%do;
					%put ==>>GRIDTEST<<======================================================;
					%put ==>>GRIDTEST<<== Submitting SAS code to "&&host&i.Name";
					%put ==>>GRIDTEST<<======================================================;

					%SYSLPUT remoteHost=&&host&i.Name /remote=host&i;
RSUBMIT host&i WAIT=NO;

%macro doit;
	%put ==>>GRIDTEST<<======================================================;
	%put ==>>GRIDTEST<<== This code is expected to run on "&remoteHost";
	%put ==>>GRIDTEST<<== This code is actually running on "&SYSTCPIPHOSTNAME";
	%put ==>>GRIDTEST<<======================================================;
%mend;

%doit;
ENDRSUBMIT;
%let hostRsubmits=%eval(&hostRsubmits+1);
%let host&i.Rsubmit=1;
%let waitList=&waitList host&i;
%end;

%let i=%eval(&i+1);
%end;

%if (&hostRsubmits < &hostCount 0) %then
	%let rc=%sysfunc(sleep(2,1));
%let loops=%eval(&loops+1);
%end;

/******************************************************************
 ** Wait for all RSUBMITs to all hosts to complete.
 */
waitfor _all_ &waitList;
%mend;

/********************************************************************
 ** Perform a signon to each host in the host list.
 */
%runjobs(%BQUOTE(&hostList));

/********************************************************************
 ** Terminate all connections in the grid.
 */
signoff _all_;
Version history
Last update:
‎07-19-2021 12:47 PM
Updated by:
Contributors

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags