1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 09:24:35 +00:00

fix(*): fix compute job execution

This commit is contained in:
Krishna Acondy
2021-01-28 17:01:59 +00:00
parent 0eba6bdcf4
commit 6d1c4ff81a
4 changed files with 22 additions and 5 deletions

View File

@@ -8,7 +8,8 @@ import {
Folder,
EditContextInput,
JobDefinition,
PollOptions
PollOptions,
ComputeJobExecutionError
} from './types'
import { formatDataForRequest } from './utils/formatDataForRequest'
import { SessionManager } from './SessionManager'
@@ -429,7 +430,7 @@ export class SASViyaApiClient {
}
if (jobStatus === 'failed' || jobStatus === 'error') {
return Promise.reject({ job: currentJob, log })
return Promise.reject(new ComputeJobExecutionError(currentJob, log))
}
let resultLink
@@ -598,7 +599,7 @@ export class SASViyaApiClient {
return await this.requestClient.post<Job>(
`${this.serverUrl}/jobDefinitions/definitions?parentFolderUri=${parentFolderUri}`,
JSON.stringify({
{
name: jobName,
parameters: [
{
@@ -609,7 +610,7 @@ export class SASViyaApiClient {
],
type: 'Compute',
code
}),
},
accessToken
)
}

View File

@@ -9,7 +9,8 @@ import { RequestClient } from './request/RequestClient'
import {
JobExecutor,
WebJobExecutor,
ComputeJobExecutor
ComputeJobExecutor,
JesJobExecutor
} from './job-execution'
const defaultConfig: SASjsConfig = {
@@ -759,6 +760,11 @@ export default class SASjs {
this.sasjsConfig.serverUrl,
this.sasViyaApiClient!
)
this.jesJobExecutor = new JesJobExecutor(
this.sasjsConfig.serverUrl,
this.sasViyaApiClient!
)
}
private async createFoldersAndServices(

View File

@@ -0,0 +1,9 @@
import { Job } from './Job'
export class ComputeJobExecutionError extends Error {
constructor(public job: Job, public log: string) {
super('Error: Job execution failed')
this.name = 'ComputeJobExecutionError'
Object.setPrototypeOf(this, ComputeJobExecutionError.prototype)
}
}

View File

@@ -1,3 +1,4 @@
export * from './ComputeJobExecutionError'
export * from './Context'
export * from './CsrfToken'
export * from './ErrorResponse'