deploy-rs icon indicating copy to clipboard operation
deploy-rs copied to clipboard

deploy-rs takes a long time to evaluate machines

Open Mic92 opened this issue 4 years ago • 6 comments

When having many machines and other outputs it tries to evaluate all of them instead of just evaluating the target machine.

Doing

 deploy '.#machinename'

also evaluates all machines unrelated to this.

Mic92 avatar May 13 '21 06:05 Mic92

Are you using the latest version and does . refer to a real flake? If so it should definitely fall under this arm: https://github.com/serokell/deploy-rs/blob/master/src/bin/deploy.rs#L198 and thus skip evaluation of other nodes, unless you're refering to the check step which simply just runs nix flake check and can take much longer (though can be skipped by adding -s)

notgne2 avatar May 14 '21 04:05 notgne2

Another improvement to evaluation speed in #96

balsoft avatar Jun 25 '21 08:06 balsoft

This seems to be a complicated business...

What I observe when running deploy .#x, where x is a deployment:

  • When I set checks in outputs, all checks are performed before evaluation, which takes a very long time, even when only one deployment is done.
  • With checks unset: When I set nixosConfigurations (additionally to deploy, and like it is done in the system example provided), all of those configurations are checked before evaluation, even when only some of them are deployed. That is, assume I have tow nodes NODE1 and NODE2, and I only deploy NODE1-system, both are checked:
checking NixOS configuration 'nixosConfigurations.NODE1-system'
checking NixOS configuration 'nixosConfigurations.NODE2-system'
  • With checks unset: If I do not provide nixosConfigurations in outputs no checks are performed.
  • Independent of checks set or unset and independent if homeConfigurations is an output or just part of deploy: no checks are performed for the home manager configurations.

This means, I can either perform all nixosConfigurations checks, or none, but I am not able to only perform checks for the deployed nodes. Further, there don't seem to be checks for the homeConfigurations.

Let me know if I got something wrong or if my exposition is unclear.

EDIT: I should also have said that everything else works really well, thank you! I use deploy-rs to deploy my local as well as other machines. It's great that there is no real difference between local and remote objects.

dschrempf avatar Oct 01 '21 19:10 dschrempf

I've noticed the same thing where checks run for my 3 nixos configurations even though I deploy one node. It triggers all sorts of issues on top of being slow :'(

teto avatar Dec 08 '22 15:12 teto

Still the issue

supermarin avatar Jul 13 '23 22:07 supermarin

currently

This means, I can either perform all nixosConfigurations checks, or none, but I am not able to only perform checks for the deployed nodes. Further, there don't seem to be checks for the homeConfigurations.

The way deploy-rs checks are set up, it's either all or none due to it being a single check iirc.

We could look into splitting up the checks per machine, that would also enable mixed-arch deployments or rather allow to check just the deployments with the same arch as the deployment host and ones that can be emulated by it.

Do keep in mind that this would inflate the checks section considerably since flakes do not allow for nested checks currently:

├───checks
│   ├───aarch64-darwin
│   │   ├───deploy-activate: derivation 'deploy-rs-check-activate'
│   │   ├───deploy-schema: derivation 'jsonschema-deploy-system'
│   │   ├───pre-commit: derivation 'pre-commit-run'
│   │   └───treefmt: derivation 'treefmt-check'
│   ├───aarch64-linux
│   │   ├───deploy-activate: derivation 'deploy-rs-check-activate'
│   │   ├───deploy-schema: derivation 'jsonschema-deploy-system'
│   │   ├───pre-commit: derivation 'pre-commit-run'
│   │   └───treefmt: derivation 'treefmt-check'
│   └───x86_64-linux
│       ├───deploy-activate: derivation 'deploy-rs-check-activate'
│       ├───deploy-schema: derivation 'jsonschema-deploy-system'
│       ├───pre-commit: derivation 'pre-commit-run'
│       └───treefmt: derivation 'treefmt-check'

PhilTaken avatar Jul 14 '23 06:07 PhilTaken