Skip to content

Commit 47a5ffc

Browse files
Merge pull request #35 from InformaticsMatters/2.0
Align with latest 2.0
2 parents 8d05f15 + bca4f9c commit 47a5ffc

File tree

6 files changed

+54
-13
lines changed

6 files changed

+54
-13
lines changed

.devcontainer/devcontainer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "WorkflowEngine Python 3.13",
5+
"image": "mcr.microsoft.com/devcontainers/python:1-3.13-bullseye",
6+
"features": {
7+
"ghcr.io/devcontainers/features/git:1": {
8+
"ppa": true,
9+
"version": "os-provided"
10+
}
11+
},
12+
// We mount bash history in an attempt to preserver history
13+
// between container restarts
14+
// (see https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history)
15+
"mounts": [
16+
"source=projectname-bashhistory,target=/commandhistory,type=volume"
17+
],
18+
"customizations": {
19+
"vscode": {
20+
"extensions": [
21+
"codezombiech.gitignore",
22+
"donjayamanne.githistory",
23+
"donjayamanne.git-extension-pack",
24+
"eamodio.gitlens",
25+
"github.vscode-github-actions",
26+
"ms-kubernetes-tools.vscode-kubernetes-tools",
27+
"ms-python.vscode-pylance",
28+
"sourcery.sourcery",
29+
"streetsidesoftware.code-spell-checker",
30+
"trond-snekvik.simple-rst",
31+
"vivaxy.vscode-conventional-commits",
32+
"yzhang.markdown-all-in-one"
33+
]
34+
}
35+
},
36+
"postCreateCommand": {
37+
"Install Python requirements": "pip3 install --user -r requirements.txt",
38+
"Fix Volume Permissions": "sudo chown -R $(whoami): /commandhistory"
39+
},
40+
"forwardPorts": []
41+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ dist/
33
**/__pycache__/
44
**/*.pickle
55
tests/project-root/project-*/
6+
**/.DS_Store
67

78
# temp files
89
*~

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ The project's written in Python and uses `Poetry`_ for dependency and package
3838
management. We also use `pre-commit`_ to manage our pre-commit hooks, which
3939
rely on `black`_, `mypy`_, `pylint`_, amongst others.
4040

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

43-
poetry shell
44-
poetry install --with dev
43+
poetry install --with dev --sync
4544
pre-commit install -t commit-msg -t pre-commit
4645

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

5251
And then run the tests::
5352

54-
coverage run -m pytest
55-
coverage report
53+
poetry run coverage run -m pytest
54+
poetry run coverage report
5655

56+
.. _devcontainer: https://code.visualstudio.com/docs/devcontainers/containers
5757
.. _Poetry: https://python-poetry.org
5858
.. _pre-commit: https://pre-commit.com
5959
.. _black: https://github.com/psf/black

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
poetry == 1.8.5
2+
pre-commit == 4.2.0

tests/instance_launcher.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,24 @@ def launch(self, launch_parameters: LaunchParameters) -> LaunchResult:
7676

7777
os.makedirs(EXECUTION_DIRECTORY, exist_ok=True)
7878

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

91-
# Apply variables to the step's Job command.
86+
# Get the job defitnion.
87+
# This is expected to exist in the tests/job-definitions directory.
9288
job, _ = self._api_adapter.get_job(
9389
collection=launch_parameters.specification["collection"],
9490
job=launch_parameters.specification["job"],
9591
version="do-not-care",
9692
)
9793
assert job
9894

99-
# Now apply the variables to the command
95+
# Now apply the provided variables to the command.
96+
# The command may not need any, but we do the decoding anyway.
10097
decoded_command, status = job_decoder.decode(
10198
job["command"],
10299
launch_parameters.specification_variables,
File renamed without changes.

0 commit comments

Comments
 (0)