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

Fetching a job's parent job (traversing a flow tree starting from an intermediate node) #2770

Open
brncsk opened this issue Sep 12, 2024 · 0 comments

Comments

@brncsk
Copy link

brncsk commented Sep 12, 2024

Is your feature request related to a problem? Please describe.
I'm trying to traverse a flow from an intermediate node (e.g. one that has both a parent and children) in order to get a "state of the world" type of representation (e.g. all jobs in the flow, flattened, possibly represented as their names mapped to their errors or returnvalue or something else).

While traversing the tree downstream is possible by either invoking Job#getDependencies() or FlowProducer#getFlow(), it's less straightforward to fetch a Job instance representing the parent of a job, as parentKey.queueKey contains the fully qualified (i.e. prefixed by bull:) key of the queue which I cannot really do anything with.

Describe the solution you'd like
I'd like a getter on Job that would return another Job instance representing its parent job, if exists.

Describe alternatives you've considered
I implemented a utility function that effectively reverses QueueKeys#getQueueQualifiedName() thus returning the queue name from a qualified queue key by removing the prefix. This lets me use FlowProducer#getFlow() to fetch the parent job.

Additional context
No additional context I'm aware of.

@brncsk brncsk changed the title Traversing a flow tree starting from an intermediate node Fetching a job's parent job (traversing a flow tree starting from an intermediate node) Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant