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

feat(job-pid): added print PID of the executed job

This commit is contained in:
Yury Shkoda
2020-12-22 16:21:24 +03:00
parent 7bf53858f0
commit bb894e6107
8 changed files with 1761 additions and 2955 deletions

View File

@@ -16,12 +16,13 @@ import {
Folder,
CsrfToken,
EditContextInput,
ErrorResponse,
JobDefinition,
PollOptions
} from './types'
import { formatDataForRequest } from './utils/formatDataForRequest'
import { SessionManager } from './SessionManager'
import { timestampToYYYYMMDDHHMMSS } from '@sasjs/utils/time'
import { Logger, LogLevel } from '@sasjs/utils/logger'
/**
* A client for interfacing with the SAS Viya REST API.
@@ -460,6 +461,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()}`
)
}
const jobArguments: { [key: string]: any } = {
_contextName: contextName,
_OMITJSONLISTING: true,