Commit e284ce4
committed
prototype of custom resource scheduling
Platforms other than Linux, especially non-Unix platforms, may have a different
view of resources that don't model well as `resources.cpu` or
`resources.memory`. And users with unusual deployment environments have asked
about the possibility of scheduling resources specific to those environments.
This PR is a prototype of the kind of interface we might want to be able to
support. Nodes get a `client.custom_resource` block where they can define a
resource the node will make available in its fingerprint. Resources are one of
five types, designed to make it possible to model all our existing resources as
custom resources:
* `ratio`: The resource is used as a value relative to other tasks with the same
resource. An example of this would be Linux `cpu.weight` as implemented by a
systemd unit file.
* `capped-ratio`: Like a ratio, except all the quantity used by tasks has a
maximum total value. An example of this would be Linux `cpu.weight` as currently
implemented in Nomad, where the "cap" is derived from the total Mhz of CPUs on
the host.
* `countable`: The resource has a fixed but fungible amount. An example of this
would be memory allocation (ignoring NUMA), where there's a certain amount of
memory available on the host and it's "used up" by allocations, but we don't
care about identity of the individual blocks of memory.
* `dynamic`: The resource has a fixed set of items with exclusive access, but
the job doesn't care which ones it gets. An example of this would be Nomad's
current dynamic port assignment or `resource.cores`.
* `static`: The resource has a fixed set of items with exclusive access, and the
job wants a specific one of those items. An example of this woul dbe Nomad's
current static port assignment.
We can use this prototype to anchor discussions about how we might implement a
set of custom resource scheduling features but it's nowhere near
production-ready. I've included enough plumbing to implement these five resource
types, fingerprint them on clients via config files, and schedule them for
allocations. What's not included, all of which we'd want to solve in any
productionized version of this work:
* Support for exposing the custom resource allocation to a task driver. We'd
need to thread custom resources into the protobufs we send via `go-plugin` and
then the user's task driver would need to consume that data.
* Support for preemption
* Support for quotas
* Support for dynamically adding custom resources to a node
Ref: #10811 parent 8419ccd commit e284ce4
File tree
17 files changed
+1117
-3
lines changed- api
- client
- config
- command
- agent
- nomad/structs
- scheduler/feasible
17 files changed
+1117
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| 439 | + | |
439 | 440 | | |
440 | 441 | | |
441 | 442 | | |
442 | 443 | | |
443 | 444 | | |
444 | 445 | | |
| 446 | + | |
445 | 447 | | |
446 | 448 | | |
447 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| 590 | + | |
590 | 591 | | |
591 | 592 | | |
592 | 593 | | |
| |||
629 | 630 | | |
630 | 631 | | |
631 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
632 | 645 | | |
633 | 646 | | |
634 | 647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1649 | 1649 | | |
1650 | 1650 | | |
1651 | 1651 | | |
| 1652 | + | |
1652 | 1653 | | |
1653 | 1654 | | |
1654 | 1655 | | |
1655 | 1656 | | |
1656 | 1657 | | |
1657 | 1658 | | |
| 1659 | + | |
1658 | 1660 | | |
1659 | 1661 | | |
1660 | 1662 | | |
| |||
1813 | 1815 | | |
1814 | 1816 | | |
1815 | 1817 | | |
| 1818 | + | |
| 1819 | + | |
1816 | 1820 | | |
1817 | 1821 | | |
1818 | 1822 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| 398 | + | |
| 399 | + | |
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
| |||
896 | 898 | | |
897 | 899 | | |
898 | 900 | | |
| 901 | + | |
899 | 902 | | |
900 | 903 | | |
901 | 904 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| |||
936 | 937 | | |
937 | 938 | | |
938 | 939 | | |
| 940 | + | |
939 | 941 | | |
940 | 942 | | |
941 | 943 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
446 | 450 | | |
447 | 451 | | |
448 | 452 | | |
| |||
466 | 470 | | |
467 | 471 | | |
468 | 472 | | |
| 473 | + | |
469 | 474 | | |
470 | 475 | | |
471 | 476 | | |
| |||
2883 | 2888 | | |
2884 | 2889 | | |
2885 | 2890 | | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
2886 | 2895 | | |
2887 | 2896 | | |
2888 | 2897 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
333 | 338 | | |
334 | 339 | | |
335 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1646 | 1646 | | |
1647 | 1647 | | |
1648 | 1648 | | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
1649 | 1665 | | |
1650 | 1666 | | |
1651 | 1667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
| 572 | + | |
572 | 573 | | |
573 | 574 | | |
574 | 575 | | |
| |||
788 | 789 | | |
789 | 790 | | |
790 | 791 | | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
791 | 821 | | |
792 | 822 | | |
793 | 823 | | |
| |||
0 commit comments