[agent-pipeline] rollback to 609460cd
This commit is contained in:
@@ -165,20 +165,8 @@ export class BatchSchedulerService {
|
||||
|
||||
executionLog = executionLogResponse.data;
|
||||
|
||||
// 실행 유형 분기: node_flow면 노드 플로우 실행, 아니면 매핑 배치 실행
|
||||
let result: {
|
||||
totalRecords: number;
|
||||
successRecords: number;
|
||||
failedRecords: number;
|
||||
};
|
||||
if (
|
||||
config.execution_type === "node_flow" &&
|
||||
config.node_flow_id != null
|
||||
) {
|
||||
result = await this.executeNodeFlow(config);
|
||||
} else {
|
||||
result = await this.executeBatchMappings(config);
|
||||
}
|
||||
// 실제 배치 실행 로직 (수동 실행과 동일한 로직 사용)
|
||||
const result = await this.executeBatchMappings(config);
|
||||
|
||||
// 실행 로그 업데이트 (성공)
|
||||
await BatchExecutionLogService.updateExecutionLog(executionLog.id, {
|
||||
@@ -219,67 +207,6 @@ export class BatchSchedulerService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 노드 플로우 실행 (execution_type === 'node_flow'일 때)
|
||||
* node_flows 테이블의 플로우를 NodeFlowExecutionService로 실행하고 결과를 배치 로그 형식으로 반환
|
||||
*/
|
||||
private static async executeNodeFlow(config: any): Promise<{
|
||||
totalRecords: number;
|
||||
successRecords: number;
|
||||
failedRecords: number;
|
||||
}> {
|
||||
const { NodeFlowExecutionService } = await import(
|
||||
"./nodeFlowExecutionService"
|
||||
);
|
||||
|
||||
// 플로우 존재 여부 확인
|
||||
const flowCheck = await query<{ flow_id: number; flow_name: string }>(
|
||||
"SELECT flow_id, flow_name FROM node_flows WHERE flow_id = $1",
|
||||
[config.node_flow_id]
|
||||
);
|
||||
if (flowCheck.length === 0) {
|
||||
throw new Error(
|
||||
`노드 플로우를 찾을 수 없습니다 (flow_id: ${config.node_flow_id})`
|
||||
);
|
||||
}
|
||||
|
||||
// node_flow_context: DB JSONB는 객체로 올 수 있고, 문자열로 올 수 있음. 안전 파싱
|
||||
let contextObj: Record<string, any> = {};
|
||||
if (config.node_flow_context != null) {
|
||||
if (typeof config.node_flow_context === "string") {
|
||||
try {
|
||||
contextObj = JSON.parse(config.node_flow_context);
|
||||
} catch {
|
||||
contextObj = {};
|
||||
}
|
||||
} else if (
|
||||
typeof config.node_flow_context === "object" &&
|
||||
!Array.isArray(config.node_flow_context)
|
||||
) {
|
||||
contextObj = { ...config.node_flow_context };
|
||||
}
|
||||
}
|
||||
|
||||
const contextData: Record<string, any> = {
|
||||
...contextObj,
|
||||
_batchId: config.id,
|
||||
_batchName: config.batch_name,
|
||||
_companyCode: config.company_code,
|
||||
_executedBy: "batch_system",
|
||||
};
|
||||
|
||||
const flowResult = await NodeFlowExecutionService.executeFlow(
|
||||
config.node_flow_id,
|
||||
contextData
|
||||
);
|
||||
|
||||
return {
|
||||
totalRecords: flowResult.summary.total,
|
||||
successRecords: flowResult.summary.success,
|
||||
failedRecords: flowResult.summary.failed,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 배치 매핑 실행 (수동 실행과 동일한 로직)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user