mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 08:30:07 +00:00
fix(*): fix compute job execution
This commit is contained in:
@@ -8,7 +8,8 @@ import {
|
|||||||
Folder,
|
Folder,
|
||||||
EditContextInput,
|
EditContextInput,
|
||||||
JobDefinition,
|
JobDefinition,
|
||||||
PollOptions
|
PollOptions,
|
||||||
|
ComputeJobExecutionError
|
||||||
} from './types'
|
} from './types'
|
||||||
import { formatDataForRequest } from './utils/formatDataForRequest'
|
import { formatDataForRequest } from './utils/formatDataForRequest'
|
||||||
import { SessionManager } from './SessionManager'
|
import { SessionManager } from './SessionManager'
|
||||||
@@ -429,7 +430,7 @@ export class SASViyaApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobStatus === 'failed' || jobStatus === 'error') {
|
if (jobStatus === 'failed' || jobStatus === 'error') {
|
||||||
return Promise.reject({ job: currentJob, log })
|
return Promise.reject(new ComputeJobExecutionError(currentJob, log))
|
||||||
}
|
}
|
||||||
|
|
||||||
let resultLink
|
let resultLink
|
||||||
@@ -598,7 +599,7 @@ export class SASViyaApiClient {
|
|||||||
|
|
||||||
return await this.requestClient.post<Job>(
|
return await this.requestClient.post<Job>(
|
||||||
`${this.serverUrl}/jobDefinitions/definitions?parentFolderUri=${parentFolderUri}`,
|
`${this.serverUrl}/jobDefinitions/definitions?parentFolderUri=${parentFolderUri}`,
|
||||||
JSON.stringify({
|
{
|
||||||
name: jobName,
|
name: jobName,
|
||||||
parameters: [
|
parameters: [
|
||||||
{
|
{
|
||||||
@@ -609,7 +610,7 @@ export class SASViyaApiClient {
|
|||||||
],
|
],
|
||||||
type: 'Compute',
|
type: 'Compute',
|
||||||
code
|
code
|
||||||
}),
|
},
|
||||||
accessToken
|
accessToken
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import { RequestClient } from './request/RequestClient'
|
|||||||
import {
|
import {
|
||||||
JobExecutor,
|
JobExecutor,
|
||||||
WebJobExecutor,
|
WebJobExecutor,
|
||||||
ComputeJobExecutor
|
ComputeJobExecutor,
|
||||||
|
JesJobExecutor
|
||||||
} from './job-execution'
|
} from './job-execution'
|
||||||
|
|
||||||
const defaultConfig: SASjsConfig = {
|
const defaultConfig: SASjsConfig = {
|
||||||
@@ -759,6 +760,11 @@ export default class SASjs {
|
|||||||
this.sasjsConfig.serverUrl,
|
this.sasjsConfig.serverUrl,
|
||||||
this.sasViyaApiClient!
|
this.sasViyaApiClient!
|
||||||
)
|
)
|
||||||
|
|
||||||
|
this.jesJobExecutor = new JesJobExecutor(
|
||||||
|
this.sasjsConfig.serverUrl,
|
||||||
|
this.sasViyaApiClient!
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createFoldersAndServices(
|
private async createFoldersAndServices(
|
||||||
|
|||||||
9
src/types/ComputeJobExecutionError.ts
Normal file
9
src/types/ComputeJobExecutionError.ts
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
export * from './ComputeJobExecutionError'
|
||||||
export * from './Context'
|
export * from './Context'
|
||||||
export * from './CsrfToken'
|
export * from './CsrfToken'
|
||||||
export * from './ErrorResponse'
|
export * from './ErrorResponse'
|
||||||
|
|||||||
Reference in New Issue
Block a user