Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] be able to run multiple tasks in separate threads #527

Open
gabrielcsapo opened this issue Jun 30, 2020 · 1 comment
Open

[feature] be able to run multiple tasks in separate threads #527

gabrielcsapo opened this issue Jun 30, 2020 · 1 comment
Labels
question Further information is requested

Comments

@gabrielcsapo
Copy link
Contributor

Motivation

Looking at the runTasks function, there is some room for improvement on systems that have multiple cores. Tasks could be threaded off using something like https://www.npmjs.com/package/piscina.

async runTasks(): Promise<[TaskResult[], TaskError[]]> {
let results = await this.eachTask(async (task: Task) => {
let result;
this.debug('start %s run', task.constructor.name);
try {
result = await task.run();
} catch (error) {
this.addError(task.meta.taskName, error.message);
}
this.debug('%s run done', task.constructor.name);
return result;
});
return [(results.filter(Boolean) as TaskResult[]).sort(taskResultComparator), this._errors];
}

@scalvert
Copy link
Contributor

scalvert commented Jul 2, 2020

I'd prefer not to jump to using threads unless absolutely needed. Currently, the eachTasks function uses p-map, and unless there's a super compelling reason to switch, I'd prefer to leave this as is.

What problem are you trying to solve?

@scalvert scalvert added the question Further information is requested label Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants