mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-06 20:10:05 +00:00
fix(job-execution): fix program variable for absolute path jobs
This commit is contained in:
@@ -385,7 +385,7 @@ export class SASViyaApiClient {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes code on the current SAS Viya server.
|
* Executes code on the current SAS Viya server.
|
||||||
* @param fileName - a name for the file being submitted for execution.
|
* @param jobPath - the path to the file being submitted for execution.
|
||||||
* @param linesOfCode - an array of code lines to execute.
|
* @param linesOfCode - an array of code lines to execute.
|
||||||
* @param contextName - the context to execute the code in.
|
* @param contextName - the context to execute the code in.
|
||||||
* @param accessToken - an access token for an authorized user.
|
* @param accessToken - an access token for an authorized user.
|
||||||
@@ -396,7 +396,7 @@ export class SASViyaApiClient {
|
|||||||
* @param expectWebout - when set to true, the automatic _webout fileref will be checked for content, and that content returned. This fileref is used when the Job contains a SASjs web request (as opposed to executing arbitrary SAS code).
|
* @param expectWebout - when set to true, the automatic _webout fileref will be checked for content, and that content returned. This fileref is used when the Job contains a SASjs web request (as opposed to executing arbitrary SAS code).
|
||||||
*/
|
*/
|
||||||
public async executeScript(
|
public async executeScript(
|
||||||
jobName: string,
|
jobPath: string,
|
||||||
linesOfCode: string[],
|
linesOfCode: string[],
|
||||||
contextName: string,
|
contextName: string,
|
||||||
accessToken?: string,
|
accessToken?: string,
|
||||||
@@ -434,13 +434,21 @@ export class SASViyaApiClient {
|
|||||||
jobArguments['_DEBUG'] = 131
|
jobArguments['_DEBUG'] = 131
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileName = `exec-${
|
let fileName
|
||||||
jobName.includes('/') ? jobName.split('/')[1] : jobName
|
if (isRelativePath(jobPath)) {
|
||||||
}`
|
fileName = `exec-${
|
||||||
|
jobPath.includes('/') ? jobPath.split('/')[1] : jobPath
|
||||||
|
}`
|
||||||
|
} else {
|
||||||
|
const jobPathParts = jobPath.split('/')
|
||||||
|
fileName = jobPathParts.pop()
|
||||||
|
}
|
||||||
|
|
||||||
let jobVariables: any = {
|
let jobVariables: any = {
|
||||||
SYS_JES_JOB_URI: '',
|
SYS_JES_JOB_URI: '',
|
||||||
_program: this.rootFolderName + '/' + jobName
|
_program: isRelativePath(jobPath)
|
||||||
|
? this.rootFolderName + '/' + jobPath
|
||||||
|
: jobPath
|
||||||
}
|
}
|
||||||
|
|
||||||
let files: any[] = []
|
let files: any[] = []
|
||||||
@@ -543,7 +551,7 @@ export class SASViyaApiClient {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e && e.status === 404) {
|
if (e && e.status === 404) {
|
||||||
return this.executeScript(
|
return this.executeScript(
|
||||||
jobName,
|
jobPath,
|
||||||
linesOfCode,
|
linesOfCode,
|
||||||
contextName,
|
contextName,
|
||||||
accessToken,
|
accessToken,
|
||||||
|
|||||||
Reference in New Issue
Block a user