I am trying to understand MPConnect and how I can use it for parallel processing.
As a simple example, I started a session which prints "Hello World!" forever and another which prints "Bye World!". I said "waitfor any" and "rget" and I expect "Bye World!" in the Log because "Hello World!" will go on forever while "Bye World!" has finished. Unfortunately, this doesn't work.
In general, I have great difficulties retrieving output from a remotely submitted task.
option cpucount=4 sascmd="!sascmd" autosignon;
rsubmit task1 wait=no;
data _null_;
do while(1);
put "Hello World!";
end;
run;
endrsubmit;
rsubmit task2 wait=no;
data _null_;
put "Bye World!";
run;
endrsubmit;
waitfor _any_;
rget;
signoff task1;
signoff task2;
The problems seems to be that when you have syncronous processes running they are completely disconnected from each other. Even though you're only waiting for the fast task2 to complete before continuing:
rsubmit task2 wait=no;
data _null_;
put "Bye World!";
run;
endrsubmit;
SAS needs task1 to complete as well for the final rget:
rsubmit task1 wait=no;
data _null_;
do while(1);
put "Hello World!";
end;
run;
endrsubmit;
I think what is happening is that SAS task2 satisfies the waitfor _any_ condition and is able to carry on processing after task2. However the rget needs the final log files of each (completed) process before it can merge them into the client session log window.
Have a look at the details section of the SAS documentation here:
EDIT:
Playing around a bit more, you can test the connections across them using a unified libname (each process has its own unique work libname so they can not conflict with each other):
Assign libname and options as required on the client machine:
libname testlib 'C:/test' ;
option cpucount=4 sascmd="!sascmd" autosignon;
Define two processes to run in parallel:
* Process 1 ;
rsubmit task1 wait=no;
libname testlib 'C:/test' ;
data testlib.test1 ;
do i=1 to 1000 ;
do j=1 to 1000;
output ;
end ;
end ;
run ;
endrsubmit;
* Process 2 ;
rsubmit task2 wait=no;
libname testlib 'C:/test' ;
data testlib.test2 ;
do i=1 to 1000 ;
output ;
end ;
run ;
endrsubmit;
You can then have this following code which will run while process1 is still running but it will be able to access the output dataset of process2:
* Wait for either of the above processes and the process remaining code;
waitfor _any_;
proc sql noprint ;
select sum(i)
into :result
from testlib.test2
;quit ;
%put *** SUM OF TEST2 IS: &result *** ;
The issue is that, just like you say, TASK1 is set to run forever. Specifically it is the statement
signoff task1;
That is causing your particular issue. As you are saying to the submitting process to wait for the indefinite process to end, and then sign off...
If instead you had
signoff task2;
killtask task1;
You would see that you do collect the log information from TASK2 with the RGET (which the SIGNOFF statement would also collect without the RGET). The information from TASK1 in this case is lost, but with the options mentioned already (LOG="task1.log") you can recover the information separately.
The RGET statement does not wait for everything to complete, in a case like this. It will collect what it can from any tasks that have completed at the time of the request, unless you specifically request the RGET TASK1, in which case it will pause there.
Related
I have to check by way of a script if a program stops at a breakpoint:
example:
break.set func1 /Program
Go
IF (program stops at breakpoint)
(
do smth
)
I am new to this language and I cannot seem to find relevant information on google.
Thank you
If you don't know whether the program stops at the program you need to wait a certain (defined by you) amount of time and then check the run-state of the processor, and if stopped then check whether the PC is at your symbol.
; set breakpoint
Break.Set func1 /Program
; start processor
Go
; wait until processor stopped or 5 seconds elasped
WAIT !STATE.RUN() 5.0s
IF STATE.RUN()
(
PRINT %ERROR "Processor still running!"
ENDDO
)
; check PC
IF R(PC)!=sYmbol.BEGIN(func1)
(
PRINT %ERROR "Processor stopped but wrong PC!"
ENDDO
)
PRINT "Test passed!"
ENDDO
If you actual goal is to execute a script when a breakpoint gets hit, I recommend to used the option /CMD of the Break.Set.
E.g.:
Break.Set func1 /Program /CMD "DO smth.cmm"
I am getting issue in SAS while executing the SAS job , getting error "Retrieving login information based on AuthenticationDomain from the SAS Metadata Server failed" My tables are in teradata server. please guide me.
Here I'm posting some piece of log file code, which I believe interpret the issue.
NOTE: CALL EXECUTE routine executed successfully, but no SAS statements were generated.
MPRINT(ETLS_GETPARAMETERS): ;
MPRINT(ETLS_PROCESSTOLOOPWPM8XG): ;
Process ID: 31002
MPRINT(ETLS_JOBWPM8XQ): options metaport = 8560 metaserver = "xxxl01010.xxxxxx.com.au";
MPRINT(ETLS_SETDEBUG): OPTIONS MPRINT;
MPRINT(ETLS_JOBWPM8XQ): ;
MPRINT(ETLS_JOBWPM8XQ): LIBNAME TDST1V TERADATA SERVER="xxxx8.xxxxxxx.xxx.xx" SCHEMA=IUSIT02_STG_ED_VIEW AUTHDOMAIN="Teradata
Auth" ;
NOTE: Libref TDST1V was successfully assigned as follows:
Engine: TERADATA
Physical Name: xxxx8.xxxxxxxx.com.XX
MPRINT(ETLS_JOBWPM8XQ): ;
MPRINT(ETLS_JOBWPM8XQ): options comamid=TCP;
MPRINT(ETLS_JOBWPM8XQ): data _null_;
MPRINT(ETLS_JOBWPM8XQ): signon AuthDomain="DefaultAuth" noscript;
ERROR: Retrieving login information based on AuthenticationDomain from the SAS Metadata Server failed.
ERROR: Remote signon canceled.
MPRINT(ETLS_JOBWPM8XQ): run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 352.59k
OS Memory 13464.00k
Timestamp 15/03/2017 02:39:09 AM
Step Count 84 Switch Count 55
Page Faults 0
Page Reclaims 9
Page Swaps 0
Voluntary Context Switches 209
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
140 The SAS System 02:01 Wednesday, March 15, 2017
MPRINT(ETLS_JOBWPM8XQ): data _null_;
MPRINT(ETLS_JOBWPM8XQ): if 9.4 ge 9 then rmtname = "/ remote = local";
MPRINT(ETLS_JOBWPM8XQ): else rmtname = "";
MPRINT(ETLS_JOBWPM8XQ): call execute('%syslput job_rc = &job_rc '||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ): call execute('%syslput trans_rc = &trans_rc '||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ): call execute('%syslput sqlrc = &sqlrc '||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ): call execute('%syslput syscc = &syscc '||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ): call execute('%syslput etls_stepStartTime = &etls_stepStartTime'||rmtname||';');
MPRINT(ETLS_JOBWPM8XQ): call execute('run;');
MPRINT(ETLS_JOBWPM8XQ): run;
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
ERROR: A link must be established by executing the SIGNON command before you can communicate with LOCAL.
I am trying to run the following code
filename hw&MONDATETO pipe "zcat&WTDATADIR.MidMonthly_&DATEFROM._&DATETO..txt.gz";
but keep getting the error message:
UNOTE: The infile HW200611 is:
Unnamed Pipe Access Device,
PROCESS=zcat O:\WTData\Monthly\v4\data\MidMonthly_20061014_20061113.txt.gz,
RECFM=V,LRECL=256
Stderr output:
'zcat' is not recognized as an internal or external command,
operable program or batch file.
NOTE: 0 records were read from the infile HW200611.
NOTE: The data set WORK.HW200611 has 0 observations and 9 variables.
NOTE: DATA statement used (Total process time):
real time 0.10 seconds
cpu time 0.03 seconds
I am running SAS in batch mode on Windows 2003 server. Any help would be greatly appreciated.
Could you tell me the default location of the logs
If you are after logs generated from your SAS program that you just submitted in interactive mode to your local or remote server, it will not be saved to any physical location unless you tell it do to so (see below for how to do it). The logs will be showed in your log window (for SAS Base) or Projec Log/Step Log if your are working from SAS EG. Other SAS applications have other locations.
If you need your program log to be saved in a specific location with specific filename, you need to use PROC PRINTTO.
Let say, you have a program that puts "Hello Worlds" in to your log and you are working on unix.
Example:
PROC PRINTTO log="/home/work/log.log";
QUIT;
DATA _null_;
put "Hello World";
RUN;
/* you need to run empty PROC PRINTTO in order to direct the logs into
defaul location (your interactive session window */
PROC PRINTTO;
QUIT;
RESULT LOG printed to a file log.log:
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
19
20 DATA _null_;
21 put "Hello World";
22 RUN;
Hello World
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
23
24 PROC PRINTTO;
25 QUIT;
I have a strange problem with my SAS base ETL program. The program runs perfectly fine in the program editor of SAS base, but it aborts in batch mode. I'm currently debugging the entire code and I came at the following problem. I'm using an infile statement to read a txt file from a certain location.
When I run the program in the program editor mode, the infile statement runs perfectly and the dataset reads the right amount of data. But when the program runs in the batch mode, it seems like the infile statement is completely ignored. The datasets reads nothing and remains empty with 0 observations.
Here is the code with the log:
DATA odd.mailables_&monthcode.;
length id_account 8
language_id $2
zip $4;
infile &file_name. delimiter='09'x firstobs=2 dsd pad missover end=last;
load_date_time=datetime();
if _n_=1 then
do;
call symputx ('start_load_date_time', load_date_time);
end;
format load_date_time datetime20.;
monthcode="&monthcode.";
input id_account
language_id $
zip $;
if last then
do;
call symputx ('end_load_date_time', load_date_time);
end;
RUN;
proc sort data=odd.mailables_&monthcode.;
by id_account;
run;
This is the log afterwards:
SYMBOLGEN: Macro variable FILE_NAME resolves to "D:\mailables.txt"
"D:\mailables.txt"
SYMBOLGEN: Macro variable MONTHCODE resolves to 20150506
SYMBOLGEN: Macro variable FILE_NAME resolves to "D:\mailables.txt"
SYMBOLGEN: Macro variable MONTHCODE resolves to 20150506
NOTE: The data set ODD.MAILABLES_20150506 has 0 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
Memory 141k
OS Memory 7864k
Timestamp 8/05/2015 14:32:50
SYMBOLGEN: Macro variable MONTHCODE resolves to 20150506
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
Memory 33k
OS Memory 7864k
Timestamp 8/05/2015 14:32:50
Is there a difference between the batch mode and the program editor mode in the way it reads the code or in the syntax you need to use?
Thanks for the information
A standard debugging technique is to reduce the code to the smallest simplest piece possible which still causes an error. Try running this, and see if there's a difference in output between Program Editor and batch.
data _null_;
infile 'D:\mailables.txt';
input;
put _infile_;
run;
(Sorry, only allowed to answer, not comment.)