![Untitled](images/Data_Object.png) | Data objects can represent data placed to the process, data resulting from the process, data that needs to be collected |
| Data Storage |![Untitled](images/Data_Storage.png) | Data storage provides the ability to store or access data that is associated with a business model. If your process outputs any data, it will become necessary to store that data. |
| Group |
![Untitled](images/Group.png) | Groups organize tasks or processes that have significance in the overall process. |
| Annotation |
![Untitled](images/Annotation.png) | Annotations allow you to describe the business process and flow objects in more detail. |
diff --git a/docs/spiffworkflow/process_groups_and_models.md b/docs/spiffworkflow/process_groups_and_models.md
deleted file mode 100644
index e4ca97d1a..000000000
--- a/docs/spiffworkflow/process_groups_and_models.md
+++ /dev/null
@@ -1 +0,0 @@
-# Navigating Spiffworkflow
From 6ba2d23e0922c47c227d520765501d5ca33132df Mon Sep 17 00:00:00 2001
From: jasquat
Date: Mon, 26 Jun 2023 11:33:27 -0400
Subject: [PATCH 2/5] added build command for docs and created github action w/
burnettk
---
.github/workflows/docs.yml | 42 ++++++++++++++++++++++++++++++++++++++
docs/bin/build | 27 ++++++++++++++++++++++++
2 files changed, 69 insertions(+)
create mode 100644 .github/workflows/docs.yml
create mode 100755 docs/bin/build
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 000000000..461534450
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,42 @@
+name: Docs
+
+on:
+ - push
+ - pull_request
+
+defaults:
+ run:
+ working-directory: docs
+
+jobs:
+ build:
+ name: build-docs
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out the repository
+ uses: actions/checkout@v3.3.0
+
+ - name: Set up Python
+ uses: actions/setup-python@v4.6.1
+ with:
+ python-version: 3.11
+
+ - name: Upgrade pip
+ run: |
+ pip install --constraint=.github/workflows/constraints.txt pip
+ pip --version
+
+ - name: Upgrade pip in virtual environments
+ shell: python
+ run: |
+ import os
+ import pip
+
+ with open(os.environ["GITHUB_ENV"], mode="a") as io:
+ print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
+ - name: Pip Install
+ run: |
+ pip install -r requirements.txt
+ - name: Build
+ run: |
+ ./bin/build --ci
diff --git a/docs/bin/build b/docs/bin/build
new file mode 100755
index 000000000..c8fa07819
--- /dev/null
+++ b/docs/bin/build
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+function error_handler() {
+ >&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
+ exit "$2"
+}
+trap 'error_handler ${LINENO} $?' ERR
+set -o errtrace -o errexit -o nounset -o pipefail
+
+run_ci="false"
+if grep -qE -- "--ci\>" <<<"$@" ; then
+ run_ci="true"
+fi
+
+rm -rf _build/html
+
+sphinx_command="sphinx-autobuild"
+if [[ "$run_ci" == "true" ]]; then
+ sphinx_command="sphinx-build"
+fi
+
+#>> sphinx-build --help 2>&1 | grep -E '^ +\-[aWn]\>'
+# -a write all files (default: only write new and changed
+# -j N build in parallel with N processes where possible
+# -n nit-picky mode, warn about all missing references
+# -W turn warnings into errors
+"$sphinx_command" . _build/html -W -a -n -j auto
From e9fdb9b0e93f063ca10aef7a8117de1357824ad9 Mon Sep 17 00:00:00 2001
From: jasquat
Date: Mon, 26 Jun 2023 11:36:20 -0400
Subject: [PATCH 3/5] remove unnecessary pip upgrade for docs w/ burnettk
---
.github/workflows/docs.yml | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 461534450..7b6ddb9df 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -20,20 +20,6 @@ jobs:
uses: actions/setup-python@v4.6.1
with:
python-version: 3.11
-
- - name: Upgrade pip
- run: |
- pip install --constraint=.github/workflows/constraints.txt pip
- pip --version
-
- - name: Upgrade pip in virtual environments
- shell: python
- run: |
- import os
- import pip
-
- with open(os.environ["GITHUB_ENV"], mode="a") as io:
- print(f"VIRTUALENV_PIP={pip.__version__}", file=io)
- name: Pip Install
run: |
pip install -r requirements.txt
From 9cf9bb6bf0537883762d95f650e03de647f165fc Mon Sep 17 00:00:00 2001
From: jasquat
Date: Mon, 26 Jun 2023 11:38:45 -0400
Subject: [PATCH 4/5] notify slack if build docs failed w/ burnettk
---
.github/workflows/docs.yml | 2 +-
.github/workflows/slack_notify.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 7b6ddb9df..8dc896221 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -1,4 +1,4 @@
-name: Docs
+name: Build Docs
on:
- push
diff --git a/.github/workflows/slack_notify.yml b/.github/workflows/slack_notify.yml
index f3c640752..886f968ad 100644
--- a/.github/workflows/slack_notify.yml
+++ b/.github/workflows/slack_notify.yml
@@ -2,7 +2,7 @@ name: Slack Notification
on:
workflow_run:
- workflows: ["Backend Tests", "Frontend Tests", "Docker Image For Main Builds", "Release Builds"]
+ workflows: ["Backend Tests", "Frontend Tests", "Docker Image For Main Builds", "Release Builds", "Build Docs"]
types: [completed]
jobs:
From b13b716424ecd310d074c842db77a6fa1930fcfa Mon Sep 17 00:00:00 2001
From: Kevin Burnett <18027+burnettk@users.noreply.github.com>
Date: Mon, 26 Jun 2023 10:07:41 -0700
Subject: [PATCH 5/5] parallel tests with xdist (#335)
* parallel tests with xdist
* add pytest-xdist as dev dep
* put back spiff
* update messaging
* get more in line with main
---------
Co-authored-by: burnettk
Co-authored-by: jasquat
---
spiffworkflow-backend/bin/recreate_db | 7 ++++
spiffworkflow-backend/bin/tests-par | 21 ++++++++++
spiffworkflow-backend/poetry.lock | 38 ++++++++++++++++++-
spiffworkflow-backend/pyproject.toml | 1 +
.../spiffworkflow_backend/config/__init__.py | 7 +++-
.../config/unit_testing.py | 6 ++-
6 files changed, 77 insertions(+), 3 deletions(-)
create mode 100755 spiffworkflow-backend/bin/tests-par
diff --git a/spiffworkflow-backend/bin/recreate_db b/spiffworkflow-backend/bin/recreate_db
index 13a3bede6..4535d6f48 100755
--- a/spiffworkflow-backend/bin/recreate_db
+++ b/spiffworkflow-backend/bin/recreate_db
@@ -94,3 +94,10 @@ if [[ -n "${SPIFFWORKFLOW_BACKEND_ENV:-}" ]] && ! grep -Eq '^(local_development|
fi
FLASK_APP=src/spiffworkflow_backend poetry run flask db upgrade
fi
+
+# for ./bin/tests-par (parallel tests with xdist)
+if [[ -f "./src/instance/db_unit_testing.sqlite3" ]] ; then
+ for i in $(seq 0 16); do
+ cp ./src/instance/db_unit_testing.sqlite3 ./src/instance/db_unit_testing_gw$i.sqlite3
+ done
+fi
diff --git a/spiffworkflow-backend/bin/tests-par b/spiffworkflow-backend/bin/tests-par
new file mode 100755
index 000000000..f8b4de274
--- /dev/null
+++ b/spiffworkflow-backend/bin/tests-par
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+function error_handler() {
+ >&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
+ exit "$2"
+}
+trap 'error_handler ${LINENO} $?' ERR
+set -o errtrace -o errexit -o nounset -o pipefail
+
+if [[ ! -f ./src/instance/db_unit_testing_gw0.sqlite3 ]] ; then
+ >&2 echo -e "ERROR: please run the following command first in order to set up and migrate the sqlite unit_testing database:\n\n\tSPIFFWORKFLOW_BACKEND_DATABASE_TYPE=sqlite ./bin/recreate_db clean"
+ exit 1
+fi
+
+# check if python package pytest-xdist is installed
+if ! python -c "import xdist" &>/dev/null; then
+ >&2 echo -e "ERROR: please install the python package pytest-xdist by running poetry install"
+ exit 1
+fi
+
+SPIFFWORKFLOW_BACKEND_DATABASE_TYPE=sqlite poet test -n auto -x --ff
diff --git a/spiffworkflow-backend/poetry.lock b/spiffworkflow-backend/poetry.lock
index d16ae8f02..34e178c20 100644
--- a/spiffworkflow-backend/poetry.lock
+++ b/spiffworkflow-backend/poetry.lock
@@ -643,6 +643,21 @@ files = [
[package.extras]
test = ["pytest (>=6)"]
+[[package]]
+name = "execnet"
+version = "1.9.0"
+description = "execnet: rapid multi-Python deployment"
+category = "main"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+files = [
+ {file = "execnet-1.9.0-py2.py3-none-any.whl", hash = "sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142"},
+ {file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"},
+]
+
+[package.extras]
+testing = ["pre-commit"]
+
[[package]]
name = "filelock"
version = "3.11.0"
@@ -1852,6 +1867,27 @@ pytest = ">=5.0"
[package.extras]
dev = ["pre-commit", "pytest-asyncio", "tox"]
+[[package]]
+name = "pytest-xdist"
+version = "3.3.1"
+description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs"
+category = "main"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "pytest-xdist-3.3.1.tar.gz", hash = "sha256:d5ee0520eb1b7bcca50a60a518ab7a7707992812c578198f8b44fdfac78e8c93"},
+ {file = "pytest_xdist-3.3.1-py3-none-any.whl", hash = "sha256:ff9daa7793569e6a68544850fd3927cd257cc03a7ef76c95e86915355e82b5f2"},
+]
+
+[package.dependencies]
+execnet = ">=1.1"
+pytest = ">=6.2.0"
+
+[package.extras]
+psutil = ["psutil (>=3.0)"]
+setproctitle = ["setproctitle"]
+testing = ["filelock"]
+
[[package]]
name = "python-dateutil"
version = "2.8.2"
@@ -2839,4 +2875,4 @@ tests-strict = ["codecov (==2.0.15)", "pytest (==4.6.0)", "pytest (==4.6.0)", "p
[metadata]
lock-version = "2.0"
python-versions = ">=3.10,<3.12"
-content-hash = "67863394f8de94eaddd20964ae383c6dc3416bbdec623e399b5a8a0d163e5178"
+content-hash = "de301503903ea357212400d7cf27feffe5a73b2733c0b4f2c39cabf3de3b9bc7"
diff --git a/spiffworkflow-backend/pyproject.toml b/spiffworkflow-backend/pyproject.toml
index 341249752..5994128af 100644
--- a/spiffworkflow-backend/pyproject.toml
+++ b/spiffworkflow-backend/pyproject.toml
@@ -82,6 +82,7 @@ prometheus-flask-exporter = "^0.22.3"
sqlalchemy = "^2.0.7"
marshmallow-sqlalchemy = "^0.29.0"
spiff-element-units = "^0.3.0"
+pytest-xdist = "^3.3.1"
[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py
index 08489df27..f8aac7977 100644
--- a/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py
+++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py
@@ -18,11 +18,16 @@ class ConfigurationError(Exception):
def setup_database_configs(app: Flask) -> None:
+ worker_id = os.environ.get("PYTEST_XDIST_WORKER")
+ parallel_test_suffix = ""
+ if worker_id is not None:
+ parallel_test_suffix = f"_{worker_id}"
+
if app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_URI") is None:
database_name = f"spiffworkflow_backend_{app.config['ENV_IDENTIFIER']}"
if app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_TYPE") == "sqlite":
app.config["SQLALCHEMY_DATABASE_URI"] = (
- f"sqlite:///{app.instance_path}/db_{app.config['ENV_IDENTIFIER']}.sqlite3"
+ f"sqlite:///{app.instance_path}/db_{app.config['ENV_IDENTIFIER']}{parallel_test_suffix}.sqlite3"
)
elif app.config.get("SPIFFWORKFLOW_BACKEND_DATABASE_TYPE") == "postgres":
app.config["SQLALCHEMY_DATABASE_URI"] = (
diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/unit_testing.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/unit_testing.py
index 92997dd1c..f6711f420 100644
--- a/spiffworkflow-backend/src/spiffworkflow_backend/config/unit_testing.py
+++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/unit_testing.py
@@ -15,6 +15,10 @@ SPIFFWORKFLOW_BACKEND_GIT_COMMIT_ON_SAVE = False
# NOTE: set this here since nox shoves tests and src code to
# different places and this allows us to know exactly where we are at the start
+worker_id = environ.get("PYTEST_XDIST_WORKER")
+parallel_test_suffix = ""
+if worker_id is not None:
+ parallel_test_suffix = f"_{worker_id}"
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR = os.path.join(
os.path.dirname(__file__),
"..",
@@ -23,5 +27,5 @@ SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR = os.path.join(
"tests",
"spiffworkflow_backend",
"files",
- "bpmn_specs",
+ f"bpmn_specs{parallel_test_suffix}",
)