NOTE: Active Session now server. NOTE: Added action set 'modelPublishing'. NOTE: Added action set 'ds2'. NOTE: Added action set 'table'. NOTE: Running DATA program on one node NOTE: Execution succeeded. One row affected. NOTE: Running 'modelPublishing' action set with 3 workers. NOTE: Creating new model table 'TempModel_CD825DD5-21A2-8046-82AC-04141A4EB3BC'. NOTE: Model 'TempModel_CD825DD5-21A2-8046-82AC-04141A4EB3BC' has been successfully published to model table 'TempModel_CD825DD5-21A2-8046-82AC-04141A4EB3BC'. 1 ds2_options sas; 2 package CODE_FILE_SCORE / inline; 3 dcl package pymas py; 4 dcl double pystop; 5 dcl package logger logr('App.tk.MAS'); 6 7 /*end custom function code */ 8 method execute( 9 double Bid 10 , varchar(2) state 11 , in_out varchar bidCommand 12 ); 13 14 dcl nvarchar(10485760) pypgm; 15 dcl double rc; 16 dcl double revision; 17 if null(py) and pystop ^= 1 then do; 18 py = _new_ pymas(); 19 if inmas() then do; 20 rc = py.useModule('"CODE_FILE_SCORE_py_-735115405"', 1); 21 end; 22 else do; 23 rc = 1; 24 end; 25 if rc then do; 26 rc = py.appendSrcLine('#/*{"signatureExtension":[{"name":"Bid","description":"","length":null,"defaultValue":null,"dataType":"boolean","direction":"input"},{"name":"state","description":"","length":"2","defaultValue":null,"dataType":"string","direction":"input"},{"name":"bidCommand","description":"","length":null,"defaultValue":null,"dataType":"string","direction":"output"}]}*/'); 27 rc = py.appendSrcLine(''''''' List all output parameters as comma-separated values in the "Output:" docString. Do not specify "None" if there is no output parameter. '''''''); 28 rc = py.appendSrcLine(''); 29 rc = py.appendSrcLine('def execute(Bid,state):'); 30 rc = py.appendSrcLine(' ''Output: bidCommand'''); 31 rc = py.appendSrcLine(' if Bid == 0:'); 32 rc = py.appendSrcLine(' bidCommand = ''Do NOT bid on this car!!!'''); 33 rc = py.appendSrcLine(' else:'); 34 rc = py.appendSrcLine(' bidCommand = ''Bid on this car!!!'''); 35 rc = py.appendSrcLine(' if state == ''CA'':'); 36 rc = py.appendSrcLine(' bidCommand = ''Buy anything from California!'''); 37 rc = py.appendSrcLine(' return bidCommand'); 38 pypgm = py.getSource(); 39 revision = py.publish(pypgm, '"CODE_FILE_SCORE_py_-735115405"'); 40 if revision < 1 then do; 41 pystop = 1; 42 logr.log( 'e', 'publish revision=$s', revision ); 43 return; 44 end; 45 end; 46 else do; 47 logr.log( 'e', 'useModule rc=$s', rc ); 48 end; 49 rc = py.useMethod('execute'); 50 if rc then do; 51 pystop = 1; 52 logr.log( 'e', 'useMethod rc=$s', rc ); 53 return; 54 end; 55 end; 56 if pystop ^= 1 then do; 57 rc = py.setBool ('Bid', Bid); 58 if rc then do; 59 logr.log( 'e', 'set Bid rc=$s', rc ); 60 return; 61 end; 62 rc = py.setString ('state', state); 63 if rc then do; 64 logr.log( 'e', 'set state rc=$s', rc ); 65 return; 66 end; 67 rc = py.execute(); 68 logr.log( 'd', 'execute rc=$s', rc ); 69 bidCommand = py.getString('bidCommand'); 70 end; 71 end; 72 endpackage; 73 74 thread score_codefile_execution_thread ; 75 76 dcl package CODE_FILE_SCORE codefiletest(); 77 dcl varchar(100) "bidCommand"; 78 79 dcl double "Bid"; 80 dcl varchar(2) "state"; 81 82 dcl double "Bid"; 83 dcl varchar(2) "state"; 84 85 keep "bidCommand"; 86 method run(); 87 88 dcl int localRC; 89 90 set "CASUSER(BT22939)"."Scenario_cd439530_e1ac_4693_a30c_5d3833523081" ( 91 92 ); 93 94 "Bid" = 0; 95 "state" = 'CA'; 96 97 codefiletest.execute( 98 "Bid" 99 , "state" 100 , "bidCommand" 101 ); 102 103 /* Expectation check for: "bidCommand" */ 104 if missing("bidCommand") or "bidCommand" ^= 'Buy anything from California!' then 105 put 'WARNING: EXPECTATIONS: The value of "bidCommand" does not match its expectation.'; 106 107 output; 108 end; 109 endthread; 110 111 data "caslib_sasdata36_t22939"."Prueba Python 1_Scenario_1_Prueba Python 1_2023-04-19_01-00-21_output" (overwrite=yes); 112 113 dcl thread score_codefile_execution_thread _t; 114 method run(); 115 set from _t threads=4; 116 output; 117 end; WARNING: EXPECTATIONS: The value of "bidCommand" does not match its expectation. NOTE: Running THREAD program on all nodes NOTE: Running DATA program on all nodes ERROR: Line 39: ERROR: Python launch _pyConnect Failure. Matplotlib created a temporary config/cache directory at /tmp/matplotlib-jlafrbbd because the default path (/viyatmp/python) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing. . ERROR: Line 39: ERROR: ***** Traceback (most recent call last): File "/opt/sas/viya/home/SASFoundation/misc/embscoreeng/mas2py.py", line 1005, in main mas = MAS2py() File "/opt/sas/viya/home/SASFoundation/misc/embscoreeng/mas2py.py", line 286, in __init__ for name in os.environ.keys(): File "/usr/local/lib/python3.6/_collections_abc.py", line 720, in __iter__ yield from self._mapping File "/usr/local/lib/python3.6/os.py", line 688, in __iter__ for key in self._data: RuntimeError: dic.. ERROR: Line 39: ERROR: tkmaspyPublish encountered a failure in tkmaspyConnect, rc=0x803FC009. ERROR: Line 39: Error reported by DS2 package pymas: ERROR: Line 39: DS2 "pymas" package encountered a failure in the 'publish' method. NOTE: Execution succeeded. One row affected. NOTE: Running 'modelPublishing' action set with 3 workers. NOTE: Execution of model 'TempModel_CD825DD5-21A2-8046-82AC-04141A4EB3BC' succeeded. NOTE: Cloud Analytic Services promoted table PRUEBA PYTHON 1_SCENARIO_1_PRUEBA PYTHON 1_2023-04-19_01-00-21_OUTPUT in caslib caslib_sasdata36_t22939 to table Prueba Python 1_Scenario_1_Prueba Python 1_2023-04-19_01-00-21_output in caslib caslib_sasdata36_t22939. NOTE: Cloud Analytic Services dropped table TempModel_CD825DD5-21A2-8046-82AC-04141A4EB3BC from caslib caslib_sasdata36_t22939.