Skip to content

Commit 15309e2

Browse files
authored
Merge pull request #50 from MoseleyBioinformaticsLab/descendants
Corrects the spelling of "descendant"
2 parents d429081 + aa31a51 commit 15309e2

35 files changed

+250
-250
lines changed

docs/notebook/tutorial.ipynb

Lines changed: 44 additions & 44 deletions
Large diffs are not rendered by default.

docs/tutorial.rst

Lines changed: 47 additions & 47 deletions
Large diffs are not rendered by default.

src/gpu_tracker/tracker.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(
5858
time_unit, _TrackingProcess._time_unit2coefficient, unit_type='time')
5959
self._disable_logs = disable_logs
6060
self._main_process_id = main_process_id
61-
percent_keys = ['cpu_system', 'cpu_main', 'cpu_descendents', 'cpu_combined', 'gpu']
61+
percent_keys = ['cpu_system', 'cpu_main', 'cpu_descendants', 'cpu_combined', 'gpu']
6262
self._sum_percent_sums = {key: 0. for key in percent_keys}
6363
self._hardware_percent_sums = {key: 0. for key in percent_keys}
6464
self._tracking_iteration = 1
@@ -125,20 +125,20 @@ def run(self):
125125
# Tracking has completed.
126126
break
127127
try:
128-
descendent_processes = [
128+
descendant_processes = [
129129
process for process in main_process.children(recursive=True) if process.pid not in self._extraneous_process_ids]
130130
# The first call to cpu_percent returns a meaningless value of 0.0 and should be ignored.
131131
# And it's recommended to wait a specified amount of time after the first call to cpu_percent.
132132
# See https://psutil.readthedocs.io/en/latest/#psutil.Process.cpu_percent
133-
self._map_processes(processes=[main_process] + descendent_processes, map_func=get_cpu_percent)
133+
self._map_processes(processes=[main_process] + descendant_processes, map_func=get_cpu_percent)
134134
# Get the maximum RAM usage.
135135
ram_map_func = get_memory_maps if self._is_linux else get_rss
136136
main_ram = self._map_processes([main_process], map_func=ram_map_func)
137-
descendents_ram = self._map_processes(descendent_processes, map_func=ram_map_func)
138-
combined_ram = main_ram + descendents_ram
137+
descendants_ram = self._map_processes(descendant_processes, map_func=ram_map_func)
138+
combined_ram = main_ram + descendants_ram
139139
kwarg = 'memory_maps_list' if self._is_linux else 'rss_list'
140140
self._update_ram(rss_values=self._resource_usage.max_ram.main, **{kwarg: main_ram})
141-
self._update_ram(rss_values=self._resource_usage.max_ram.descendents, **{kwarg: descendents_ram})
141+
self._update_ram(rss_values=self._resource_usage.max_ram.descendants, **{kwarg: descendants_ram})
142142
self._update_ram(rss_values=self._resource_usage.max_ram.combined, **{kwarg: combined_ram})
143143
self._resource_usage.max_ram.system = max(
144144
self._resource_usage.max_ram.system, psutil.virtual_memory().used * self._ram_coefficient)
@@ -148,8 +148,8 @@ def run(self):
148148
if len(gpu_info):
149149
process_ids = {self._main_process_id}
150150
self._update_gpu_ram(attr='main', process_ids=process_ids, gpu_info=gpu_info)
151-
process_ids = set(self._map_processes(processes=descendent_processes, map_func=lambda process: process.pid))
152-
self._update_gpu_ram(attr='descendents', process_ids=process_ids, gpu_info=gpu_info)
151+
process_ids = set(self._map_processes(processes=descendant_processes, map_func=lambda process: process.pid))
152+
self._update_gpu_ram(attr='descendants', process_ids=process_ids, gpu_info=gpu_info)
153153
process_ids.add(self._main_process_id)
154154
self._update_gpu_ram(attr='combined', process_ids=process_ids, gpu_info=gpu_info)
155155
gpu_info = _TrackingProcess._query_gpu(nvidia_command='--query-gpu=uuid,memory.used,utilization.gpu')
@@ -164,10 +164,10 @@ def run(self):
164164

165165
# Get the mean and maximum CPU usages.
166166
main_n_threads = self._map_processes([main_process], map_func=get_n_threads)
167-
descendent_n_threads = self._map_processes(descendent_processes, map_func=get_n_threads)
167+
descendant_n_threads = self._map_processes(descendant_processes, map_func=get_n_threads)
168168
self._update_n_threads(n_threads_list=main_n_threads, attr='main')
169-
self._update_n_threads(n_threads_list=descendent_n_threads, attr='descendents')
170-
self._update_n_threads(n_threads_list=main_n_threads + descendent_n_threads, attr='combined')
169+
self._update_n_threads(n_threads_list=descendant_n_threads, attr='descendants')
170+
self._update_n_threads(n_threads_list=main_n_threads + descendant_n_threads, attr='combined')
171171
# noinspection PyTypeChecker
172172
system_core_percentages: list[float] = psutil.cpu_percent(percpu=True)
173173
cpu_utilization = self._resource_usage.cpu_utilization
@@ -176,15 +176,15 @@ def run(self):
176176
percent_key='cpu_system', n_hardware_units=cpu_utilization.system_core_count)
177177
time.sleep(_TrackingProcess._CPU_PERCENT_INTERVAL)
178178
main_percentage = self._map_processes([main_process], map_func=get_cpu_percent)
179-
descendent_percentages = self._map_processes(processes=descendent_processes, map_func=get_cpu_percent)
179+
descendant_percentages = self._map_processes(processes=descendant_processes, map_func=get_cpu_percent)
180180
self._update_processing_unit_utilization(
181181
current_percentages=main_percentage, processing_unit_percentages=cpu_utilization.main, percent_key='cpu_main',
182182
n_hardware_units=cpu_utilization.n_expected_cores)
183183
self._update_processing_unit_utilization(
184-
current_percentages=descendent_percentages, processing_unit_percentages=cpu_utilization.descendents,
185-
percent_key='cpu_descendents', n_hardware_units=cpu_utilization.n_expected_cores)
184+
current_percentages=descendant_percentages, processing_unit_percentages=cpu_utilization.descendants,
185+
percent_key='cpu_descendants', n_hardware_units=cpu_utilization.n_expected_cores)
186186
self._update_processing_unit_utilization(
187-
current_percentages=main_percentage + descendent_percentages, processing_unit_percentages=cpu_utilization.combined,
187+
current_percentages=main_percentage + descendant_percentages, processing_unit_percentages=cpu_utilization.combined,
188188
percent_key='cpu_combined', n_hardware_units=cpu_utilization.n_expected_cores)
189189
# Update compute time.
190190
self._resource_usage.compute_time.time = (time.time() - start_time) * self._time_coefficient
@@ -398,7 +398,7 @@ def __str__(self) -> str:
398398
text = text.replace(': {', ':').replace('{', '').replace('}', '').replace('_', ' ').replace('"', '').replace(',', '')
399399
return text.replace('max', 'Max').replace('ram', 'RAM').replace('unit', 'Unit').replace('system', 'System').replace(
400400
'compute', 'Compute').replace('time: ', 'Time: ').replace('rss', 'RSS').replace('total', 'Total').replace(
401-
'private', 'Private').replace('shared', 'Shared').replace('main', 'Main').replace('descendents', 'Descendents').replace(
401+
'private', 'Private').replace('shared', 'Shared').replace('main', 'Main').replace('descendants', 'Descendants').replace(
402402
'combined', 'Combined').replace('gpu', 'GPU').replace('mean', 'Mean').replace('cpu', 'CPU').replace(
403403
'n threads', 'number of threads').replace('n expected', 'Number of expected')
404404

@@ -444,14 +444,14 @@ class MaxRAM:
444444
:param system_capacity: A constant value for the RAM capacity of the entire operating system.
445445
:param system: The RAM usage across the entire operating system.
446446
:param main: The RAM usage of the main process.
447-
:param descendents: The summed RAM usage of the descendent processes (i.e. child processes, grandchild processes, etc.).
448-
:param combined: The summed RAM usage of both the main process and any descendent processes it may have.
447+
:param descendants: The summed RAM usage of the descendant processes (i.e. child processes, grandchild processes, etc.).
448+
:param combined: The summed RAM usage of both the main process and any descendant processes it may have.
449449
"""
450450
unit: str
451451
system_capacity: float
452452
system: float = 0.
453453
main: RSSValues = dclass.field(default_factory=RSSValues)
454-
descendents: RSSValues = dclass.field(default_factory=RSSValues)
454+
descendants: RSSValues = dclass.field(default_factory=RSSValues)
455455
combined: RSSValues = dclass.field(default_factory=RSSValues)
456456

457457

@@ -464,14 +464,14 @@ class MaxGPURAM:
464464
:param system_capacity: A constant value for the GPU RAM capacity of all the GPUs in the system.
465465
:param system: The GPU RAM usage of all the GPUs in the system.
466466
:param main: The GPU RAM usage of the main process.
467-
:param descendents: The summed GPU RAM usage of the descendent processes (i.e. child processes, grandchild processes, etc.).
468-
:param combined: The summed GPU RAM usage of both the main process and any descendent processes it may have.
467+
:param descendants: The summed GPU RAM usage of the descendant processes (i.e. child processes, grandchild processes, etc.).
468+
:param combined: The summed GPU RAM usage of both the main process and any descendant processes it may have.
469469
"""
470470
unit: str
471471
system_capacity: float
472472
system: float = 0.
473473
main: float = 0.
474-
descendents: float = 0.
474+
descendants: float = 0.
475475
combined: float = 0.
476476

477477

@@ -498,27 +498,27 @@ class ProcessingUnitPercentages:
498498
@dclass.dataclass
499499
class CPUUtilization:
500500
"""
501-
Information related to CPU usage, including core utilization percentages of the main process and any descendent processes it may have as well as system-wide utilization.
502-
The system hardware utilization percentages are strictly divided by the total number of cores in the system while that of the main, descendent, and combined processes can be divided by the expected number of cores used in a task.
501+
Information related to CPU usage, including core utilization percentages of the main process and any descendant processes it may have as well as system-wide utilization.
502+
The system hardware utilization percentages are strictly divided by the total number of cores in the system while that of the main, descendant, and combined processes can be divided by the expected number of cores used in a task.
503503
504504
:param system_core_count: The number of cores available to the entire operating system.
505-
:param n_expected_cores: The number of cores expected to be used by the main process and/or any descendent processes it may have.
505+
:param n_expected_cores: The number of cores expected to be used by the main process and/or any descendant processes it may have.
506506
:param system: The utilization percentages of all the cores in the entire operating system.
507507
:param main: The utilization percentages of the cores used by the main process.
508-
:param descendents: The utilization percentages summed across descendent processes (i.e. child processes, grandchild processes, etc.).
509-
:param combined: The utilization percentages summed across both the descendent processes and the main process.
508+
:param descendants: The utilization percentages summed across descendant processes (i.e. child processes, grandchild processes, etc.).
509+
:param combined: The utilization percentages summed across both the descendant processes and the main process.
510510
:param main_n_threads: The maximum detected number of threads used by the main process at any time.
511-
:param descendents_n_threads: The maximum sum of threads used across the descendent processes at any time.
512-
:param combined_n_threads: The maximum sum of threads used by both the main and descendent processes.
511+
:param descendants_n_threads: The maximum sum of threads used across the descendant processes at any time.
512+
:param combined_n_threads: The maximum sum of threads used by both the main and descendant processes.
513513
"""
514514
system_core_count: int
515515
n_expected_cores: int
516516
system: ProcessingUnitPercentages = dclass.field(default_factory=ProcessingUnitPercentages)
517517
main: ProcessingUnitPercentages = dclass.field(default_factory=ProcessingUnitPercentages)
518-
descendents: ProcessingUnitPercentages = dclass.field(default_factory=ProcessingUnitPercentages)
518+
descendants: ProcessingUnitPercentages = dclass.field(default_factory=ProcessingUnitPercentages)
519519
combined: ProcessingUnitPercentages = dclass.field(default_factory=ProcessingUnitPercentages)
520520
main_n_threads: int = 0
521-
descendents_n_threads: int = 0
521+
descendants_n_threads: int = 0
522522
combined_n_threads: int = 0
523523

524524

tests/data/False-Linux-bytes-megabytes-seconds.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"private_rss": 6718.0,
99
"shared_rss": 10036.0
1010
},
11-
"descendents": {
11+
"descendants": {
1212
"total_rss": 30208.0,
1313
"private_rss": 13818.0,
1414
"shared_rss": 16390.0
@@ -24,7 +24,7 @@
2424
"system_capacity": 36594.0,
2525
"system": 6500.0,
2626
"main": 1600.0,
27-
"descendents": 4300.0,
27+
"descendants": 4300.0,
2828
"combined": 5800.0
2929
},
3030
"cpu_utilization": {
@@ -42,7 +42,7 @@
4242
"mean_sum_percent": 119.7,
4343
"mean_hardware_percent": 39.9
4444
},
45-
"descendents": {
45+
"descendants": {
4646
"max_sum_percent": 142.2,
4747
"max_hardware_percent": 47.4,
4848
"mean_sum_percent": 129.73333333333332,
@@ -55,7 +55,7 @@
5555
"mean_hardware_percent": 83.14444444444445
5656
},
5757
"main_n_threads": 2,
58-
"descendents_n_threads": 6,
58+
"descendants_n_threads": 6,
5959
"combined_n_threads": 8
6060
},
6161
"gpu_utilization": {

tests/data/False-Linux-bytes-megabytes-seconds.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Max RAM:
66
Total RSS: 16754.0
77
Private RSS: 6718.0
88
Shared RSS: 10036.0
9-
Descendents:
9+
Descendants:
1010
Total RSS: 30208.0
1111
Private RSS: 13818.0
1212
Shared RSS: 16390.0
@@ -19,7 +19,7 @@ Max GPU RAM:
1919
System capacity: 36594.0
2020
System: 6500.0
2121
Main: 1600.0
22-
Descendents: 4300.0
22+
Descendants: 4300.0
2323
Combined: 5800.0
2424
CPU utilization:
2525
System core count: 4
@@ -34,7 +34,7 @@ CPU utilization:
3434
Max hardware percent: 66.3
3535
Mean sum percent: 119.7
3636
Mean hardware percent: 39.9
37-
Descendents:
37+
Descendants:
3838
Max sum percent: 142.2
3939
Max hardware percent: 47.4
4040
Mean sum percent: 129.733
@@ -45,7 +45,7 @@ CPU utilization:
4545
Mean sum percent: 249.433
4646
Mean hardware percent: 83.144
4747
Main number of threads: 2
48-
Descendents number of threads: 6
48+
Descendants number of threads: 6
4949
Combined number of threads: 8
5050
GPU utilization:
5151
System GPU count: 3

tests/data/False-Linux-kilobytes-bytes-days.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"private_rss": 6.718,
99
"shared_rss": 10.036
1010
},
11-
"descendents": {
11+
"descendants": {
1212
"total_rss": 30.208,
1313
"private_rss": 13.818,
1414
"shared_rss": 16.39
@@ -24,7 +24,7 @@
2424
"system_capacity": 36594000000.0,
2525
"system": 6500000000.0,
2626
"main": 1600000000.0,
27-
"descendents": 4300000000.0,
27+
"descendants": 4300000000.0,
2828
"combined": 5800000000.0
2929
},
3030
"cpu_utilization": {
@@ -42,7 +42,7 @@
4242
"mean_sum_percent": 119.7,
4343
"mean_hardware_percent": 29.925
4444
},
45-
"descendents": {
45+
"descendants": {
4646
"max_sum_percent": 142.2,
4747
"max_hardware_percent": 35.55,
4848
"mean_sum_percent": 129.73333333333332,
@@ -55,7 +55,7 @@
5555
"mean_hardware_percent": 62.35833333333333
5656
},
5757
"main_n_threads": 2,
58-
"descendents_n_threads": 6,
58+
"descendants_n_threads": 6,
5959
"combined_n_threads": 8
6060
},
6161
"gpu_utilization": {

tests/data/False-Linux-kilobytes-bytes-days.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Max RAM:
66
Total RSS: 16.754
77
Private RSS: 6.718
88
Shared RSS: 10.036
9-
Descendents:
9+
Descendants:
1010
Total RSS: 30.208
1111
Private RSS: 13.818
1212
Shared RSS: 16.39
@@ -19,7 +19,7 @@ Max GPU RAM:
1919
System capacity: 36594000000.0
2020
System: 6500000000.0
2121
Main: 1600000000.0
22-
Descendents: 4300000000.0
22+
Descendants: 4300000000.0
2323
Combined: 5800000000.0
2424
CPU utilization:
2525
System core count: 4
@@ -34,7 +34,7 @@ CPU utilization:
3434
Max hardware percent: 49.725
3535
Mean sum percent: 119.7
3636
Mean hardware percent: 29.925
37-
Descendents:
37+
Descendants:
3838
Max sum percent: 142.2
3939
Max hardware percent: 35.55
4040
Mean sum percent: 129.733
@@ -45,7 +45,7 @@ CPU utilization:
4545
Mean sum percent: 249.433
4646
Mean hardware percent: 62.358
4747
Main number of threads: 2
48-
Descendents number of threads: 6
48+
Descendants number of threads: 6
4949
Combined number of threads: 8
5050
GPU utilization:
5151
System GPU count: 3

tests/data/False-Linux-kilobytes-gigabytes-minutes.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"private_rss": 6.718,
99
"shared_rss": 10.036
1010
},
11-
"descendents": {
11+
"descendants": {
1212
"total_rss": 30.208,
1313
"private_rss": 13.818,
1414
"shared_rss": 16.39
@@ -24,7 +24,7 @@
2424
"system_capacity": 36.594,
2525
"system": 6.5,
2626
"main": 1.6,
27-
"descendents": 4.3,
27+
"descendants": 4.3,
2828
"combined": 5.8
2929
},
3030
"cpu_utilization": {
@@ -42,7 +42,7 @@
4242
"mean_sum_percent": 119.7,
4343
"mean_hardware_percent": 59.85
4444
},
45-
"descendents": {
45+
"descendants": {
4646
"max_sum_percent": 142.2,
4747
"max_hardware_percent": 71.1,
4848
"mean_sum_percent": 129.73333333333332,
@@ -55,7 +55,7 @@
5555
"mean_hardware_percent": 124.71666666666665
5656
},
5757
"main_n_threads": 2,
58-
"descendents_n_threads": 6,
58+
"descendants_n_threads": 6,
5959
"combined_n_threads": 8
6060
},
6161
"gpu_utilization": {

tests/data/False-Linux-kilobytes-gigabytes-minutes.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Max RAM:
66
Total RSS: 16.754
77
Private RSS: 6.718
88
Shared RSS: 10.036
9-
Descendents:
9+
Descendants:
1010
Total RSS: 30.208
1111
Private RSS: 13.818
1212
Shared RSS: 16.39
@@ -19,7 +19,7 @@ Max GPU RAM:
1919
System capacity: 36.594
2020
System: 6.5
2121
Main: 1.6
22-
Descendents: 4.3
22+
Descendants: 4.3
2323
Combined: 5.8
2424
CPU utilization:
2525
System core count: 4
@@ -34,7 +34,7 @@ CPU utilization:
3434
Max hardware percent: 99.45
3535
Mean sum percent: 119.7
3636
Mean hardware percent: 59.85
37-
Descendents:
37+
Descendants:
3838
Max sum percent: 142.2
3939
Max hardware percent: 71.1
4040
Mean sum percent: 129.733
@@ -45,7 +45,7 @@ CPU utilization:
4545
Mean sum percent: 249.433
4646
Mean hardware percent: 124.717
4747
Main number of threads: 2
48-
Descendents number of threads: 6
48+
Descendants number of threads: 6
4949
Combined number of threads: 8
5050
GPU utilization:
5151
System GPU count: 3

0 commit comments

Comments
 (0)