Skip to content

Commit

Permalink
action='extend'
Browse files Browse the repository at this point in the history
  • Loading branch information
roi-granulate committed Oct 14, 2024
1 parent eef45fd commit 2b7006d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gprofiler/gprofiler_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ def nonnegative_integer(value_str: str) -> int:

def integers_list(value_str: str) -> List[int]:
try:
pids = [int(pid) for pid in value_str.split(",")]
values = [int(value) for value in value_str.split(",")]
except ValueError:
raise configargparse.ArgumentTypeError(
"Integer list should be a single integer, or comma separated list of integers f.e. 13,452,2388"
)
return pids
return values


def integer_range(min_range: int, max_range: int) -> Callable[[str], int]:
Expand Down
6 changes: 4 additions & 2 deletions gprofiler/profilers/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from subprocess import CompletedProcess
from typing import Any, Dict, List, Match, Optional, cast

from gprofiler_types import integers_list
from granulate_utils.linux.elf import get_elf_id
from granulate_utils.linux.ns import get_process_nspid, run_in_ns
from granulate_utils.linux.process import (
Expand Down Expand Up @@ -345,8 +346,9 @@ def _should_skip_process(self, process: Process) -> bool:
ProfilerArgument(
name="--python-pyspy-processes",
dest="python_pyspy_processes",
nargs="+",
type=int,
action="extend",
default=[],
type=integers_list,
help="List of processes (by PID) to profile with py-spy."
" This option forces gProfiler to profile given processes with py-spy, even if"
" they are not recognized by gProfiler as Python processes."
Expand Down

0 comments on commit 2b7006d

Please sign in to comment.