"git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "3f934d495a43ac8034385ad959c0d62a266f7233"
Commit acc311dd authored by demianzhang's avatar demianzhang Committed by chicm-ms
Browse files

Update check_ready_to_run in windows local mode (#1025)

* Update mnist-hyperband.test.yml

* Fix system node

* Fix pgrep in windows
parent 26003953
...@@ -25,15 +25,20 @@ import time ...@@ -25,15 +25,20 @@ import time
from xml.dom import minidom from xml.dom import minidom
def check_ready_to_run(): def check_ready_to_run():
#TODO check process in windows
if sys.platform == 'win32': if sys.platform == 'win32':
return True pgrep_output = subprocess.check_output('wmic process where "CommandLine like \'%nni_gpu_tool.gpu_metrics_collector%\' and name like \'%python%\'" get processId')
pgrep_output =subprocess.check_output('pgrep -fx \'python3 -m nni_gpu_tool.gpu_metrics_collector\'', shell=True) pidList = pgrep_output.decode("utf-8").strip().split()
pidList = [] pidList.pop(0) # remove the key word 'ProcessId'
for pid in pgrep_output.splitlines(): pidList = list(map(int, pidList))
pidList.append(int(pid)) pidList.remove(os.getpid())
pidList.remove(os.getpid()) return len(pidList) == 0
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): def main(argv):
metrics_output_dir = os.environ['METRIC_OUTPUT_DIR'] metrics_output_dir = os.environ['METRIC_OUTPUT_DIR']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment