1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-14 15:40:06 +00:00

chore(pid): made printing PID optional

This commit is contained in:
Yury Shkoda
2020-12-23 09:17:40 +03:00
parent 16e21adb20
commit 2e66bfde4b
2 changed files with 29 additions and 22 deletions

View File

@@ -441,7 +441,8 @@ export class SASViyaApiClient {
debug: boolean = false, debug: boolean = false,
expectWebout = false, expectWebout = false,
waitForResult = true, waitForResult = true,
pollOptions?: PollOptions pollOptions?: PollOptions,
printPid = false
): Promise<any> { ): Promise<any> {
try { try {
const headers: any = { const headers: any = {
@@ -461,24 +462,26 @@ export class SASViyaApiClient {
executionSessionId = session!.id executionSessionId = session!.id
const { result: jobIdVariable } = await this.sessionManager.getVariable( if (printPid) {
executionSessionId, const { result: jobIdVariable } = await this.sessionManager.getVariable(
'SYSJOBID', executionSessionId,
accessToken '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 (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 } = { const jobArguments: { [key: string]: any } = {
@@ -988,7 +991,8 @@ export class SASViyaApiClient {
accessToken?: string, accessToken?: string,
waitForResult = true, waitForResult = true,
expectWebout = false, expectWebout = false,
pollOptions?: PollOptions pollOptions?: PollOptions,
printPid = false
) { ) {
if (isRelativePath(sasJob) && !this.rootFolderName) { if (isRelativePath(sasJob) && !this.rootFolderName) {
throw new Error( throw new Error(
@@ -1074,7 +1078,8 @@ export class SASViyaApiClient {
debug, debug,
expectWebout, expectWebout,
waitForResult, waitForResult,
pollOptions pollOptions,
printPid
) )
} }

View File

@@ -730,7 +730,8 @@ export default class SASjs {
config: any = {}, config: any = {},
accessToken?: string, accessToken?: string,
waitForResult?: boolean, waitForResult?: boolean,
pollOptions?: PollOptions pollOptions?: PollOptions,
printPid = false
) { ) {
config = { config = {
...this.sasjsConfig, ...this.sasjsConfig,
@@ -752,7 +753,8 @@ export default class SASjs {
accessToken, accessToken,
!!waitForResult, !!waitForResult,
false, false,
pollOptions pollOptions,
printPid
) )
} }