Skip to content

Commit

Permalink
Batch of smaller fixes and update to version 1.12.1 (#114)
Browse files Browse the repository at this point in the history
* fix: fixed a bug with removing pids from internal list

* Add type annotations to userfacing outputs

* Allways run with threading to process can be interrupted with ctrl-c

* Update pixi toml file

* chore: Add changelog entry and update versions

* Update pixi action

* Update pixi lock file

* Black formatting
  • Loading branch information
melund authored Jul 2, 2024
1 parent a3e351b commit 8690bed
Show file tree
Hide file tree
Showing 7 changed files with 1,348 additions and 1,156 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: prefix-dev/setup-pixi@v0.7.0
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: docs
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
# run: |
# git checkout $(git describe --tags `git rev-list --tags --max-count=1`);

- uses: prefix-dev/setup-pixi@v0.7.0
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: docs
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: prefix-dev/setup-pixi@v0.7.0
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: test
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
Expand All @@ -49,7 +49,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: prefix-dev/setup-pixi@v0.7.0
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: test
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# AnyPyTools Change Log

## v1.12.1

**Fixed:**
* Fixed a crash when stopping simulations with ctrl-c. It should now shutdown more gracefully.
* Fixed a bug making it was hard to stop simulations which were not running in parrallel. Now
simulations are always started on separate threads, which makes it possible to stop them with ctrl-c.

**Added:**
* Added a some python annotations to the code base, which should provide better type hints in IDEs.



## v1.12.0

Expand Down
2 changes: 1 addition & 1 deletion anypytools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"NORMAL_PRIORITY_CLASS",
]

__version__ = "1.12.0"
__version__ = "1.12.1"


def print_versions():
Expand Down
9 changes: 5 additions & 4 deletions anypytools/abcutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def add(self, pid):

def remove(self, pid):
with _thread_lock:
self._pids.pop(pid, None)
self._pids.discard(pid)

def stop_all(self):
"""Clean up and shut down any running processes."""
Expand Down Expand Up @@ -914,12 +914,13 @@ def _worker(self, task, task_queue):
task.logfile = ""
task_queue.put(task)

def _schedule_processes(self, tasklist) -> Generator[_Task, None, None]:
def _schedule_processes(
self, tasklist: list[_Task]
) -> Generator[_Task, None, None]:
# Make a shallow copy of the task list,
# so we don't mess with the callers list.
tasklist = copy.copy(tasklist)
number_tasks = len(tasklist)
use_threading = number_tasks > 1 and self.num_processes > 1
use_threading = "ANPYTOOLS_DEBUG_NO_THREADING" not in os.environ
task_queue: Queue = Queue()
threads: List[Thread] = []
# run while there is still threads, tasks or stuff in the queue
Expand Down
2,469 changes: 1,324 additions & 1,145 deletions pixi.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ channels = ["conda-forge", "anybody" ]
platforms = ["win-64", "linux-64"]

[tasks]
test = {cmd = "pytest tests", depends-on = ["install"]}
develop = "pip install -e ."
install = "pip install ."

clean-build = "rm -rf build dist"
build = {cmd="python -m build . --sdist"}
pipy-upload = {cmd="twine upload dist/*"}
release = {cmd="", depends-on=["test", "clean-build", "build", "pipy-upload"]}

Expand Down Expand Up @@ -50,6 +48,9 @@ debugpy = ">=1.8.1,<1.9"
[feature.test.target.win-64.dependencies]
anybodycon = "*"

[feature.test.tasks]
test = {cmd = "pytest tests", depends-on = ["install"]}


[feature.docs.dependencies]
python = "3.11.*"
Expand Down

0 comments on commit 8690bed

Please sign in to comment.