DATA Step, Macro, Functions and more

Multiprocessing: starting a new SAS thread

Reply
Contributor
Posts: 48

Multiprocessing: starting a new SAS thread

Hello,

When i a new thread with SASCMD ( signon _001 sascmd="!sascmd";
data _null_;call sleep (5,1); run;
I want to start another thread from thread, which i started;
rsubmit _001;
signon _002 sascmd="!sascmd" ;

Signon comes ok, but when i rsubmit _002; occurs some errors.
Here is code and log.

*********************
CODE
********************

dm log "clear";
signon _001 sascmd="!sascmd" ;

data _null_;
call sleep(5,1);
put "Wait for signon 1";
run;

rsubmit _001 wait=no macvar=JOB001 signonwait=y persist=n ;
signon _002 sascmd="!sascmd" ;
data _null_;
call sleep(5,1);
put "wait for signon 2";
run;
rsubmit _002 wait=no signonwait=y persist=n ;
data _null_;
put "Rsubmit on _002 ok";
run;
endrsubmit ;
endrsubmit ;

*****************
LOG
*****************

327 dm log "clear";
328 signon _001 sascmd="!sascmd" ;
NOTE: Remote signon to _001 commencing (SAS Release 9.01.01M3P072804).
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) 9.1 (TS1M3)
NOTE: This session is executing on the XP_PRO platform.



NOTE: SAS initialization used:
real time 2.53 seconds
cpu time 1.24 seconds

NOTE: Remote signon to _001 complete.
329
330 data _null_;
331 call sleep(5,1);
332 put "Wait for signon 1";
333 run;

Wait for signon 1
NOTE: DATA statement used (Total process time):
real time 5.01 seconds
cpu time 0.01 seconds


334
335 rsubmit _001 wait=no macvar=JOB001 signonwait=y persist=n ;
NOTE: Background remote submit to _001 in progress.

NOTE: Remote submit to _001 commencing.
1 signon _002 sascmd="!sascmd" ;
NOTE: Remote signon to _002 commencing (SAS Release 9.01.01M3P072804).
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) 9.1 (TS1M3)
NOTE: This session is executing on the XP_PRO platform.



NOTE: SAS initialization used:
real time 2.29 seconds
cpu time 1.38 seconds

NOTE: Remote signon to _002 complete.
2 data _null_;
3 call sleep(5,1);
4 put "wait for signon 2";
5 run;

wait for signon 2
NOTE: DATA statement used (Total process time):
real time 5.07 seconds
cpu time 0.06 seconds


6 rsubmit _002 wait=no signonwait=y persist=n ;
NOTE: Background remote submit to _002 in progress.
NOTE: Remote submit to _001 complete.
NOTE: Remote signoff from _001 commencing.
ERROR: A communication subsystem partner conversation takedown request failure has occurred.
ERROR: Communication Subsystem Request Parameter Error: Invalid conversation identifier.

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
real time 19.06 seconds
cpu time 2.49 seconds

NOTE: Remote signoff from _001 complete.
Super Contributor
Posts: 474

Re: Multiprocessing: starting a new SAS thread

Hi.

That's not the way it is suppose to work.

Threads are submitted one next to each other (parallel) not one from each other (nested).

From your code, you are starting _002, from _001, instead both should initiate from the main/parent thread.

See the online doc here:
http://support.sas.com/documentation/cdl/en/connref/61908/HTML/default/a000585202.htm

Cheers from Portugal.

Daniel Santos @ www.cgd.pt
Contributor
Posts: 48

Re: Multiprocessing: starting a new SAS thread

Thank You for your answer, Daniel,

I understand about setting threads from main thread, but in my situation i have to start a thread inside one child thread.

Is it possible?
PROC Star
Posts: 1,567

Re: Multiprocessing: starting a new SAS thread

I don't see why it shouldn't work, and it almost does.

Some parameters seem to cause issues though. This works:


dm log "clear";
signon _001 sascmd="!sascmd" ;

data _null_;
call sleep(5,1);
put "==> Wait for signon 1";
run;

rsubmit _001 wait=no macvar=JOB001 signonwait=y persist=n ;
data _null_;
put "==> Rsubmit on _001 ok";
run;
signon _002 sascmd="!sascmd" ;
data _null_;
call sleep(5,1);
put "==> Wait for signon 2";
run;
libname rwork server=_002 slibref=work;
******rsubmit _002 wait=no signonwait=y persist=n ;
rsubmit _002 wait=yes;************* works with this change ;
data _null_;
put "==> Rsubmit on _002 ok";
run;
endrsubmit ;

endrsubmit ;
Contributor
Posts: 48

Re: Multiprocessing: starting a new SAS thread

Thank you, Chris, that worked.

Besides, the option that must be "excluded" is signonwait=n.

Well there's some problems about inhering libraries in the "second" singon.
Here is the code. And log that was produced:


***************** CODE *******************;
dm log "clear";
signon _001 sascmd="!sascmd" inheritLib=(WORK=WORK1);

data _null_;
call sleep(5,1);
put "==> Wait for signon 1";
run;

rsubmit _001 wait=no macvar=JOB001 signonwait=y persist=n ;
data _null_;
put "==> Rsubmit on _001 ok";
run;
signon _002 sascmd="!sascmd" inheritLib=(WORK=WORK2);
signoff _002;

***************** LOG *******************;

28 dm log "clear";
29 signon _001 sascmd="!sascmd" inheritLib=(WORK=WORK1);
NOTE: Remote signon to _001 commencing (SAS Release 9.01.01M3P020206).
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) 9.1 (TS1M3)

NOTE: This session is executing on the XP_PRO platform.



NOTE: (E9BX04) SAS 9.1.3 SP 4

NOTE: SAS initialization used:
real time 0.56 seconds
cpu time 0.26 seconds

NOTE: Remote signon to _001 complete.
30
31 data _null_;
32 call sleep(5,1);
33 put "==> Wait for signon 1";
34 run;

==> Wait for signon 1
NOTE: DATA statement used (Total process time):
real time 5.00 seconds
cpu time 0.15 seconds


35
36 rsubmit _001 wait=no macvar=JOB001 signonwait=y persist=n ;
NOTE: Background remote submit to _001 in progress.
NOTE: Remote submit to _001 commencing.
1 data _null_;
2 put "==> Rsubmit on _001 ok";
3 run;

==> Rsubmit on _001 ok
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds


4 signon _002 sascmd="!sascmd" inheritLib=(WORK=WORK2);
ERROR: Read Access Violation In Task [ CONNECT )
Exception occurred at (012D9718)
Task Traceback
Address Frame (DBGHELP API Version 4.0 rev 5)
012D9718 06B2C110 sashost:Main+0x2A88
60346FE4 06B2FEAC sasxdmr:mcn_main+0x5FE4
60391219 06B2FF88 saslcsrv:mcn_main+0x219
012E2B72 06B2FFA0 sashost:Main+0xBEE2
012E6C90 06B2FFB4 sashost:Main+0x10000
7C80B729 06B2FFEC kernel32:GetModuleFileNameA+0x1BA

ERROR: Generic critical error.
ERROR: Server init failed, INHERITLIB option will be ignored.
NOTE: Remote signon to _002 commencing (SAS Release 9.01.01M3P020206).
NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.
NOTE: All profile changes will be lost at the end of the session.
NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) 9.1 (TS1M3)

NOTE: This session is executing on the XP_PRO platform.



NOTE: (E9BX04) SAS 9.1.3 SP 4

NOTE: SAS initialization used:
real time 0.43 seconds
cpu time 0.40 seconds

NOTE: Remote signon to _002 complete.
5 signoff _002;
NOTE: Remote signoff from _002 commencing.
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
real time 0.45 seconds
cpu time 0.40 seconds

NOTE: Remote signoff from _002 complete.
NOTE: Remote submit to _001 complete.
NOTE: Remote signoff from _001 commencing.
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
real time 6.95 seconds
cpu time 0.85 seconds

NOTE: Remote signoff from _001 complete.
Ask a Question
Discussion stats
  • 4 replies
  • 308 views
  • 0 likes
  • 3 in conversation