ummon-server / ummon-server

Ummon is node.js application for creating, queuing, running and monitoring externally running tasks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify trigger syntax

mattmcmanus opened this issue · comments

Right now, triggers an object:

trigger: { time: '* * * * *' }
// - - or - - 
trigger: { after: 'task:name' }

Can we simplify this?

trigger: "* * * * *"
// - - or - -
trigger: "task:name"

Regex for * and guess its a timer. Other wise assume it's an after trigger.

Still keep { after: '' } support so that we can add more specific triggers like afterFailed or before

Some quick notes from this morning's shower. Line break line break move Cron out of triggered into its own key level of the task. I had a new type of chair called reactions to program the test that you want to react to the keys are the exit codes or the return strain and if any of those car venture another task.

Some more thoughts:

// Simple triggers - Always assumes after success or exit 0
trigger = '* * * * *' // if (trigger[0] == '*' || ! isNaN(trigger[0]))

// Complex
trigger : {
  '1': 'taskid2', // Run this task after taskid2 exits 1
// or
  '1': ['taskid1', 'taskid2', 'taskid3'] // Run after any of the tasks exit with 1
// or
  '1': [['taskid1', 'taskid2', 'taskid3'], 'taskid4'] // Run after task1,2 and 3 fail or if task4 fails// or
// or
  '/fatal error/': 'taskid1'] // Run after the regex is matched on stout? This needs to be flushed out some more
}