Hunting the Shmoo

Screencasts and blog posts on workflow, productivity, tools, Mozilla and whatever else tickles my fancy.

Taskgraph Like a Pro

Have you ever needed to inspect the taskgraph locally? Did you have a bad time? Learn how to inspect the taskgraph like a PRO. For the impatient skip to the installation instructions below.


Installation

First you’ll need to install fzf, if you’ve used mach try fuzzy before, it’s already on your system under ~/.mozbuild/fzf, just make sure it’s on your $PATH.

Next install fx:

$ npm install fx

Finally, add the following shell function to your ~/.bashrc or equivalent:

tf () {
	fx "tg => String(require(\"child_process\").spawnSync(\"fzf\", [\"-f\", \"$1\"], {\"input\": Object.keys(tg).join(\"\n\")}).output).split(\"\n\").reduce((obj, key) => { obj[key] = tg[key]; return obj; }, {})" | fx
}

That’s it!

Usage

Simply pipe the output of mach taskgraph full -J into the tf function (preferably saving it to a file first:

$ ./mach taskgraph full -J > full.taskgraph
$ cat full.taskgraph | tf "win64 mochitest | reftest -1$"

The above will filter down all chunk 1 mochitest and reftest tasks on win64. The query syntax is identical to the one used with mach try fuzzy. See man fzf for more details.

Happy inspecting!


Share

Comments

Anton
19/12/2018

Will be cool to implement all you need in fx itself. I want make fx useful for all JSON work)

Leave a comment

Your comment has been submitted and will be published once it has been approved.