Reputation: 58
I want to create a workflow that will generate a UUID, so that it can be passed to another task in the workflow: whenever the workflow task executes, it gets a new UUID.
Upvotes: -2
Views: 41
Reputation: 58
The workflow below generates a UUID.
Inside the Conductor UI on the browser, go to the Definitions tab, click on New Workflow Definition, delete any existing content, and add the code below.
{
"createTime": 1733483033480,
"updateTime": 1733640757965,
"accessPolicy": {},
"name": "generate_uuid",
"description": "generate_uuid",
"version": 1,
"tasks": [
{
"name": "generate_uuid_ref",
"taskReferenceName": "generate_uuid_ref",
"inputParameters": {
"expression": "(function () {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n})();",
"evaluatorType": "javascript"
},
"type": "INLINE",
"startDelay": 0,
"optional": false,
"asyncComplete": false
}
],
"inputParameters": [],
"outputParameters": {
"uuid": "${generate_uuid_ref.output.result}"
},
"failureWorkflow": "",
"schemaVersion": 2,
"restartable": true,
"workflowStatusListenerEnabled": false,
"ownerEmail": "[email protected]",
"timeoutPolicy": "ALERT_ONLY",
"timeoutSeconds": 0,
"variables": {},
"inputTemplate": {}
}
Upvotes: 1