Skip to content

Commit 24527c2

Browse files
docs: always specify an interval with cpu_percent
* Closes cylc/cylc-doc#829
1 parent 765e36d commit 24527c2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cylc/flow/cfgspec/globalcfg.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,8 @@ def default_for(
10161016
10171017
.. code-block:: python
10181018
1019-
# rank hosts by cpu_percent
1020-
cpu_percent()
1019+
# rank hosts by cpu_percent over a 1 second interval
1020+
cpu_percent(1) # Note: monitors CPU for 1 second
10211021
10221022
# rank hosts by 15min average of server load
10231023
getloadavg()[2]
@@ -1040,7 +1040,7 @@ def default_for(
10401040
.. code-block:: python
10411041
10421042
# filter out hosts with a CPU utilisation of 70% or above
1043-
cpu_percent() < 70
1043+
cpu_percent(1) < 70
10441044
10451045
# filter out hosts with less than 1GB of RAM available
10461046
virtual_memory().available > 1000000000
@@ -1057,14 +1057,14 @@ def default_for(
10571057
.. code-block:: python
10581058
10591059
# filter hosts
1060-
cpu_percent() < 70
1060+
cpu_percent(1) < 70
10611061
disk_usage('/').free > 1000000000
10621062
10631063
# rank hosts by CPU count
10641064
1 / cpu_count()
10651065
# if two hosts have the same CPU count
10661066
# then rank them by CPU usage
1067-
cpu_percent()
1067+
cpu_percent(1)
10681068
10691069
.. versionchanged:: 8.0.0
10701070

cylc/flow/host_select.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,14 @@ def select_host(
185185
186186
# only consider hosts with less than 70% cpu usage
187187
# and a server load of less than 5
188-
cpu_percent() < 70
188+
cpu_percent(1) < 70
189189
getloadavg()[0] < 5
190190
191191
And or Python statements to rank hosts by e.g::
192192
193193
# rank by used cpu, then by load average as a tie-break
194194
# (lower scores are better)
195-
cpu_percent()
195+
cpu_percent(1)
196196
getloadavg()
197197
198198
Comments are allowed using `#` but not inline comments.

0 commit comments

Comments
 (0)