:py:mod:`buildtest.tools.tutorialexamples` ========================================== .. py:module:: buildtest.tools.tutorialexamples Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: buildtest.tools.tutorialexamples.generate_tutorial_examples buildtest.tools.tutorialexamples.run buildtest.tools.tutorialexamples.write_example buildtest.tools.tutorialexamples.build_aws_examples buildtest.tools.tutorialexamples.build_spack_examples buildtest.tools.tutorialexamples.execute_commands .. py:function:: generate_tutorial_examples(examples, dryrun=None, write=None, failfast=None) This method is the entry point for "buildtest tutorial-examples" command which generates documentation examples for Buildtest Tutorial. :param examples: The type of examples to generate. This can be either 'spack' or 'aws' :type examples: str :param dryrun: If set to True, we will perform a dryrun. Default is None. :type dryrun: bool, optional :param write: If set to True, we will write output to file. Default is None. :type write: bool, optional :param failfast: If set to True, we will exit on first failure. Default is None. :type failfast: bool, optional .. py:function:: run(query) This method will execute command for the tutorials examples. If returncode is non-zero we raise exception otherwise we return output of command. :param query: Run a arbitrary shell command. :type query: str .. py:function:: write_example(fname, command, content) 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. :param fname: Path to file where output of command will be written :type fname: str :param command: Command that was executed :type command: str :param content: Content to write to file :type content: str .. py:function:: build_aws_examples(build_dir, settings_file, dryrun=None, write=None, failfast=None) This method will build AWS examples for the tutorial :param build_dir: Directory where auto generated documentation examples will be written. :type build_dir: str :param settings_file: Path to settings file :type settings_file: str :param dryrun: If True we print commands to run and return. If False we execute commands. Defaults to None. :type dryrun: bool, optional :param write: If True we write output to file. Defaults to None. :type write: bool, optional :param failfast: If True we exit on first failure. Defaults to None. :type failfast: bool, optional .. py:function:: build_spack_examples(autogen_dir, settings_file, dryrun=None, write=None, failfast=None) This method will build spack examples for the tutorial :param autogen_dir: Directory where auto generated documentation examples will be written. :type autogen_dir: str :param settings_file: Path to settings file :type settings_file: str :param dryrun: If True we print commands to run and return. If False we execute commands. Defaults to None. :type dryrun: bool, optional :param write: If True we write output to file. Defaults to None. :type write: bool, optional :param failfast: If True we exit on first failure. Defaults to None. :type failfast: bool, optional .. py:function:: execute_commands(commands_to_run, dryrun=None, write=None, failfast=None) This method will execute a list of commands and handle the results. :param commands_to_run: A dictionary where keys are file names and values are commands to be executed. :type commands_to_run: dict :param dryrun: If True we print commands to run and return. If False we execute commands. Defaults to None. :type dryrun: bool, optional :param write: If True we write output to file. Defaults to None. :type write: bool, optional :param failfast: If True we exit on first failure. Defaults to None. :type failfast: bool, optional