Add launch file to launch system CPU and Memory collector nodes #63
Conversation
Signed-off-by: Prajakta Gokhale <prajaktg@amazon.com>
Codecov Report
@@ Coverage Diff @@
## master #63 +/- ##
=======================================
Coverage 41.52% 41.52%
=======================================
Files 29 29
Lines 932 932
Branches 535 535
=======================================
Hits 387 387
Misses 62 62
Partials 483 483
Continue to review full report at Codecov.
|
As discussed let's not use the main executable, but define mains in each of the system CPU and system memory in order to launch each node individually. |
Signed-off-by: Prajakta Gokhale <prajaktg@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor changes, otherwise looks great.
system_metrics_collector/src/system_metrics_collector/linux_cpu_collector.cpp
Show resolved
Hide resolved
system_metrics_collector/src/system_metrics_collector/linux_memory_collector.cpp
Show resolved
Hide resolved
system_metrics_collector/src/system_metrics_collector/linux_cpu_collector.cpp
Outdated
Show resolved
Hide resolved
system_metrics_collector/src/system_metrics_collector/linux_cpu_collector.cpp
Outdated
Show resolved
Hide resolved
system_metrics_collector/src/system_metrics_collector/linux_memory_collector.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Prajakta Gokhale <prajaktg@amazon.com>
system_metrics_collector/src/system_metrics_collector/constants.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Prajakta Gokhale <prajaktg@amazon.com>
|
||
|
||
def generate_launch_description(): | ||
"""Run system CPU and memory collector nodes using launch.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I feel this is redundant given the toplevel docstring + the fact that all launch files have this function syntax. But we can keep it
system_metrics_collector/src/system_metrics_collector/linux_cpu_collector.cpp
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits, but LGTM
CodeCov Action is failing for reasons unrelated to this PR. The build failure is tracked in https://github.com/ros-security/aws-oncall/issues/48. |
Related to https://github.com/ros-security/aws-roadmap/issues/149.
Testing:
➜ ros2_ws git:(master) ✗ ros2 launch system_metrics_collector system_cpu_and_memory.launch.py [INFO] [launch]: All log files can be found below /home/ANT.AMAZON.COM/prajaktg/.ros/log/2020-01-08-13-04-27-713008-u50b388d95c3157.ant.amazon.com-8591 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [linux_cpu_collector-1]: process started with pid [8601] [INFO] [linux_memory_collector-2]: process started with pid [8602] [linux_cpu_collector-1] [ERROR] [ComputeCpuActivePercentage]: a measurement was empty, unable to compute cpu percentage [linux_memory_collector-2] [DEBUG] [linuxMemoryCollector]: PerformPeriodicMeasurement: 11.799179 [linux_memory_collector-2] [DEBUG] [linuxMemoryCollector]: name=linuxMemoryCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=11.799179, min=11.799179, max=11.799179, std_dev=0.000000, count=1 ... [linux_cpu_collector-1] [DEBUG] [linuxCpuCollector]: PerformPeriodicMeasurement: nan [linux_cpu_collector-1] [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=nan, min=nan, max=nan, std_dev=nan, count=0 [linux_cpu_collector-1] [DEBUG] [linuxCpuCollector]: PerformPeriodicMeasurement: 3.015075 [linux_cpu_collector-1] [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=3.015075, min=3.015075, max=3.015075, std_dev=0.000000, count=1 ... ^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) [main-1] [DEBUG] [linuxMemoryCollector]: name=linuxMemoryCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=11.976991, min=11.974837, max=11.978395, std_dev=0.001555, count=5 [main-1] [DEBUG] [linuxProcessMemoryCollector]: PerformPeriodicMeasurement: 0.002625 [main-1] [DEBUG] [linuxProcessMemoryCollector]: name=linuxProcessMemoryCollector, measurement_period=1000ms, publishing_topic=not_publishing_yet, publish_period=60000ms, started=true, avg=0.002585, min=0.002428, max=0.002625, std_dev=0.000079, count=5 [linux_memory_collector-2] [INFO] [rclcpp]: signal_handler(signal_value=2) [INFO] [linux_cpu_collector-1]: process has finished cleanly [pid 8601] [INFO] [linux_memory_collector-2]: process has finished cleanly [pid 8602] [linux_cpu_collector-1] [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=3.632821, min=2.538071, max=5.941846, std_dev=1.070607, count=14 [linux_cpu_collector-1] [DEBUG] [linuxCpuCollector]: PerformPeriodicMeasurement: 3.136763 [linux_cpu_collector-1] [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=3.599750, min=2.538071, max=5.941846, std_dev=1.041680, count=15 [linux_cpu_collector-1] [INFO] [rclcpp]: signal_handler(signal_value=2) ➜ ros2 run system_metrics_collector linux_cpu_collector [ERROR] [ComputeCpuActivePercentage]: a measurement was empty, unable to compute cpu percentage [DEBUG] [linuxCpuCollector]: PerformPeriodicMeasurement: nan [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=nan, min=nan, max=nan, std_dev=nan, count=0 [DEBUG] [linuxCpuCollector]: PerformPeriodicMeasurement: 2.339901 [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=2.339901, min=2.339901, max=2.339901, std_dev=0.000000, count=1 [DEBUG] [linuxCpuCollector]: PerformPeriodicMeasurement: 3.166870 [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=2.753386, min=2.339901, max=3.166870, std_dev=0.413484, count=2 [DEBUG] [linuxCpuCollector]: PerformPeriodicMeasurement: 2.910053 [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=2.805608, min=2.339901, max=3.166870, std_dev=0.345592, count=3 [DEBUG] [linuxCpuCollector]: PerformPeriodicMeasurement: 4.630788 [DEBUG] [linuxCpuCollector]: name=linuxCpuCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=3.261903, min=2.339901, max=4.630788, std_dev=0.845098, count=4 ^C[INFO] [rclcpp]: signal_handler(signal_value=2) ➜ ros2 run system_metrics_collector linux_memory_collector [DEBUG] [linuxMemoryCollector]: PerformPeriodicMeasurement: 11.750890 [DEBUG] [linuxMemoryCollector]: name=linuxMemoryCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=11.750890, min=11.750890, max=11.750890, std_dev=0.000000, count=1 [DEBUG] [linuxMemoryCollector]: PerformPeriodicMeasurement: 11.750890 [DEBUG] [linuxMemoryCollector]: name=linuxMemoryCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=11.750890, min=11.750890, max=11.750890, std_dev=0.000000, count=2 [DEBUG] [linuxMemoryCollector]: PerformPeriodicMeasurement: 11.751062 [DEBUG] [linuxMemoryCollector]: name=linuxMemoryCollector, measurement_period=1000ms, publishing_topic=system_metrics, publish_period=60000ms, started=true, avg=11.750948, min=11.750890, max=11.751062, std_dev=0.000081, count=3 ^C[INFO] [rclcpp]: signal_handler(signal_value=2)
Signed-off-by: Prajakta Gokhale prajaktg@amazon.com