acc311dd3e15135ca35f69b0183e5b0f9f4beadf,tools/nni_gpu_tool/gpu_metrics_collector.py,,check_ready_to_run,#,27
Before Change
def check_ready_to_run():
//TODO check process in windows
if sys.platform == "win32":
return True
pgrep_output =subprocess.check_output("pgrep -fx \"python3 -m nni_gpu_tool.gpu_metrics_collector\"", shell=True)
pidList = []
for pid in pgrep_output.splitlines():
pidList.append(int(pid))
After Change
from xml.dom import minidom
def check_ready_to_run():
if sys.platform == "win32":
pgrep_output = subprocess.check_output("wmic process where "CommandLine like \"%nni_gpu_tool.gpu_metrics_collector%\" and name like \"%python%\"" get processId")
pidList = pgrep_output.decode("utf-8").strip().split()
pidList.pop(0) // remove the key word "ProcessId"
pidList = list(map(int, pidList))
pidList.remove(os.getpid())
return len(pidList) == 0
else:
pgrep_output =subprocess.check_output("pgrep -fx \"python3 -m nni_gpu_tool.gpu_metrics_collector\"", shell=True)
pidList = []
for pid in pgrep_output.splitlines():
pidList.append(int(pid))
pidList.remove(os.getpid())
return len(pidList) == 0
def main(argv):
metrics_output_dir = os.environ["METRIC_OUTPUT_DIR"]
if check_ready_to_run() == False:
// GPU metrics collector is already running. Exit
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: microsoft/nni
Commit Name: acc311dd3e15135ca35f69b0183e5b0f9f4beadf
Time: 2019-04-27
Author: 15094695770@163.com
File Name: tools/nni_gpu_tool/gpu_metrics_collector.py
Class Name:
Method Name: check_ready_to_run
Project Name: deepmind/sonnet
Commit Name: a27371fc0adda5eb53ff5a29bf83d963f7e52096
Time: 2017-09-25
Author: noreply@google.com
File Name: sonnet/python/modules/gated_rnn.py
Class Name: BatchNormLSTM
Method Name: get_possible_initializer_keys
Project Name: asyml/texar
Commit Name: 9fa2ad17077e2c71e59ebfc239e6a44d3a7057f0
Time: 2017-10-02
Author: zhitinghu@gmail.com
File Name: txtgen/data/database.py
Class Name: MonoTextDataBase
Method Name: list_items