Story Runner

A runner attribute of the archivist instance allows running scenarios from a dictionary. Usually the dictionary is read from a yaml or json file.

# pylint:  disable=missing-docstring

from logging import getLogger
from os import environ
from sys import exit as sys_exit
from warnings import filterwarnings

from pyaml_env import parse_config

from archivist import about
from archivist.archivist import Archivist

filterwarnings("ignore", message="Unverified HTTPS request")


LOGGER = getLogger(__name__)


def run(arch: Archivist, args):

    LOGGER.info("Using version %s of rkvst-archivist", about.__version__)
    LOGGER.info("Namespace %s", args.namespace)

    # if namespace is specified on the commandline then override any environment
    # setting...
    if args.namespace:
        environ["RKVST_UNIQUE_ID"] = args.namespace

    with open(args.yamlfile, "r", encoding="utf-8") as y:
        arch.runner(parse_config(data=y))

    sys_exit(0)

This functionality is also available with the CLI tool archivist_runner.

See the installation instructions for more information.

You can verify the installation by running the following:

archivist_runner -h

Which will show you the available options when using archivist_runner.

To use the archivist_runner command you will need the following:

  • A Client ID and Client Secret by creating an App Registration

  • The YAML file with the operations you wish to run

  • The URL of your RKVST instance, this is typically https://app.rkvst.io

Example usage:

archivist_runner \
      -u https://app.rkvst.io \
      --client-id <your-client-id> \
      --client-secret <your-client-secret> \
      functests/test_resources/richness_story.yaml

For further reading: