Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mv_jobflow.test.1.sas
Go to the documentation of this file.
1/**
2
3 @file
4 @brief Testing mv_jobflow macro
5 @details One of the remote jobs aborts with syscc>0 - test to
6 make sure this comes back to the calling session
7‚Äč
8 <h4> SAS Macros </h4>
9 @li mp_assert.sas
10 @li mv_createjob.sas
11 @li mv_jobflow.sas
12
13**/
14
15/**
16 * Test Case 1
17 */
18
19filename testprog temp;
20data _null_;
21 file testprog;
22 put '%put this is job: &_program;'
23 / '%put this was run in flow &flow_id;'
24 / 'data ;'
25 / ' rval=rand("uniform");'
26 / ' rand=rval*&macrovar1;'
27 / ' do x=1 to rand;'
28 / ' y=rand*&macrovar2;'
29 / ' if (rval>0.50) then abort;'
30 / ' else output;'
31 / ' end;'
32 / 'run;'
33 ;
34run;
35
36%mv_createjob(path=/Public/temp,name=demo1,code=testprog)
37%mv_createjob(path=/Public/temp,name=demo2,code=testprog)
38
39data work.inputjobs;
40 _contextName='SAS Job Execution compute context';
41 do flow_id=1 to 2;
42 do i=1 to 4;
43 _program='/Public/temp/demo1';
44 macrovar1=10*i;
45 macrovar2=4*i;
46 output;
47 i+1;
48 _program='/Public/temp/demo2';
49 macrovar1=40*i;
50 macrovar2=44*i;
51 output;
52 end;
53 end;
54run;
55
56* Trigger the flow ;
57
58%put NOTE: &=syscc;
59
60%mv_jobflow(inds=work.inputjobs
61 ,maxconcurrency=2
62 ,outds=work.results
63 ,outref=myjoblog
64 ,raise_err=1
65 ,mdebug=1
66)
67
68%put NOTE: &=syscc;
69
70data _null_;
71 infile myjoblog;
72 input; put _infile_;
73run;
74
75%mp_assert(
76 iftrue=(&syscc ne 0),
77 desc=Check that non zero return code is returned if called job fails
78)