Mercurial > repos > pieterlukasse > nist_wrapper
comparison utils.py @ 19:a394029414c6
fix
author | pieter.lukasse@wur.nl |
---|---|
date | Fri, 23 Jan 2015 17:42:19 +0100 |
parents | c21e96bb68c8 |
children |
comparison
equal
deleted
inserted
replaced
18:dae90b9abf61 | 19:a394029414c6 |
---|---|
42 for line in get_process_list(): | 42 for line in get_process_list(): |
43 if process_name in line: | 43 if process_name in line: |
44 pid = int(line.split(None, 1)[0]) | 44 pid = int(line.split(None, 1)[0]) |
45 return pid | 45 return pid |
46 | 46 |
47 def kill_process_by_name(process_name): | |
48 pid = -1 | |
49 for line in get_process_list(): | |
50 if process_name in line: | |
51 pid = int(line.split(None, 1)[0]) | |
52 os.kill(pid, 9) | |
53 | |
47 | 54 |
48 def get_as_dict(in_tsv): | 55 def get_as_dict(in_tsv): |
49 ''' | 56 ''' |
50 Generic method to parse a tab-separated file returning a dictionary with named columns | 57 Generic method to parse a tab-separated file returning a dictionary with named columns |
51 @param in_tsv: input filename to be parsed | 58 @param in_tsv: input filename to be parsed |