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

Deprecate consuming the output of a task that wasn't executed #11100

Open
lptr opened this issue Oct 22, 2019 · 5 comments
Open

Deprecate consuming the output of a task that wasn't executed #11100

lptr opened this issue Oct 22, 2019 · 5 comments
Labels
a:chore Minor issue without significant impact in:execution-engine incremental, up-to-date, overlapping outputs in:work-validation task validation, warnings, disable optimizations

Comments

@lptr
Copy link
Member

lptr commented Oct 22, 2019

There are certain ways that tasks can be excluded from execution:

  • using Task.onlyIf()
  • using Task.enabled
  • using -exclude-task on the command-line

In each case the task will stay part of the task graph, but Gradle won't execute it. If there are tasks further down that consume the output of the excluded task, they see whatever stale output was left in place after the previous execution (or empty outputs in case of a clean build). This can lead to all kinds of problems.

We should fail if any such output is consumed by another task. It should probably be okay to depend on a skipped task via Task.dependsOn() but not to consume its output (either via Task.outputs.files or via any of its output properties).

One use case for -x is to use it with --rerun-tasks, excluding some expensive tasks. This could probably be better addressed via #9166 by only rerunning requested tasks.


cc: @gradle/build-cache

@stale
Copy link

stale bot commented Nov 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

@stale stale bot added the stale label Nov 25, 2020
@lptr
Copy link
Member Author

lptr commented Nov 25, 2020

We still want to do this.

@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

@stale stale bot added the stale label Apr 17, 2022
@wolfs wolfs removed the stale label Apr 19, 2022
@lptr lptr added in:execution-engine incremental, up-to-date, overlapping outputs in:work-validation task validation, warnings, disable optimizations @core Issue owned by GBT Core and removed in:execution-engine incremental, up-to-date, overlapping outputs labels Jun 2, 2022
@cspurk
Copy link

cspurk commented May 9, 2023

We have a build with many expensive and long-running tasks. For historical reasons, some of them are not incremental, so people often exclude tasks from running to save build time. But even if a task is not up-to-date, it may be okay for our use case to exclude the task and use the outdated task output. So, while there may be issues due to such exclusions, it more often is not a problem to use existing (and possibly even stale!) outputs from excluded tasks. In our use case, it is more critical to get a build product on time than having a reproducible build product. Removing the possibility to use existing outputs of excluded tasks would hence be very unfortunate for us.

So, is this change still planned? If so, then related issues like #21179 and #16789 would essentially never be fixed, I suppose.

On a more general note, I believe it should be clear to everyone who manually excludes tasks from running that stale outputs may be used then, and that this might lead to issues – depending on the build. If not, then maybe adding a warning to the docs (like here) could mitigate this.

@big-guy
Copy link
Member

big-guy commented Nov 27, 2023

This also applies to artifact transforms and artifacts that come through dependency management. IOW, this isn't as simple as two tasks that have their input/output wired directly together.

See #27042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:chore Minor issue without significant impact in:execution-engine incremental, up-to-date, overlapping outputs in:work-validation task validation, warnings, disable optimizations
Projects
None yet
Development

No branches or pull requests

5 participants