@onlineapps/conn-orch-orchestrator 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/WorkflowOrchestrator.js +26 -26
package/package.json
CHANGED
|
@@ -91,32 +91,6 @@ class WorkflowOrchestrator {
|
|
|
91
91
|
return { skipped: true, reason: 'wrong_service' };
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
// Publish workflow.progress to monitoring.workflow using unified helper
|
|
95
|
-
const { publishToMonitoringWorkflow } = require('@onlineapps/mq-client-core').monitoring;
|
|
96
|
-
try {
|
|
97
|
-
const stepIndex = cookbookDef.steps.findIndex(s => s.id === current_step);
|
|
98
|
-
console.log(`[WorkflowOrchestrator] [PROGRESS] Publishing progress for ${workflow_id}, step: ${current_step}, index: ${stepIndex}`);
|
|
99
|
-
await publishToMonitoringWorkflow(this.mqClient, {
|
|
100
|
-
event_type: 'progress',
|
|
101
|
-
workflow_id: workflow_id,
|
|
102
|
-
service_name: serviceName,
|
|
103
|
-
step_index: stepIndex >= 0 ? stepIndex : 0,
|
|
104
|
-
step_id: current_step,
|
|
105
|
-
cookbook: cookbookDef,
|
|
106
|
-
context: enrichedContext,
|
|
107
|
-
status: 'in_progress',
|
|
108
|
-
timestamp: new Date().toISOString()
|
|
109
|
-
}, this.logger, { workflow_id, step_id: current_step });
|
|
110
|
-
console.log(`[WorkflowOrchestrator] [PROGRESS] ✓ Progress published for ${workflow_id}`);
|
|
111
|
-
} catch (monitoringError) {
|
|
112
|
-
// Don't fail workflow if monitoring publish fails (helper already logs)
|
|
113
|
-
console.error(`[WorkflowOrchestrator] [PROGRESS] ✗ Failed to publish progress:`, monitoringError);
|
|
114
|
-
this.logger.warn('Failed to publish workflow.progress to monitoring', {
|
|
115
|
-
workflow_id,
|
|
116
|
-
error: monitoringError.message || String(monitoringError)
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
94
|
// Check cache if available
|
|
121
95
|
let result;
|
|
122
96
|
if (this.cache && step.type === 'task') {
|
|
@@ -158,6 +132,32 @@ class WorkflowOrchestrator {
|
|
|
158
132
|
steps: existingSteps
|
|
159
133
|
};
|
|
160
134
|
|
|
135
|
+
// Publish workflow.progress AFTER execution (so we have step output)
|
|
136
|
+
const { publishToMonitoringWorkflow } = require('@onlineapps/mq-client-core').monitoring;
|
|
137
|
+
try {
|
|
138
|
+
console.log(`[WorkflowOrchestrator] [PROGRESS] Publishing progress for ${workflow_id}, step: ${current_step}, index: ${currentIndex}`);
|
|
139
|
+
await publishToMonitoringWorkflow(this.mqClient, {
|
|
140
|
+
event_type: 'progress',
|
|
141
|
+
workflow_id: workflow_id,
|
|
142
|
+
service_name: serviceName,
|
|
143
|
+
step_index: currentIndex >= 0 ? currentIndex : 0,
|
|
144
|
+
step_id: current_step,
|
|
145
|
+
cookbook: cookbookDef,
|
|
146
|
+
context: updatedContext, // Context WITH step output
|
|
147
|
+
output: result, // Step output directly
|
|
148
|
+
status: 'completed', // Step completed (not in_progress)
|
|
149
|
+
timestamp: new Date().toISOString()
|
|
150
|
+
}, this.logger, { workflow_id, step_id: current_step });
|
|
151
|
+
console.log(`[WorkflowOrchestrator] [PROGRESS] ✓ Progress published for ${workflow_id}`);
|
|
152
|
+
} catch (monitoringError) {
|
|
153
|
+
// Don't fail workflow if monitoring publish fails
|
|
154
|
+
console.error(`[WorkflowOrchestrator] [PROGRESS] ✗ Failed to publish progress:`, monitoringError);
|
|
155
|
+
this.logger.warn('Failed to publish workflow.progress to monitoring', {
|
|
156
|
+
workflow_id,
|
|
157
|
+
error: monitoringError.message || String(monitoringError)
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
161
|
// Find next step (currentIndex already defined above)
|
|
162
162
|
const nextStep = cookbookDef.steps[currentIndex + 1];
|
|
163
163
|
|