Comments (9)
This is expected behavior as documented. You can't depend on a long-running task because it won't exit.
Some options for what you may be trying to achieve:
turbo watch
allows a task to be dependency-aware. Note that this comes with the caveat that two long-running tasks still won't be able to depend on each other.- Remove the
dependsOn
relationship between the tasks so that they can run in parallel, as you've mentioned is the behavior you're looking for. You might also add a "sleep 5 && your-command" to delay the startup invocation of the script that needs to wait.
Ultimately, there's no way for Turborepo to associate the runtime behavior of your tasks against each other. That would be a brand new construct that would need a champion, an RFC, and community backing so we know people want it. If you're interested in writing that idea down for the community, you can open a Discussion with the Idea label so we can all chat about it more.
from turbo.
That's a description of the runtime behavior, rather than the task graphing behavior.
The tasks can indeed run at the same time, as parallelism is the default behavior of Turborepo. If you see tasks that are blocking each other and you don't want them to, you would remove their relationship in the Task Graph.
from turbo.
Ultimately, there's no way for Turborepo to associate the runtime behavior of your tasks against each other
There is no reason for why it would need to. If task b
depends on task a
and both are persistent then just run both of them in parallell at the same time, how is that not the logical way to do it?
Nevertheless I've created a discussion for it if thats the correct forum to discuss this.
from turbo.
Remove the dependsOn relationship between the tasks so that they can run in parallel, as you've mentioned is the behavior you're looking for. You might also add a "sleep 5 && your-command" to delay the startup invocation of the script that needs to wait.
Can you explain how that's different from what I've described here? What you're describing is the default behavior.
from turbo.
Can you explain how that's different from what I've described here? What you're describing is the default behavior.
I'll try my best to explain since it seems that we have a bit of a miss-communication.
The point of turborepo is to build up a dependency graph automatically for a monorepo context. If I have a task called build
with some dependencies and a package called package-b
that depends on other packages in my monorepo, then when I run a command like pnpm turbo --filter package-b build
its turborepo
's job to figure out which other packages package-b
depends on and run their build task as well. It does this "automatically" meaning that won't have to manually build up a list of dependencies like I might need to do if I instead was using a Makefile
. Hopefully we agree that thats the point of turborepo
, its a smarter alternative to Makefiles
with some built inn caching options.
With the introduction of "persistent tasks" I would like for turborepo
to still do its job building up a dependency graph and running all of the task that depends on each other. This however turborepo
can't currently do, which you claim is by design. That means that turborepo
servs zero purposes over a Makefile
, even worse, I'm no forced to create a Makefile
just for "persistent tasks" where I manually group tasks together that are supposed to run together across the monorepo.
Mind you I was already doing this manually before the introduction of "persistent tasks" to turborepo
, but I had hoped now that turborepo
got "persistent tasks" that I would no longer have to do this kind of double bookkeeping where turborepo
can build a dependency graph only for "non-persistent tasks" but I myself still have to maintain this on the side.
When I first heard that turborepo
was getting built inn support for "persistent tasks" I imagined that it would work as following:
Should column be able to depend on row | Persistent task | Non-persistent task |
---|---|---|
Persisten task | Yes, run both in parallell | No, the persistent task will never finish before the non-persistent task gets to run |
Non-persistent task | Yes, run the non-persistent task first and then the persisten task | Yes, run the non-persistent task first before the other non-persistent task |
That way instead of having a Makefile
where I manually keep a list of "persistent tasks" that need to run together I could simply use turborepo
as I do for "non-presistent tasks"
from turbo.
Tasks that run in parallel are, by definition, not depending on each other. If you want to run them in parallel, you would remove the dependsOn
relationship.
from turbo.
Tasks that run in parallel are, by definition, not depending on each other. If you want to run them in parallel, you would remove the dependsOn relationship.
I don't agree with you. For example a Frontend app would depend on the api from the Backend app, therefor in a dev setting (persistent task) they would both need to run at the same time.
from turbo.
That's a description of the runtime behavior, rather than the task graphing behavior.
Persistent tasks are runtime behavior.
It is my opinion that dependsOn for persistent tasks should work the same way that depends_on
work in a Docker Compose file.
from turbo.
@TheKnarf I think you can do what you're looking for with the filtering syntax https://turbo.build/repo/docs/reference/run#microsyntaxes-for-filtering
In your example you'd do something like turbo run dev --filter=package-b...
to also run dev on all the dependencies of package-b
from turbo.
Related Issues (20)
- add example with yarn berry and docker HOT 1
- Docs: `--filter` with multiple filters should be an intersection, not a union
- Turbo saving caches in incorrect location HOT 9
- Allow disabling checking for a new version of Turborepo HOT 4
- `@turbo/codemod` does not handle Yarn 4 installations
- Turbo doesn't detect dependencies with PNPM >= 9.0.0 HOT 3
- Turbo produces an `undefined` folder HOT 3
- [VS Code Extension] Transit Nodes gives `turbo:no-such-task` error
- Turborepo@2 is no longer playing well with vscode debug terminal HOT 6
- Docs: formatting errors inside `code` blocks in configuring turbo.json page HOT 1
- [LSP] Extension fails to resolve turbo.path in VSC HOT 1
- `@turbo/codemod` does not update `$schema` version
- Package scoping fails when workspace glob has leading `./` HOT 1
- Fail to build on Vercel with completely inconsistent errors. HOT 2
- New UI results in unclear expectations in large monorepo where the task you actually want to run (at the very end) is hidden at the very bottom HOT 4
- turbo-ignore throw an error if there is a symlink in the packages folder HOT 1
- Sending fatal alert BadCertificate HOT 7
- No context detected when the context is defined in an app and the library that use it is in a package
- New UI is not working (version 2.0.6) HOT 1
- New TUI: Scrolling behavior can be improved
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbo.