Skip to content

Commit

Permalink
List only affected instances in parametrized helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Dec 18, 2014
1 parent 650369a commit 78c03a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion tracer/resources/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def helpers(self):
if not self.helper_contains_formating:
helpers.append(self.helper)
else:
for process in self.instances:
for process in self.affected_instances:
helpers.append(self.helper.format(
NAME=self.name,
PNAME=process.name,
Expand All @@ -217,3 +217,9 @@ def helpers(self):
@property
def instances(self):
return Processes.all().filtered(lambda process: process.name == self.name)

@property
def affected_instances(self):
# @TODO Fix circular dependency and move it up
from tracer.resources.tracer import Tracer
return Tracer().trace_application(self.name)
2 changes: 1 addition & 1 deletion tracer/resources/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def all():
class Process(psutil.Process):
def __eq__(self, process):
"""For our purposes, two processes are equal when they have same name"""
return self.name == process.name
return self.pid == process.pid

def __ne__(self, process):
return not self.__eq__(process)
Expand Down

0 comments on commit 78c03a2

Please sign in to comment.