buildtest.tools.tutorialexamples

Module Contents

Functions

generate_tutorial_examples(examples[, dryrun, write, ...])

This method is the entry point for "buildtest tutorial-examples" command which generates

run(query)

This method will execute command for the tutorials examples. If returncode

write_example(fname, command, content)

Given a shell command, we will write output to file. We will print first

build_aws_examples(build_dir, settings_file[, dryrun, ...])

This method will build AWS examples for the tutorial

build_spack_examples(autogen_dir, settings_file[, ...])

This method will build spack examples for the tutorial

execute_commands(commands_to_run[, dryrun, write, ...])

This method will execute a list of commands and handle the results.

buildtest.tools.tutorialexamples.generate_tutorial_examples(examples, dryrun=None, write=None, failfast=None)[source]

This method is the entry point for “buildtest tutorial-examples” command which generates documentation examples for Buildtest Tutorial.

Parameters:
  • examples (str) – The type of examples to generate. This can be either ‘spack’ or ‘aws’

  • dryrun (bool, optional) – If set to True, we will perform a dryrun. Default is None.

  • write (bool, optional) – If set to True, we will write output to file. Default is None.

  • failfast (bool, optional) – If set to True, we will exit on first failure. Default is None.

buildtest.tools.tutorialexamples.run(query)[source]

This method will execute command for the tutorials examples. If returncode is non-zero we raise exception otherwise we return output of command.

Parameters:

query (str) – Run a arbitrary shell command.

buildtest.tools.tutorialexamples.write_example(fname, command, content)[source]

Given a shell command, we will write output to file. We will print first 10 lines from upon writing file to ensure file was written properly.

Parameters:
  • fname (str) – Path to file where output of command will be written

  • command (str) – Command that was executed

  • content (str) – Content to write to file

buildtest.tools.tutorialexamples.build_aws_examples(build_dir, settings_file, dryrun=None, write=None, failfast=None)[source]

This method will build AWS examples for the tutorial

Parameters:
  • build_dir (str) – Directory where auto generated documentation examples will be written.

  • settings_file (str) – Path to settings file

  • dryrun (bool, optional) – If True we print commands to run and return. If False we execute commands. Defaults to None.

  • write (bool, optional) – If True we write output to file. Defaults to None.

  • failfast (bool, optional) – If True we exit on first failure. Defaults to None.

buildtest.tools.tutorialexamples.build_spack_examples(autogen_dir, settings_file, dryrun=None, write=None, failfast=None)[source]

This method will build spack examples for the tutorial

Parameters:
  • autogen_dir (str) – Directory where auto generated documentation examples will be written.

  • settings_file (str) – Path to settings file

  • dryrun (bool, optional) – If True we print commands to run and return. If False we execute commands. Defaults to None.

  • write (bool, optional) – If True we write output to file. Defaults to None.

  • failfast (bool, optional) – If True we exit on first failure. Defaults to None.

buildtest.tools.tutorialexamples.execute_commands(commands_to_run, dryrun=None, write=None, failfast=None)[source]

This method will execute a list of commands and handle the results.

Parameters:
  • commands_to_run (dict) – A dictionary where keys are file names and values are commands to be executed.

  • dryrun (bool, optional) – If True we print commands to run and return. If False we execute commands. Defaults to None.

  • write (bool, optional) – If True we write output to file. Defaults to None.

  • failfast (bool, optional) – If True we exit on first failure. Defaults to None.