Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Graphtask is graph based task runner for complex task orchestration scenarios. It is written in Typescript and available as a commonjs or esm.
Graphtask is graph based task runner for complex task orchestration scenarios. It is written in Typescript and available as a commonjs or esm.
Use the package manager npm to install graph task.
npm install -g graphtask
// or, as a project dependency
npm install graphtask --save-dev
Graphtask exposes a global function task()
, this function is used to build a graph of tasks. The return value of task()
can then be used as an input to other tasks, to form a graph. The tool uses a pool of web-workers to process tasks as efficiently as possible.
When the graph is run a task will be executed only if at least one of its inputs has succeeded (or if it has no inputs).
Graphtask requires two files an NAME.flow.js and NAME.actions.js, these files define what is to be done and how it is to be done.
The flow file
The flow file describes what to do. It defines the tasks and their connections to other tasks.
The following example defines four nodes. The input
field defines connections between the nodes. The params
field allows arbitrary data to be passed to each.
const actions = require('./tasks.actions');
const first = task({
name: 'Wait for some time', // The title of the task
action: actions.wait, // The action to run, must return a promise
params: { some: 'input' } // Some arbitrary data to pass in as arguments
});
const error = task({
name: 'Fail because of error',
action: actions.errorer,
input: { 'first': first }, // A labeled input, the result of "first" will be passed in via the argument first
params: { other: 'data' }
});
task({
name: 'I dont run because all inputs failed',
action: actions.wait,
input: [error]
})
task({
name: 'I run because some inputs succeeded',
action: actions.wait,
input: [error, first],
params: { some: 'other input' },
})
This example produces the following graph:
The actions file
The actions file defines how to do the tasks. These must be named functions that return a Promise.
const { wait } = require('../utils');
module.exports = {
wait,
async errorer() {
throw new Error('BANNNG');
}
};
graphtask ./tasks_folder # Run tasks in folder
graphtask ./tasks_folder -p # Generate a task plan (dont execute task actions)
graphtask ./tasks_folder -o ./results # Write the output of the run in .json, .log & .dot format to the ./results folder
graphtask --help # Display command help
See ./examples sub-folders
e.g.
./lib/cjs/cli/index.js ./examples/simple -o /tmp
./lib/cjs/cli/index.js ./examples/complex -o /tmp
-- TODO
-- TODO
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
FAQs
Graphtask is graph based task runner for complex task orchestration scenarios. It is written in Typescript and available as a commonjs or esm.
The npm package graphtask receives a total of 0 weekly downloads. As such, graphtask popularity was classified as not popular.
We found that graphtask demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.