Skip to content

Commit

Permalink
remove CACHE_PATH for workers
Browse files Browse the repository at this point in the history
running multiple workers causes issues, instead give every worker its
own cache path within the currently working directory.

Signed-off-by: Paul Spooren <mail@aparcar.org>
  • Loading branch information
aparcar committed Aug 10, 2021
1 parent 972c629 commit 68631e6
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion asu/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ def api_build():
return response, status

req["store_path"] = current_app.config["STORE_PATH"]
req["cache_path"] = current_app.config["CACHE_PATH"]
req["upstream_url"] = current_app.config["UPSTREAM_URL"]
req["branch_data"] = get_branches()[req["branch"]]

Expand Down
2 changes: 1 addition & 1 deletion asu/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def build(req: dict):
job = get_current_job()

log.debug(f"Building {req}")
cache = (req["cache_path"] / req["version"] / req["target"]).parent
cache = (Path.cwd() / "cache" / req["version"] / req["target"]).parent
target, subtarget = req["target"].split("/")
sums_file = Path(cache / f"{subtarget}_sums")
sig_file = Path(cache / f"{subtarget}_sums.sig")
Expand Down
3 changes: 0 additions & 3 deletions misc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# where to store JSON files
JSON_PATH = Path.cwd() / "public/json/"

# where to store ImageBuilders
CACHE_PATH = Path.cwd() / "cache/"

# supported versions
BRANCHES = [
{
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def app(redis):
test_path = tempfile.mkdtemp()
app = create_app(
{
"CACHE_PATH": test_path + "/cache",
"JSON_PATH": test_path + "/json",
"REDIS_CONN": redis,
"STORE_PATH": test_path + "/store",
Expand Down
4 changes: 0 additions & 4 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def test_build_fake(app, upstream):
},
target="testtarget/testsubtarget",
store_path=app.config["STORE_PATH"],
cache_path=app.config["CACHE_PATH"],
upstream_url="http://localhost:8001",
version="SNAPSHOT",
profile="testprofile",
Expand All @@ -54,7 +53,6 @@ def test_build_fake_diff_packages(app, upstream):
},
target="testtarget/testsubtarget",
store_path=app.config["STORE_PATH"],
cache_path=app.config["CACHE_PATH"],
upstream_url="http://localhost:8001",
version="SNAPSHOT",
profile="testprofile",
Expand All @@ -77,7 +75,6 @@ def test_build_fake_store_path_not_exists(app, upstream):
},
target="testtarget/testsubtarget",
store_path=app.config["STORE_PATH"],
cache_path=app.config["CACHE_PATH"],
upstream_url="http://localhost:8001",
version="SNAPSHOT",
profile="testprofile",
Expand All @@ -98,7 +95,6 @@ def test_build_real(app, httpserver: HTTPServer):
},
target="ath79/generic",
store_path=app.config["STORE_PATH"],
cache_path=app.config["CACHE_PATH"],
upstream_url="https://downloads.cdn.openwrt.org",
version="SNAPSHOT",
profile="tplink_tl-wdr4300-v1",
Expand Down
2 changes: 0 additions & 2 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
def test_pathlib(app):
assert isinstance(app.config["STORE_PATH"], PosixPath)
assert isinstance(app.config["JSON_PATH"], PosixPath)
assert isinstance(app.config["CACHE_PATH"], PosixPath)
assert app.config["STORE_PATH"].is_dir()
assert app.config["JSON_PATH"].is_dir()
assert app.config["CACHE_PATH"].is_dir()


def test_other(app):
Expand Down

0 comments on commit 68631e6

Please sign in to comment.