Fixing context of tasks when running pipeline#1411
Closed
Shahar-Y wants to merge 2 commits into
Closed
Conversation
Contributor
|
Thank you so much @Shahar-Y for identifying the issue and submitting a solution. Your work was really helpful in pinpointing the problem and validating the fix! I noticed a few additional linting issues and made some tweaks to the fix to align it with our coding standards. I’ll be closing out this PR in favor of this new PR #1416 , which incorporates your solution but with a slightly different approach. Thanks again for your contribution, and I’ve credited you in the final PR! 🙌 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1410
I noticed the agents ignore the context tasks given to them in the
contextfield.After thorough debugging I fund that the problem lays in the deep copy in
crew.py(def copy(self)function) .The problem was that when running the pipeline, it first copies the crews and then runs the copied crews.
When deep-copying the crew, the tasks are being copied, but they create another instance of the task in the context. That instance's output is not updated when the real task completes and therefore the tasks in the context always have an empty output field.
To solve it, I compared the keys of the original copied tasks with the tasks in the context of each task, and if they were the same, I replaced the context task with the original one. That way the context points to the task that is being run. It works perfectly now.
Proof it works:
Now the example in #1410 gives the correct answer:
