Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "WorkflowEngine Python 3.13",
"image": "mcr.microsoft.com/devcontainers/python:1-3.13-bullseye",
"features": {
"ghcr.io/devcontainers/features/git:1": {
"ppa": true,
"version": "os-provided"
}
},
// We mount bash history in an attempt to preserver history
// between container restarts
// (see https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history)
"mounts": [
"source=projectname-bashhistory,target=/commandhistory,type=volume"
],
"customizations": {
"vscode": {
"extensions": [
"codezombiech.gitignore",
"donjayamanne.githistory",
"donjayamanne.git-extension-pack",
"eamodio.gitlens",
"github.vscode-github-actions",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ms-python.vscode-pylance",
"sourcery.sourcery",
"streetsidesoftware.code-spell-checker",
"trond-snekvik.simple-rst",
"vivaxy.vscode-conventional-commits",
"yzhang.markdown-all-in-one"
]
}
},
"postCreateCommand": {
"Install Python requirements": "pip3 install --user -r requirements.txt",
"Fix Volume Permissions": "sudo chown -R $(whoami): /commandhistory"
},
"forwardPorts": []
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dist/
**/__pycache__/
**/*.pickle
tests/project-root/project-*/
**/.DS_Store

# temp files
*~
Expand Down
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ The project's written in Python and uses `Poetry`_ for dependency and package
management. We also use `pre-commit`_ to manage our pre-commit hooks, which
rely on `black`_, `mypy`_, `pylint`_, amongst others.

Create your environment::
From within a VS Code `devcontainer`_] environment (recommended)::

poetry shell
poetry install --with dev
poetry install --with dev --sync
pre-commit install -t commit-msg -t pre-commit

And then start by running the pre-commit hooks to ensure you're stating with a
Expand All @@ -51,9 +50,10 @@ _clean_ project::

And then run the tests::

coverage run -m pytest
coverage report
poetry run coverage run -m pytest
poetry run coverage report

.. _devcontainer: https://code.visualstudio.com/docs/devcontainers/containers
.. _Poetry: https://python-poetry.org
.. _pre-commit: https://pre-commit.com
.. _black: https://github.com/psf/black
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
poetry == 1.8.5
pre-commit == 4.2.0
13 changes: 5 additions & 8 deletions tests/instance_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,24 @@ def launch(self, launch_parameters: LaunchParameters) -> LaunchResult:

os.makedirs(EXECUTION_DIRECTORY, exist_ok=True)

# We're passed a RunningWorkflowStep ID but a record is expected to have been
# created bt the caller, we simply create instance records.
response, _ = self._api_adapter.get_running_workflow_step(
running_workflow_step_id=launch_parameters.running_workflow_step_id
)
# Now simulate the creation of a Task and Instance record
# Create an Instance record (and dummy Task ID)
response = self._api_adapter.create_instance(
running_workflow_step_id=launch_parameters.running_workflow_step_id
)
instance_id = response["id"]
task_id = "task-00000000-0000-0000-0000-000000000001"

# Apply variables to the step's Job command.
# Get the job defitnion.
# This is expected to exist in the tests/job-definitions directory.
job, _ = self._api_adapter.get_job(
collection=launch_parameters.specification["collection"],
job=launch_parameters.specification["job"],
version="do-not-care",
)
assert job

# Now apply the variables to the command
# Now apply the provided variables to the command.
# The command may not need any, but we do the decoding anyway.
decoded_command, status = job_decoder.decode(
job["command"],
launch_parameters.specification_variables,
Expand Down
File renamed without changes.