Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Update check_ready_to_run in windows local mode (#1025)
Browse files Browse the repository at this point in the history
* Update mnist-hyperband.test.yml

* Fix system node

* Fix pgrep in windows
  • Loading branch information
demianzhang authored and chicm-ms committed Apr 28, 2019
1 parent 2600395 commit acc311d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tools/nni_gpu_tool/gpu_metrics_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@
from xml.dom import minidom

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))
pidList.remove(os.getpid())
return len(pidList) == 0
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']
Expand Down

0 comments on commit acc311d

Please sign in to comment.