-
-
Notifications
You must be signed in to change notification settings - Fork 414
document-more-complex-task-usecases #5816
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
base: main
Are you sure you want to change the base?
document-more-complex-task-usecases #5816
Conversation
96ba435
to
465fe94
Compare
465fe94
to
025a6ed
Compare
I also discovered a potential bug during this. If that is actually intended behavior, I can include it in the documentation |
@@ -23,6 +23,9 @@ def printFileData(fileName: String) = Task.Command { | |||
// anywhere and passed around any way you want, until you finally make use of them | |||
// within a downstream task or command. | |||
// | |||
// Anonymous tasks work well when parameters are known at task definition time. Dynamically | |||
// generated inputs can not be used with Anonymous Tasks, as this would break caching. |
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.
"as this would break caching." is wrong. It's not about caching, but definition/dependency order.
Since we need to know the parameters before creating the task, but the tasks need to be created before we can start evaluation, we have a classic hen-or-egg problem.
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.
There are three strategies to resolve this:
- define the values outside of a task, so Mill knows how to create the anonymous tasks before evaluation starts
- put the value itself into a task, so it can be properly ordered to be evaluated before it's dependencies
- Make it not a task but a normal
def
Improve the documentation around Anonymous Tasks, and give some extra examples of complex task usage.
addresses #5812