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:
@@ -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
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
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 './CsrfToken'
|
||||
export * from './ErrorResponse'
|
||||
|
||||
Reference in New Issue
Block a user