Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Donald Mellenbruch authored and Donald Mellenbruch committed Aug 4, 2023
2 parents 0fba9b2 + 7319ae0 commit 1b11ac5
Show file tree
Hide file tree
Showing 11 changed files with 229 additions and 112 deletions.
6 changes: 3 additions & 3 deletions .bumpversion.cfg
@@ -1,12 +1,12 @@
[bumpversion]
current_version = 0.3.0
current_version = 0.4.0
commit = False
message = bump: {current_version} --> {new_version}
tag = False
tag_name = {current_version}
tag_message =
tag_message =
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<rc_kind>[A-Za-z]*)(?P<rc>\d*)
serialize =
serialize =
{major}.{minor}.{patch}{rc_kind}{rc}
{major}.{minor}.{patch}

Expand Down
2 changes: 1 addition & 1 deletion .copier-answers.yml
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: a01a11e
_commit: b7e79bf
_src_path: https://codeberg.org/Fresh2dev/copier-f2dv-project.git
author_email: hello@f2dv.com
author_name: Donald Mellenbruch
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
@@ -1,6 +1,16 @@
# Changelog

## 0.3.0
## 0.4.0 - 2023-08-04

### :point_right: Changes

- *Breaking:* Default engine changed from `threading.Thread` to `mp.Process` [a3dc1af]

### :metal: Other

- Correct annotations and docstrings [7a2470a]

## 0.3.0 - 2023-06-22

- rename from `ezpq` to `ppqueue`
- replaced `queue.get` with `queue.dequeue` / `queue.pop`
Expand Down
1 change: 1 addition & 0 deletions README.pypi.md
@@ -0,0 +1 @@
[https://www.f2dv.com/r/ppqueue](https://www.f2dv.com/r/ppqueue)
2 changes: 1 addition & 1 deletion config/overrides/main.html
Expand Up @@ -8,7 +8,7 @@

{% block fonts %}
<style>
@import url("https://www.fresh2.dev/assets/css/fonts.css");
@import url("https://www.fresh2.dev/css/fonts.css");

:root {
--md-text-font: iAWriterQuattroS, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, roboto, noto, arial, sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -8,7 +8,7 @@ authors = [
{name = "Donald Mellenbruch", email = "hello@f2dv.com"},
]
description = "A Parallel Process Queue for Python."
readme = "README.md"
readme = "README.pypi.md"
license = {file = "LICENSE"}
requires-python = ">=3.8"
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion src/ppqueue/__version__.py
@@ -1 +1 @@
__version__ = "0.3.0"
__version__ = "0.4.0"
46 changes: 37 additions & 9 deletions src/ppqueue/job.py
Expand Up @@ -68,16 +68,16 @@ def __post_init__(self) -> None:
if self.kwargs is None:
self.kwargs = {}

def _compare(self, job: object) -> int:
def _compare(self, job: Job) -> int:
"""compares two jobs by priority or index.
Arguments:
job {ppqueue.Job}
job: ...
Returns:
int -- `1` if `self` is greater than comparison,
`-1` if `self` is less than,
`0` if equal.
`1` if `self` is greater than comparison,
`-1` if `self` is less than,
`0` if equal.
"""
return compare_by(self, job, by=["priority", "idx"])

Expand Down Expand Up @@ -117,7 +117,11 @@ def join(self, *args, **kwargs) -> None:
self.inner_job.join(*args, **kwargs)

def get_exit_code(self) -> int | None:
"""Exit code of the job."""
"""Exit code of the job.
Returns:
...
"""
if (
not self.inner_job
or not hasattr(self.inner_job, "exitcode")
Expand Down Expand Up @@ -146,6 +150,9 @@ def stop(self) -> None:
def get_seconds_running(self) -> float | None:
"""The number of seconds a job was running for.
Returns:
...
Examples:
>>> from ppqueue import Queue
>>> from time import sleep
Expand All @@ -164,6 +171,9 @@ def get_seconds_running(self) -> float | None:
def get_seconds_waiting(self) -> float | None:
"""The amount of time a data has spent in the waiting queue.
Returns:
...
Examples:
>>> job.get_seconds_waiting() # doctest: +SKIP
"""
Expand All @@ -178,6 +188,9 @@ def get_seconds_waiting(self) -> float | None:
def get_seconds_total(self) -> float | None:
"""Returns the waiting + running duration of this job.
Returns:
...
Examples:
>>> job.get_seconds_total() # doctest: +SKIP
"""
Expand All @@ -192,6 +205,9 @@ def get_seconds_total(self) -> float | None:
def get_submit_timestamp(self) -> datetime | None:
"""The time this job was submitted.
Returns:
...
Examples:
>>> job.get_submit_timestamp() # doctest: +SKIP
"""
Expand All @@ -200,19 +216,31 @@ def get_submit_timestamp(self) -> datetime | None:
return None

def get_start_timestamp(self) -> datetime | None:
"""Returns a datetime object of the time this data was started."""
"""Returns a datetime object of the time this data was started.
Returns:
...
"""
if self.start_timestamp:
return datetime.utcfromtimestamp(self.start_timestamp)
return None

def get_finish_timestamp(self) -> datetime | None:
"""Returns a datetime object of the time this data finished."""
"""Returns a datetime object of the time this data finished.
Returns:
...
"""
if self.finish_timestamp:
return datetime.utcfromtimestamp(self.finish_timestamp)
return None

def get_processed_timestamp(self) -> datetime | None:
"""Returns a datetime object of the time this data was processed."""
"""Returns a datetime object of the time this data was processed.
Returns:
...
"""
if self.process_timestamp:
return datetime.utcfromtimestamp(self.process_timestamp)
return None
Expand Down
18 changes: 11 additions & 7 deletions src/ppqueue/plot.py
Expand Up @@ -222,15 +222,19 @@ def plot_jobs(
"""
Args:
title:
color_by:
facet_by:
facet_scale:
theme:
no_legend:
bar_width:
*args: Sequences of `Job` instances to plot.
title: ...
color_by: ...
facet_by: ...
facet_scale: ...
theme: ...
no_legend: ...
bar_width: ...
color_pal: a sequence of colors used to color each group of `color_by`.
Returns:
...
Examples:
>>> from ppqueue import Queue
>>> from ppqueue.plot import plot_jobs
Expand Down

0 comments on commit 1b11ac5

Please sign in to comment.