Skip to content

Commit

Permalink
Merge pull request #922 from altendky/release/v0.5.2
Browse files Browse the repository at this point in the history
Release/v0.5.2
  • Loading branch information
altendky authored Sep 13, 2021
2 parents 77f85e3 + 0345d46 commit 9ba0c24
Show file tree
Hide file tree
Showing 56 changed files with 11,341 additions and 4,243 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.coveragerc
.gitignore
docker
!docker/supervisord.conf
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ jobs:
python:
name: CPython 3.8
action: 3.8
- task:
name: Check format
tox: check-format
os:
name: Linux
runs-on: ubuntu-latest
python:
name: CPython 3.8
action: 3.8


env:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ venv
.vscode
*.code-workspace
src/plotman.egg-info
.coverage
.idea
.tox
coverage.xml
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.5.2] - 2021-09-12
### Fixed
- Temp files are correctly identified for cleanup.
([#912](https://github.com/ericaltendorf/plotman/pull/913))
- Correct where trailing `/` on dst directories resulted in them being considered unused.
([#920](https://github.com/ericaltendorf/plotman/pull/920))
### Added
- `-v`/`--buckets3` and `-K`/`--rmulti2` are configurable for madMAx.
([#869](https://github.com/ericaltendorf/plotman/pull/869))
- A combined major/minor value for Prometheus status output.
([#885](https://github.com/ericaltendorf/plotman/pull/885))
- `supervisord` now used in Docker image.
([#898](https://github.com/ericaltendorf/plotman/pull/898))
- Output same entries to plotman.log from 'plotman interactive' and ' plotman plot/archive' "daemons".
([#878](https://github.com/ericaltendorf/plotman/pull/878))
- [BladeBit](https://github.com/harold-b/bladebit) support.
Requires BladeBit v1.1.0 for proper log monitoring.
([#916](https://github.com/ericaltendorf/plotman/pull/916))

## [0.5.1] - 2021-07-15
### Fixed
- Detects binary-installed Chia plotting processes again after being broken in v0.5.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.1
0.5.2
14 changes: 6 additions & 8 deletions build-docker-plotman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

DOCKER_REGISTRY="<docker-registry>"
PROJECT="chia-plotman"
TAG="plotter"
TAG="latest"
BASE_CONTAINER="ubuntu:20.04"
CHIA_GIT_REFERENCE="1.1.7"
CHIA_GIT_REFERENCE="1.2.3"

# The UID/GID should match the 'chia' owner of the directories on the host system
UID=10001
GID=10001

docker rmi ${LOCAL_REGISTRY}/${PROJECT}:${TAG}
build_UID=10001
build_GID=10001

docker build . \
--squash \
--build-arg BASE_CONTAINER=${BASE_CONTAINER} \
--build-arg CHIA_GIT_REFERENCE=${CHIA_GIT_REFERENCE} \
--build-arg UID=${UID} \
--build-arg GID=${GID} \
--build-arg UID=${build_UID} \
--build-arg GID=${build_GID} \
-f docker/Dockerfile \
-t ${DOCKER_REGISTRY}/${PROJECT}:${TAG}

Expand Down
7 changes: 4 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN /bin/bash ./install.sh

COPY . /plotman

RUN ["/bin/bash", "-c", "source ./activate && pip install /plotman && deactivate"]
RUN ["/bin/bash", "-c", "source ./activate && pip install /plotman supervisor && deactivate"]

# Build deployment container
FROM ${BASE_CONTAINER} as plotman
Expand All @@ -31,6 +31,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& rm -rf /var/lib/apt/lists

COPY --from=plotman-builder /chia-blockchain /chia-blockchain
COPY ./docker/supervisord.conf /srv/supervisord.conf

RUN groupadd -g ${GID} chia
RUN useradd -m -u ${UID} -g ${GID} chia
Expand All @@ -50,7 +51,7 @@ USER chia
ENV VIRTUAL_ENV="/chia-blockchain/venv"
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# Kick off plots (assumes the environemnt is good to go)
CMD ["/bin/bash", "-c", "plotman plot" ]
# Kick off plots & archives (assumes the environemnt is good to go)
CMD ["/chia-blockchain/venv/bin/supervisord", "-c", "/srv/supervisord.conf" ]
# Alternative command to simply provide shell environment
# CMD ["/bin/bash", "-c", "trap : TERM INT; sleep infinity & wait" ]
8 changes: 8 additions & 0 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[supervisord]
nodaemon=true

[program:plot]
command=plotman plot

[program:archive]
command=plotman archive
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
target-version = ['py36', 'py37', 'py38', 'py39']
include = '''
^/(
setup.py
| src/plotman/.*\.pyi?
)$
'''
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ test =
pytest-cov
pyfakefs
checks =
black == 21.7b0
check-manifest ~= 0.46
mypy == 0.902
types-pkg_resources ~= 0.1.2
Expand Down
5 changes: 3 additions & 2 deletions src/plotman/_tests/archive_test.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@


def test_compute_priority() -> None:
assert (archive.compute_priority( job.Phase(major=3, minor=1), 1000, 10) >
archive.compute_priority( job.Phase(major=3, minor=6), 1000, 10) )
assert archive.compute_priority(
job.Phase(major=3, minor=1), 1000, 10
) > archive.compute_priority(job.Phase(major=3, minor=6), 1000, 10)
52 changes: 34 additions & 18 deletions src/plotman/_tests/configuration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,30 @@
from plotman import resources as plotman_resources


@pytest.fixture(name='config_text')
@pytest.fixture(name="config_text")
def config_text_fixture() -> str:
return importlib.resources.read_text(plotman_resources, "plotman.yaml")


@pytest.fixture(name='target_definitions_text')
@pytest.fixture(name="target_definitions_text")
def target_definitions_text_fixture() -> str:
return importlib.resources.read_text(
plotman_resources, "target_definitions.yaml",
plotman_resources,
"target_definitions.yaml",
)


def test_get_validated_configs__default(config_text: str, target_definitions_text: str) -> None:
def test_get_validated_configs__default(
config_text: str, target_definitions_text: str
) -> None:
"""Check that get_validated_configs() works with default/example plotman.yaml file."""
res = configuration.get_validated_configs(config_text, '', target_definitions_text)
res = configuration.get_validated_configs(config_text, "", target_definitions_text)
assert isinstance(res, configuration.PlotmanConfig)

def test_get_validated_configs__malformed(config_text: str, target_definitions_text: str) -> None:

def test_get_validated_configs__malformed(
config_text: str, target_definitions_text: str
) -> None:
"""Check that get_validated_configs() raises exception with invalid plotman.yaml contents."""
loaded_yaml = yaml.load(config_text, Loader=yaml.SafeLoader)

Expand All @@ -34,71 +40,81 @@ def test_get_validated_configs__malformed(config_text: str, target_definitions_t
malformed_config_text = yaml.dump(loaded_yaml, Dumper=yaml.SafeDumper)

with pytest.raises(configuration.ConfigurationException) as exc_info:
configuration.get_validated_configs(malformed_config_text, '/the_path', target_definitions_text)
configuration.get_validated_configs(
malformed_config_text, "/the_path", target_definitions_text
)

assert exc_info.value.args[0] == f"Config file at: '/the_path' is malformed"


def test_get_validated_configs__missing() -> None:
"""Check that get_validated_configs() raises exception when plotman.yaml does not exist."""
with pytest.raises(configuration.ConfigurationException) as exc_info:
configuration.read_configuration_text('/invalid_path')
configuration.read_configuration_text("/invalid_path")

assert exc_info.value.args[0] == (
f"No 'plotman.yaml' file exists at expected location: '/invalid_path'. To generate "
f"default config file, run: 'plotman config generate'"
)


def test_loads_without_user_interface(config_text: str, target_definitions_text: str) -> None:
def test_loads_without_user_interface(
config_text: str, target_definitions_text: str
) -> None:
loaded_yaml = yaml.load(config_text, Loader=yaml.SafeLoader)

del loaded_yaml["user_interface"]

stripped_config_text = yaml.dump(loaded_yaml, Dumper=yaml.SafeDumper)

reloaded_yaml = configuration.get_validated_configs(stripped_config_text, '', target_definitions_text)
reloaded_yaml = configuration.get_validated_configs(
stripped_config_text, "", target_definitions_text
)

assert reloaded_yaml.user_interface == configuration.UserInterface()


def test_loads_without_user_archiving(config_text: str, target_definitions_text: str) -> None:
def test_loads_without_user_archiving(
config_text: str, target_definitions_text: str
) -> None:
loaded_yaml = yaml.load(config_text, Loader=yaml.SafeLoader)

del loaded_yaml["archiving"]

stripped_config_text = yaml.dump(loaded_yaml, Dumper=yaml.SafeDumper)

reloaded_yaml = configuration.get_validated_configs(stripped_config_text, '', target_definitions_text)
reloaded_yaml = configuration.get_validated_configs(
stripped_config_text, "", target_definitions_text
)

assert reloaded_yaml.archiving is None


def test_get_dst_directories_gets_dst() -> None:
tmp = ['/tmp']
dst = ['/dst0', '/dst1']
tmp = ["/tmp"]
dst = ["/dst0", "/dst1"]
directories = configuration.Directories(tmp=tmp, dst=dst)

assert directories.get_dst_directories() == dst


def test_get_dst_directories_gets_tmp() -> None:
tmp = ['/tmp']
tmp = ["/tmp"]
directories = configuration.Directories(tmp=tmp)

assert directories.get_dst_directories() == tmp


def test_dst_is_dst() -> None:
tmp = ['/tmp']
dst = ['/dst0', '/dst1']
tmp = ["/tmp"]
dst = ["/dst0", "/dst1"]
directories = configuration.Directories(tmp=tmp, dst=dst)

assert not directories.dst_is_tmp()


def test_dst_is_tmp() -> None:
tmp = ['/tmp']
tmp = ["/tmp"]
directories = configuration.Directories(tmp=tmp)

assert directories.dst_is_tmp()
Loading

0 comments on commit 9ba0c24

Please sign in to comment.