def resolve_task_cgroup_path(pid, controller):
 if (controller not in get_all_controllers()):
  raise error.TestError(("Doesn't support controller <%s>" % controller))
 root_path = get_cgroup_mountpoint(controller)
 proc_cgroup = ('/proc/%d/cgroup' % pid)
 if (not os.path.isfile(proc_cgroup)):
  raise NameError(('File %s does not exist\n Check whether cgroup                                     installed in the system' % proc_cgroup))
 try:
  proc_file = open(proc_cgroup, 'r')
  proc_cgroup_txt = proc_file.read()
 finally:
  proc_file.close()
 mount_path = re.findall((':\\S*,*%s,*\\S*:(\\S*)\\n' % controller), proc_cgroup_txt)
 return os.path.join(root_path, mount_path[0].strip('/'))

def resolve_task_cgroup_path ( pid , controller ) : if ( controller not in get_all_controllers ( ) ) : raise error . TestError ( ( "Doesn't support controller <%s>" % controller ) ) root_path = get_cgroup_mountpoint ( controller ) proc_cgroup = ( '/proc/%d/cgroup' % pid ) if ( not os . path . isfile ( proc_cgroup ) ) : raise NameError ( ( 'File %s does not exist\n Check whether cgroup                                     installed in the system' % proc_cgroup ) ) try : proc_file = open ( proc_cgroup , 'r' ) proc_cgroup_txt = proc_file . read ( ) finally : proc_file . close ( ) mount_path = re . findall ( ( ':\\S*,*%s,*\\S*:(\\S*)\\n' % controller ) , proc_cgroup_txt ) return os . path . join ( root_path , mount_path [ 0 ] . strip ( '/' ) )
resolving cgroup mount path of a particular task .