Open domenkozar opened 2 weeks ago
I was a bit surprised by this. I thought the tasks were usually short-lived operations that just run one or more commands in a certain order and then just end.
The TSP seems to indicate this is a long lived process that can interactively start one or more tasks. It almost seems like the protocol could be used for the processes
of devenv up
?
That's pretty cool, I'm just wondering what the intention is.
Just to illustrate, the same could be done by myexecutable run task < json_file
? Where myexecutable always lives as long as the tasks it's running.
That said, the methods/responses make sense to me. I just wasn't sure where the tsp would get its configuration from if that resides in devenv.nix?
Nitpick (feel free to ignore): The stderr being bool was a bit surprising, but the alternatives I thought up might not be better (io: stdout
or even fileNo: 1
).
@bobvanderlinden you're correct to spot the intention for tasks to be an implementation detail for processes. That way we get systemd-level dependency trees also for processes.
Just to illustrate, the same could be done by myexecutable run task < json_file? Where myexecutable always lives as long as the tasks it's running.
There are two issues here when I was thinking about the design:
I just wasn't sure where the tsp would get its configuration from if that resides in devenv.nix?
it gets configuration from initialization phase that happens as soon as executable runs.
Nitpick (feel free to ignore): The stderr being bool was a bit surprising, but the alternatives I thought up might not be better (io: stdout or even fileNo: 1).
I had the same thought, the alternative would be line_stdout
and line_stderr
?
Task Server Protocol
https://devenv.sh allows defining tasks in your favorite language using JSON-RPC protocol and exposing them as an executable :
Listing tasks
Which would launch
myexecutable /tmp/rando.sock
anddevenv
would on startup immediately ask for a list of tasks:And the server responds:
Running tasks
Then the client can ask the server to run a task:
And server streams updates about stdout/stderr:
Until the final response from the server with outputs and the final status of the task.
Rust SDK
Implementation