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

Add nnictl foreground test #2200

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/config/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ testCases:
validator:
class: NnicliValidator

- name: foreground
configFile: test/config/examples/sklearn-regression.yml
launchCommand: python3 nni_test/nnitest/foreground.py --config $configFile --timeout 45
stopCommand:
experimentStatusCheck: False

# Experiment resume test part 1
- name: nnictl-resume-1
configFile: test/config/examples/sklearn-regression.yml
Expand Down
25 changes: 25 additions & 0 deletions test/nni_test/nnitest/foreground.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

import subprocess
import argparse
import time
import shlex
import signal

def test_foreground(args):
launch_command = 'nnictl create --config {} --foreground'.format(args.config)
print('nnictl foreground launch command: ', launch_command, flush=True)

proc = subprocess.Popen(shlex.split(launch_command))

time.sleep(args.timeout)
proc.send_signal(signal.SIGINT)

if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--config", type=str, required=True)
parser.add_argument("--timeout", type=int, default=45)
args = parser.parse_args()

test_foreground(args)