Skip to content

Commit

Permalink
Merge pull request #758 from fractal-analytics-platform/756-support-p…
Browse files Browse the repository at this point in the history
…roject_dir-deprecate-cache_dir

Support `project_dir`, deprecate `cache_dir`
  • Loading branch information
ychiucco authored Dec 3, 2024
2 parents 560125e + c5e1e0b commit 65a613a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 39 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* Update versions of pre-commit hooks and add precommit GitHub Action (\#757).


# 2.5.1

* Deprecate user `cache_dir` , to align with [fractal-server 2.9.2](https://github.com/fractal-analytics-platform/fractal-server/blob/main/CHANGELOG.md#292) (\#758).

# 2.5.0

* Update task-collection commands, to align with [fractal-server 2.9.0](https://github.com/fractal-analytics-platform/fractal-server/blob/main/CHANGELOG.md#290) (\#738).
Expand Down
2 changes: 0 additions & 2 deletions fractal_client/cmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ def user(
parameters = [
"new_email",
"new_password",
"cache_dir",
"slurm_user",
"project_dir",
"username",
Expand All @@ -352,7 +351,6 @@ def user(
"new_password",
"new_username",
"new_slurm_user",
"new_cache_dir",
"new_project_dir",
"new_ssh_settings_json",
"make_superuser",
Expand Down
6 changes: 0 additions & 6 deletions fractal_client/cmd/_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def user_register(
new_email: str,
new_password: str,
slurm_user: str | None = None,
cache_dir: str | None = None,
project_dir: str | None = None,
username: str | None = None,
ssh_settings_json: str | None = None,
Expand All @@ -62,8 +61,6 @@ def user_register(
new_settings = dict()
if slurm_user:
new_settings["slurm_user"] = slurm_user
if cache_dir:
new_settings["cache_dir"] = cache_dir
if project_dir:
new_settings["project_dir"] = project_dir
if ssh_settings_json is not None:
Expand Down Expand Up @@ -130,7 +127,6 @@ def user_edit(
new_password: str | None = None,
new_username: str | None = None,
new_slurm_user: str | None = None,
new_cache_dir: str | None = None,
new_project_dir: str | None = None,
new_ssh_settings_json: str | None = None,
make_superuser: bool = False,
Expand Down Expand Up @@ -165,8 +161,6 @@ def user_edit(
user_update["is_verified"] = False
if new_username is not None:
user_update["username"] = new_username
if new_cache_dir is not None:
settings_update["cache_dir"] = new_cache_dir
if new_slurm_user is not None:
settings_update["slurm_user"] = new_slurm_user
if new_project_dir is not None:
Expand Down
16 changes: 0 additions & 16 deletions fractal_client/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,14 +783,6 @@
user_register_parser.add_argument(
"new_password", help="Password for the new user."
)
user_register_parser.add_argument(
"--cache-dir",
help=(
"User's cache directory absolute path "
"(necessary for workflow execution when using the SLURM backend)."
),
required=False,
)
user_register_parser.add_argument(
"--project-dir",
help="User-writeable base folder, used e.g. for default `zarr_dir` paths.",
Expand Down Expand Up @@ -857,14 +849,6 @@
user_edit_parser.add_argument(
"--new-username", help="New user username.", required=False
)
user_edit_parser.add_argument(
"--new-cache-dir",
help=(
"New user's cache directory absolute path "
"(necessary for workflow execution when using the SLURM backend)."
),
required=False,
)
user_edit_parser.add_argument(
"--new-project-dir",
help="New value of `project_dir`.",
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/fixtures_testserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ def user_factory(invoke_as_superuser):
def __user_factory(
email: str,
password: str,
cache_dir: str | None = None,
project_dir: str | None = None,
slurm_user: str | None = None,
username: str | None = None,
superuser: bool = False,
):
cmd = "user register"
if cache_dir is not None:
cmd += f" --cache-dir {cache_dir}"
if project_dir is not None:
cmd += f" --project-dir {project_dir}"
if slurm_user is not None:
cmd += f" --slurm-user {slurm_user}"
if username is not None:
Expand Down
12 changes: 1 addition & 11 deletions tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_register_as_superuser(
else:
res = invoke_as_superuser(
f"user register {EMAIL_USER} {PWD_USER} "
"--slurm-user SOMETHING --cache-dir /absolute --username X"
"--slurm-user SOMETHING --username X"
)
debug(res.data)
assert res.retcode == 0
Expand Down Expand Up @@ -178,7 +178,6 @@ def test_edit_as_superuser(
user_id = res.data["id"]
# Call fractal user edit
NEW_EMAIL = f"{new_name()}@example.org"
NEW_CACHE_DIR = "/tmp/xxx"
NEW_SLURM_USER = "new_slurm"
NEW_USERNAME = "new_username"
cmd = (
Expand All @@ -187,7 +186,6 @@ def test_edit_as_superuser(
f"--new-password SOMETHING "
f"--new-slurm-user {NEW_SLURM_USER} "
f"--new-username {NEW_USERNAME} "
f"--new-cache-dir {NEW_CACHE_DIR}"
)
if new_is_superuser:
cmd = f"{cmd} --make-superuser"
Expand All @@ -210,7 +208,6 @@ def test_edit_as_superuser(
if new_is_verified
else not res.data["is_verified"]
)
assert res.data["settings"]["cache_dir"] == NEW_CACHE_DIR
assert res.data["settings"]["slurm_user"] == NEW_SLURM_USER
else:
res = invoke_as_superuser(cmd)
Expand All @@ -220,11 +217,6 @@ def test_edit_as_superuser(
"`--remove-verified`"
)

BAD_CACHE_DIR = "not_absolute"
with pytest.raises(SystemExit):
cmd = f"user edit {user_id} --new-cache-dir {BAD_CACHE_DIR}"
invoke_as_superuser(cmd)

# If the user was made a superuser, check that we can go back to normal
# user
if new_is_superuser:
Expand Down Expand Up @@ -257,7 +249,6 @@ def test_edit_user_settings(invoke_as_superuser, tmp_path, new_name):
"ssh_jobs_dir": None,
"slurm_user": None,
"slurm_accounts": [],
"cache_dir": None,
"project_dir": None,
}
SSH_HOST = "something.somewhere"
Expand All @@ -271,7 +262,6 @@ def test_edit_user_settings(invoke_as_superuser, tmp_path, new_name):
"ssh_jobs_dir": None,
"slurm_user": None,
"slurm_accounts": [],
"cache_dir": None,
"project_dir": NEW_PROJECT_DIR,
}

Expand Down

0 comments on commit 65a613a

Please sign in to comment.