@sasjs/core 5.2.6 → 5.2.7

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/package.json CHANGED
@@ -41,5 +41,5 @@
41
41
  "maintainers": [
42
42
  "https://sasapps.io"
43
43
  ],
44
- "version": "5.2.6"
44
+ "version": "5.2.7"
45
45
  }
@@ -222,6 +222,19 @@ run;
222
222
  response can be fetched directly via a GET to &base_uri&uri. */
223
223
  %let abortmsg=Job &jobstate, no log available. GET &uri;
224
224
  %if %length(&err_msg)>0 %then %let abortmsg=Job &jobstate, no log available. Error &err_httpcode: &err_msg. GET &uri;
225
+ /* A canceled job does not always provide a loglocation (eg a job
226
+ that was aborted by design, or canceled by the server before a
227
+ compute session was created). Aborting here would terminate the
228
+ calling program, so instead record the reason in the outref and
229
+ return - the caller can decide how to handle the missing log. */
230
+ %if &jobstate=canceled %then %do;
231
+ %put &sysmacroname: &abortmsg;
232
+ data _null_;
233
+ file &outref mod;
234
+ put "&sysmacroname: &abortmsg";
235
+ run;
236
+ %return;
237
+ %end;
225
238
  %mp_abort(iftrue=(1=1)
226
239
  ,mac=&sysmacroname
227
240
  ,msg=%str(&abortmsg)
@@ -186,6 +186,36 @@ data _null_;
186
186
  call symputx('resuri',_&result,'l');
187
187
  &dbg putlog "&sysmacroname results: " (_all_)(=);
188
188
  run;
189
+ %if "&resuri"="." %then %do;
190
+ /* The requested result was not registered - typical for a canceled
191
+ * job whose session ended before the result file was created (eg a
192
+ * job aborted by design, or a job that failed on session creation).
193
+ * Aborting here would terminate the calling program, so write an
194
+ * empty payload and return - the caller can check the job state
195
+ * (from the outds of the wait macro) and decide what to do. */
196
+ %put &sysmacroname: _&result not found in job results -;
197
+ %put &sysmacroname: use mv_getjoblog to fetch the job log instead;
198
+ %if &outref ne 0 %then %do;
199
+ data _null_;
200
+ file &outref;
201
+ put "&sysmacroname: no &_result result available for job &uri";
202
+ run;
203
+ %end;
204
+ %if &outlib ne 0 %then %do;
205
+ %local fname3;
206
+ %let fname3=%mf_getuniquefileref();
207
+ data _null_;
208
+ file &fname3;
209
+ put '{}';
210
+ run;
211
+ libname &outlib JSON fileref=&fname3;
212
+ %end;
213
+ %if &mdebug=0 %then %do;
214
+ filename &fname1 clear;
215
+ libname &lib1 clear;
216
+ %end;
217
+ %return;
218
+ %end;
189
219
  %mp_abort(iftrue=("&resuri"=".")
190
220
  ,mac=&sysmacroname
191
221
  ,msg=%str(Variable _&result did not exist in the response json)