Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Add launch file to launch system CPU and Memory collector nodes #63

Merged
merged 4 commits into from Jan 11, 2020

Conversation

prajakta-gokhale
Copy link
Member

@prajakta-gokhale prajakta-gokhale commented Jan 8, 2020

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

Signed-off-by: Prajakta Gokhale <prajaktg@amazon.com>
@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #63 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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
Flag Coverage Δ
#unittests 41.52% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b87de22...69f351a. Read the comment docs.

@dabonnie
Copy link
Contributor

dabonnie commented Jan 8, 2020

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>
Copy link
Contributor

@dabonnie dabonnie left a 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.

Signed-off-by: Prajakta Gokhale <prajaktg@amazon.com>
Signed-off-by: Prajakta Gokhale <prajaktg@amazon.com>


def generate_launch_description():
"""Run system CPU and memory collector nodes using launch."""
Copy link
Contributor

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

Copy link
Contributor

@piraka9011 piraka9011 left a 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

@prajakta-gokhale
Copy link
Member Author

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.

@prajakta-gokhale prajakta-gokhale merged commit e077cd1 into master Jan 11, 2020
@prajakta-gokhale prajakta-gokhale deleted the prajaktg/add-launch branch January 11, 2020 01:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants