Feature description
Facilitate retrieval of jobs in graphile, by either giving ways to query the schema or exposing new helpers to do so in a more durable way.
Motivating example
Loosely inspired by https://github.com/politics-rewired/graphile-worker-rate-limiter, I have written a reusable configuration factory that allows a task C to be executed only once a task A and B have been executed. It behaves like so:
const compositeTask = new CompositeTask({
name: 'C',
dependencies: {
A : (payload) => payload.id,
B : (payload) => payload.id
}
});
// install composite task somehow, omitting for brievety
workerUtils.addJob('A', {foo: 'bar', id: 1}) // Nothing happens
workerUtils.addJob('B', {baz: 'qux', id: 2}) // Nothing happens
workerUtils.addJob('B', {hello: 'world', id: 1}) // Task C is ran with `{A: {foo: 'bar', id: 1}, B: {hello: 'world', id: 1}}`
My implementation works flawlessly. However, to work, each dependency task (A & B) need to alter the payload and retrieve the flags, and I can't find a way to do it than the brittle way of querying directly the DB but this requires knowing the graphile schema during initial configuration. I could get away without mutating the payload but the flags is the core behavior to allow a task C to be ran.
I am aware that reading from the jobs table is discouraged but the total impossibility to do so even in the cases where it is needed pushes users towards hacking around.
Breaking changes
Supporting development
I [tick all that apply]:
Feature description
Facilitate retrieval of jobs in graphile, by either giving ways to query the schema or exposing new helpers to do so in a more durable way.
Motivating example
Loosely inspired by https://github.com/politics-rewired/graphile-worker-rate-limiter, I have written a reusable configuration factory that allows a task
Cto be executed only once a taskAandBhave been executed. It behaves like so:My implementation works flawlessly. However, to work, each dependency task (
A&B) need to alter the payload and retrieve the flags, and I can't find a way to do it than the brittle way of querying directly the DB but this requires knowing the graphile schema during initial configuration. I could get away without mutating the payload but the flags is the core behavior to allow a task C to be ran.I am aware that reading from the jobs table is discouraged but the total impossibility to do so even in the cases where it is needed pushes users towards hacking around.
Breaking changes
Supporting development
I [tick all that apply]: