@sasjs/core 5.2.3 → 5.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base/mp_abort.sas CHANGED
@@ -215,7 +215,13 @@ and %superq(SYSPROCESSNAME) ne %str(Compute Server)
215
215
  put ',"_DEBUG":' debug ;
216
216
  if symexist('_metauser') then do;
217
217
  _METAUSER=quote(trim(symget('_METAUSER')));
218
- put ",""_METAUSER"": " _METAUSER;
218
+ put ',"_METAUSER": ' _METAUSER;
219
+ end;
220
+ /* _METAPERSON is not always set when _METAUSER is (e.g. Viya JES
221
+ sessions provide only _METAUSER) - guard it separately or SYMGET
222
+ raises "Invalid argument" and pollutes SYSERRORTEXT inside the
223
+ very abort JSON we are writing here. */
224
+ if symexist('_metaperson') then do;
219
225
  _METAPERSON=quote(trim(symget('_METAPERSON')));
220
226
  put ',"_METAPERSON": ' _METAPERSON;
221
227
  end;
package/package.json CHANGED
@@ -41,5 +41,5 @@
41
41
  "maintainers": [
42
42
  "https://sasapps.io"
43
43
  ],
44
- "version": "5.2.3"
44
+ "version": "5.2.5"
45
45
  }
@@ -68,8 +68,10 @@
68
68
  @param [in] action=Either ALL (to wait for every job) or ANY (if one job
69
69
  completes, processing will continue). Default=ALL.
70
70
  @param [in] inds= The input dataset containing the list of job uris, in the
71
- following format: `/jobExecution/jobs/&JOBID./state` and the corresponding
72
- job name. The uri should be in a `uri` variable, and the job path/name
71
+ following format: `/jobExecution/jobs/&JOBID.` (a trailing `/state`
72
+ suffix, as returned by the mv_jobexecute state link, is also
73
+ accepted and will be stripped) and the corresponding job name.
74
+ The uri should be in a `uri` variable, and the job path/name
73
75
  should be in a `_program` variable.
74
76
  @param [in] raise_err=0 Set to 1 to raise SYSCC when a job does not complete
75
77
  succcessfully
@@ -151,7 +153,15 @@ options noquotelenmax;
151
153
  data _null_;
152
154
  length jobparams $32767;
153
155
  set &inds end=last;
154
- call symputx(cats('joburi',_n_),substr(uri,1,55),'l');
156
+ /* strip any trailing /state suffix - the poll below GETs the plain
157
+ job uri (whose root object carries the state field), and
158
+ downstream consumers (mv_getjoblog, the outds) expect the plain
159
+ job uri. Do not truncate: job uris are not a fixed length (a
160
+ definition uri passed in error must fail loudly, not be silently
161
+ corrupted into a 404). */
162
+ if length(strip(uri))>6 and substr(strip(uri),length(strip(uri))-5)='/state'
163
+ then uri=substr(strip(uri),1,length(strip(uri))-6);
164
+ call symputx(cats('joburi',_n_),strip(uri),'l');
155
165
  call symputx(cats('jobname',_n_),_program,'l');
156
166
  call symputx(cats('jobparams',_n_),jobparams,'l');
157
167
  if last then call symputx('uricnt',_n_,'l');
@@ -205,21 +215,21 @@ run;
205
215
  libname &libref1 clear;
206
216
 
207
217
  %if &status=completed or &status=failed or &status=canceled %then %do;
208
- %local plainuri;
209
- %let plainuri=%substr(&&joburi&i,1,55);
218
+ /* &&joburi&i is already the plain job uri (any /state suffix was
219
+ stripped on input) - use it as-is. */
210
220
  proc sql;
211
221
  insert into &outds set
212
222
  _program="&&jobname&i",
213
- uri="&plainuri",
223
+ uri="&&joburi&i",
214
224
  state="&status",
215
225
  stateDetails=symget("stateDetails"),
216
226
  timestamp=datetime(),
217
227
  jobparams=symget("jobparams&i");
218
- %let joburi&i=0; /* do not re-check */
219
228
  /* fetch log */
220
229
  %if %str(&outref) ne 0 %then %do;
221
- %mv_getjoblog(uri=&plainuri,outref=&outref,mdebug=&mdebug)
230
+ %mv_getjoblog(uri=&&joburi&i,outref=&outref,mdebug=&mdebug)
222
231
  %end;
232
+ %let joburi&i=0; /* do not re-check */
223
233
  %end;
224
234
  %else %if &status=idle or &status=pending or &status=running %then %do;
225
235
  data _null_;