added report generation
This commit is contained in:
parent
1694c187e9
commit
a8be54f8aa
|
@ -157,6 +157,58 @@
|
||||||
"name" : "join",
|
"name" : "join",
|
||||||
"type" : "JOIN",
|
"type" : "JOIN",
|
||||||
"taskReferenceName" : "join_parallel_downloads"
|
"taskReferenceName" : "join_parallel_downloads"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "fork_join",
|
||||||
|
"type" : "FORK_JOIN",
|
||||||
|
"taskReferenceName" : "fork_manage_output",
|
||||||
|
"inputParameters" : {
|
||||||
|
|
||||||
|
},
|
||||||
|
"dynamicForkTasksParam": "tasks",
|
||||||
|
"dynamicForkTasksInputParamName": "inputs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "join",
|
||||||
|
"type" : "JOIN",
|
||||||
|
"taskReferenceName" : "join_manage_output"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "fork_join",
|
||||||
|
"taskReferenceName" : "reporting",
|
||||||
|
"type": "FORK_JOIN",
|
||||||
|
"forkTasks" : [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "LAMBDA_TASK",
|
||||||
|
"taskReferenceName": "build_json_report",
|
||||||
|
"type": "LAMBDA",
|
||||||
|
"inputParameters": {
|
||||||
|
"input" : "${workflow.input.descriptor}",
|
||||||
|
"output" : "${join_manage_output.output}",
|
||||||
|
"scriptExpression": "var k,report={requestid:$.input.request_id,order_number:$.input.order_number,errors:[]},keys=Object.keys($.output).sort();for(k in keys){var index=keys[k].split('_')[1],o=$.output[keys[k]];o.endpoint1.error&&report.errors.push({url:$.input.downloads[index].url,number:index,error_number:1002,error_message:o.endpoint1.error}),o.endpoint2.error&&report.errors.push({url:$.input.descriptor.downloads[index].url,number:index,error_number:9999,error_message:o.endpoint2.error})};return {report:Java.to(report,'java.util.Map[]')}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "LAMBDA_TASK",
|
||||||
|
"taskReferenceName": "build_email_report",
|
||||||
|
"type": "LAMBDA",
|
||||||
|
"inputParameters": {
|
||||||
|
"input" : "${workflow.input.descriptor}",
|
||||||
|
"output" : "${join_manage_output.output}",
|
||||||
|
"scriptExpression": "var k,report='<table><thead><tr><th>Download</th><th>Outcome</th><th>Link</th></tr></thead><tbody>',keys=Object.keys($.output).sort();for(k in keys){var index=keys[k].split('_')[1];report+='<tr><td>'+index+'</td>';var o=$.output[keys[k]];o.endpoint1.error||o.endpoint2.error?report+='<td>'+(o.endpoint1.error||'')+(o.endpoint2.error||'')+'</td>':report+='<td>OK</td>',report+='</tr>'}report+='</tbody></table>';return { report : report}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "join",
|
||||||
|
"type" : "JOIN",
|
||||||
|
"taskReferenceName" : "join_reporting",
|
||||||
|
"joinOn" : ["build_json_report", "build_email_report"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue