diff --git a/test/config/integration_tests.yml b/test/config/integration_tests.yml index 171b06d766..b8f681ecd2 100644 --- a/test/config/integration_tests.yml +++ b/test/config/integration_tests.yml @@ -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 diff --git a/test/nni_test/nnitest/foreground.py b/test/nni_test/nnitest/foreground.py new file mode 100644 index 0000000000..4bfe6c173b --- /dev/null +++ b/test/nni_test/nnitest/foreground.py @@ -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)