Prepare and clean up with hooks#

Use hooks to prepare the environment or clean up after each main test.

  • pre_test selects the preparation scenario.

  • post_test selects the cleanup scenario.

name = "nccl-test"

pre_test = "nccl_test_pre"
post_test = "nccl_test_post"

[[Tests]]
id = "Tests.1"
test_name = "nccl_test_all_reduce"
time_limit = "00:20:00"

CloudAI organizes hooks in a dedicated directory structure:

  • Hook directory: All hook configurations reside in conf/hook/

  • Hook test scenarios: Place pre-test hook and post-test hook scenario files in conf/hook/

  • Hook tests: Place individual tests referenced in hooks within conf/hook/test/

Execution order:

  1. Run the pre-test hook.

  2. Run the main test if preparation succeeds.

  3. Run the post-test hook if the prior steps succeed.

If preparation fails, CloudAI skips both the main test and its post-test hook.

name = "nccl_test_pre"

[[Tests]]
id = "Tests.1"
test_name = "nccl_test_all_reduce"
time_limit = "00:20:00"