lukeed / taskr

A fast, concurrency-focused task automation tool.
MIT License
2.53k stars 74 forks source link

Rework `serial and `parallel` chains #212

Closed lukeed closed 7 years ago

lukeed commented 7 years ago

With the new fly.start base method (see #211), parallel vs serial tasks will be much simpler to perform.

var tasks = ['task1', 'task2', 'task3']

// parallel
yield Promise.all(tasks.map(str => this.start(str)))

// serial
var val
for (t of tasks) {
  val = yield this.start(t)(val);
}

Fixes

Fly will actually be able to know when parallel chains are completed. Makes umbrella tasks more predictable:

// current system
exports.build = function * () {
  yield this.start(['task1', 'task2', 'task3'], {parallel: 1}); 
  // will start version-ing before entire parallel chain has completed!
  yield this.start('version');
}

Include

lukeed commented 7 years ago

Added in #218