sasjs / cli

Command line interface for creating, compiling, and building SAS® projects

Home Page:https://cli.sasjs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fetch parent session log when job fails without recording log

tmoody opened this issue · comments

In cases where SASjs checks the status of a submitted job it may receive a response such as the following:

23:27:45 [info] Current job state: ErrorResponse[version=2,status=400,err=5113,id=,message=The session requested is currently in a failed or stopped state.,detail=[path: /compute/sessions/7e97f5a5-b60d-4849-b1ca-edd5d973eb2e-ses0003/jobs/ABE132DF-B639-6347-8E75-F648D0168FFB/state, traceId: d04fd7e5fd56e180],remediation=Correct the errors in the session request, and create a new session.,targetUri=<null>,errors=[],links=[]]
23:27:45 [error] Error executing job: Cannot read properties of undefined (reading 'href')
23:27:45 at node_modules/[@sasjs/cli/build/commands/job/internal/execute/viya.js:172:123](https://matrix.to/#/@sasjs/cli/build/commands/job/internal/execute/viya.js:172:123)
23:27:45 at step (node_modules/[@sasjs/cli/build/commands/job/internal/execute/viya.js:33:23](https://matrix.to/#/@sasjs/cli/build/commands/job/internal/execute/viya.js:33:23))
23:27:45 at [Object.next](http://object.next/) (node_modules/[@sasjs/cli/build/commands/job/internal/execute/viya.js:14:53](https://matrix.to/#/@sasjs/cli/build/commands/job/internal/execute/viya.js:14:53))
23:27:45 at fulfilled (node_modules/[@sasjs/cli/build/commands/job/internal/execute/viya.js:5:58](https://matrix.to/#/@sasjs/cli/build/commands/job/internal/execute/viya.js:5:58))
23:27:45 at processTicksAndRejections (node:internal/process/task_queues:96:5)

This leads to the end of the job, but with no log being recorded.

Documentation for the mv_getjoblog macro (https://core.sasjs.io/mv__getjoblog_8sas.html) suggests that the log is potentially available from the parent session and, if available, this should be recorded instead.