Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@dataparty/tasker
Advanced tools
Tasker is a parallel task runner with dependency resolution and results collection.
Tasker provides a Runner
class which manages depedencies, tasks and results. The runner class utilizes the dependency-solver npm package. When possible upto Runner.parallel
foreground tasks will be run at the same time. When background tasks are added to the Runner
they are started immeditaly and do not count against the parallel limit.
Tasks are added to the Runner
by calling Runner.addTask(task)
. Every Runner.planningIntervalMs
added tasks have their dependencies reveiwed and the schedule is updated. Tasks are scheduled in order of:
Runner.addTask(task)
As tasks are completed they can resolve with a result (or not). Any task that has defined dependencies will receive a reference to the task they depend upon in the depends
argument passed to Task.exec({task, depends})
Consumers of the library are expected to extend the Task
class to later instantiate and add instances to a runner. Tasks are added by calling Runner.addTask(task)
.
For more details see documentation:
By default tasks are in the foreground. Tasks can be defined either with a function or by subclassing. See a complete tutorial.
let sleepThirty = async ()=>{
return new Promise((resolve,reject)=>{
setTimeout(resolve, 30*1000)
})
}
let myTask = Tasker.Task({
name: 'sleep-30',
exec: sleepThirty
})
runner.addTask(myTask)
class SleepTask extends Tasker.Task {
constructor(durationMs){
this.duration = durationMs
this.timeout = null
}
async exec(){
return new Promise((resolve,reject)=>{
this.timeout = setTimeout(this.onTimeout.bind(this), 30*1000)
})
}
}
onTimeout(){
this.timeout = null
console.log('sleep complete')
}
stop(){
if(this.timeout !== null){
clearTimeout(this.timeout)
this.timeout = null
}
}
}
let sleepThirty = new SleepTaks(30*1000)
runner.addTask(sleepThirty)
runner.start()
Background tasks do not count against the parallel task limit. On failure background tasks are restarted immediatly and will be kept running indefinitly. Background tasks only ever stop if they are explicitly cancelled.
Task.background
to true during task construction.Task.exec({task, depends})
function which returns Task.detach()
Task.stop()
function which stops your tasks.Task.backgroundResolve(value)
when stopping successfully or due to a call to Task.stop()
.Task.backgroundReject(value)
when stopping due to failure.FAQs
dependency solving task runner
The npm package @dataparty/tasker receives a total of 1 weekly downloads. As such, @dataparty/tasker popularity was classified as not popular.
We found that @dataparty/tasker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.