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 datatrails-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["DATATRAILS_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 DataTrails instance, this is typically https://app.datatrails.ai
Example usage:
archivist_runner \
-u https://app.datatrails.ai \
--client-id <your-client-id> \
--client-secret <your-client-secret> \
functests/test_resources/richness_story.yaml
For further reading:
Example of runner code for an example of how to build your YAML file
Example of templated runner code for extending functionality with templating.
- Example of runner code
- Example of templated runner code
- Story Runner Components
- Generic Story Runner YAML
- Assets Count Story Runner YAML
- Assets Create Story Runner YAML
- Assets Create If not exists Story Runner YAML
- Assets List Story Runner YAML
- Assets Wait For Confirmed Story Runner YAML
- Compliance Compliant_at Story Runner YAML
- Compliance Policy Create Story Runner YAML
- Estate Info Story Runner YAML
- Events Count Story Runner YAML
- Events Create Story Runner YAML
- Events List Story Runner YAML
- Locations Count Story Runner YAML
- Locations Create Story Runner YAML
- Locations List Story Runner YAML
- Subjects Count Story Runner YAML
- Subjects Create Story Runner YAML
- Subjects Create From base64 Story Runner YAML
- Subjects Delete Story Runner YAML
- Subjects List Story Runner YAML
- Subjects Read Story Runner YAML
- Subjects Update Story Runner YAML
- Subjects Wait For Confirmation Story Runner YAML
- Story Runner Demos