diff --git a/src/SASViyaApiClient.ts b/src/SASViyaApiClient.ts index d63139e..b3375e7 100644 --- a/src/SASViyaApiClient.ts +++ b/src/SASViyaApiClient.ts @@ -441,7 +441,8 @@ export class SASViyaApiClient { debug: boolean = false, expectWebout = false, waitForResult = true, - pollOptions?: PollOptions + pollOptions?: PollOptions, + printPid = false ): Promise { try { const headers: any = { @@ -461,24 +462,26 @@ export class SASViyaApiClient { executionSessionId = session!.id - const { result: jobIdVariable } = await this.sessionManager.getVariable( - executionSessionId, - 'SYSJOBID', - accessToken - ) - - if (jobIdVariable && jobIdVariable.value) { - const relativeJobPath = this.rootFolderName - ? jobPath.split(this.rootFolderName).join('').replace(/^\//, '') - : jobPath - - const logger = new Logger(debug ? LogLevel.Debug : LogLevel.Info) - - logger.info( - `Triggered '${relativeJobPath}' with PID ${ - jobIdVariable.value - } at ${timestampToYYYYMMDDHHMMSS()}` + if (printPid) { + const { result: jobIdVariable } = await this.sessionManager.getVariable( + executionSessionId, + 'SYSJOBID', + accessToken ) + + if (jobIdVariable && jobIdVariable.value) { + const relativeJobPath = this.rootFolderName + ? jobPath.split(this.rootFolderName).join('').replace(/^\//, '') + : jobPath + + const logger = new Logger(debug ? LogLevel.Debug : LogLevel.Info) + + logger.info( + `Triggered '${relativeJobPath}' with PID ${ + jobIdVariable.value + } at ${timestampToYYYYMMDDHHMMSS()}` + ) + } } const jobArguments: { [key: string]: any } = { @@ -988,7 +991,8 @@ export class SASViyaApiClient { accessToken?: string, waitForResult = true, expectWebout = false, - pollOptions?: PollOptions + pollOptions?: PollOptions, + printPid = false ) { if (isRelativePath(sasJob) && !this.rootFolderName) { throw new Error( @@ -1074,7 +1078,8 @@ export class SASViyaApiClient { debug, expectWebout, waitForResult, - pollOptions + pollOptions, + printPid ) } diff --git a/src/SASjs.ts b/src/SASjs.ts index ef66f45..bbb74ec 100644 --- a/src/SASjs.ts +++ b/src/SASjs.ts @@ -730,7 +730,8 @@ export default class SASjs { config: any = {}, accessToken?: string, waitForResult?: boolean, - pollOptions?: PollOptions + pollOptions?: PollOptions, + printPid = false ) { config = { ...this.sasjsConfig, @@ -752,7 +753,8 @@ export default class SASjs { accessToken, !!waitForResult, false, - pollOptions + pollOptions, + printPid ) }