-
Notifications
You must be signed in to change notification settings - Fork 418
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
feat(job): add removeDependencyOnFail option #1100
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some small comments.
*/ | ||
removeDependencyOnFail?: boolean; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a comment here clarifying that these fields are the ones stored in Redis and thus with smaller keys for compactness.
src/classes/job.ts
Outdated
@@ -276,6 +281,28 @@ export class Job< | |||
return job; | |||
} | |||
|
|||
static optsFromJSON(rawOpts?: string): JobsOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this method should be private since it has no use outside of this class.
const options = optionEntries.reduce<Partial<Record<string, any>>>( | ||
(acc, item) => { | ||
const [attributeName, value] = item; | ||
if (attributeName === 'rdof') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for now but I guess in the future we will have a map object for translating all the options from Redis representation to library representation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this is the beginning of it
]] | ||
|
||
local function updateParentIfNeeded(parentQueueKey, parentDependenciesKey, parentId ) | ||
local activeParent = rcall("ZSCORE", parentQueueKey .. ":waiting-children", parentId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, shouldn't "activeParent" variable name be called instead something like: "isParentWaiting" ?
Validate and move parent to active if needed. | ||
]] | ||
|
||
local function updateParentIfNeeded(parentQueueKey, parentDependenciesKey, parentId ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this function be renamed to "moveParentToWaitifNeeded" ? seems like that is what it does, "update" it is a big vague and makes it more difficult to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good to me
Dear @manast , I wanted to reach out and express my appreciation for the work you have done on the this project. I have been using the project for a few projects, and I think it is a fantastic resource. I was wondering if you would be open to considering the addition of this feature that I believe would greatly benefit the project. As right now there is no other way to complete a flow without removing the child manually. But the bigger problem for me is that removing child's from the array doesn't update the flow job. Thank you for your time, and I look forward to hearing from you. Sincerely, |
hi @M3talen, |
hi @roggervalf
Currently when a task fails (a child) the 'flow-job' is not executed until i delete it I hope this explains a bit of my problem. |
hi @M3talen, in your case you can use this function https://api.docs.bullmq.io/classes/FlowProducer.html#addBulk, for example: const trees = await flow.addBulk([
{
name: 'flow-job',
queueName: 'Flow-Queue',
data: {},
children: [
{
name,
data: { idx: 0, foo: 'bar' },
queueName: 'Flow-Queue',
},
],
},
{
name: 'non-dependent-child',
queueName: 'Flow-Queue',
data: {},
children: [
{
name,
data: { idx: 1, foo: 'baz' },
queueName: 'Flow-Queue',
},
],
},
]); so when you have children where you don't care if they complete or fail, those could be created apart of the main flow, with addBulk you can create all those flows together |
in favor of #1953 |
ref #800