Skip to content

Commit

Permalink
Provided a single source of truth for symlinkable dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Jun 27, 2024
1 parent b09005a commit eb945d5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
6 changes: 3 additions & 3 deletions cylc/flow/pathutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 47,11 @@
SHELL_ENV_VARS = re.compile(r'\$[^$/]*')
SYMLINKABLE_LOCATIONS: Dict[str, str] = {
# Location: Version Added
'log': '8.0.0',
'log/job': '8.4.0',
'share': '8.0.0',
'share/cycle': '8.0.0',
'work': '8.0.0'
'log': '8.0.0',
'log/job': '8.4.0',
'work': '8.0.0',
}


Expand Down
5 changes: 2 additions & 3 deletions cylc/flow/workflow_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 59,7 @@
is_remote_host,
)
from cylc.flow.pathutil import (
SYMLINKABLE_LOCATIONS,
expand_path,
get_cylc_run_dir,
get_workflow_run_dir,
Expand Down Expand Up @@ -263,9 264,7 @@ class Install:
RESERVED_NAMES = frozenset([FLOW_FILE, SUITE_RC, *RESERVED_DIRNAMES])
"""Reserved filenames that cannot be used as run names."""

SYMLINK_DIRS = frozenset([
SHARE_CYCLE_DIR, SHARE_DIR, LogDir.DIRNAME, LOG_JOB_DIR, WORK_DIR, ''
])
SYMLINK_DIRS = frozenset(list(SYMLINKABLE_LOCATIONS.keys()) [''])
"""The paths of the symlink dirs that may be set in
global.cylc[install][symlink dirs], relative to the run dir
('' represents the run dir)."""
Expand Down
16 changes: 11 additions & 5 deletions tests/functional/cylc-clean/01-remote.t
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 82,22 @@ ${TEST_DIR}/${SYM_NAME}/cycle/cylc-run/${CYLC_TEST_REG_BASE}
| \`-- share
| \`-- cycle
\`-- leave-me-alone
${TEST_DIR}/${SYM_NAME}/job/cylc-run/${CYLC_TEST_REG_BASE}
\`-- ${FUNCTIONAL_DIR}
\`-- cylc-clean
\`-- ${TEST_NAME_BASE}
\`-- log
\`-- job
\`-- 1
\`-- santa
|-- 01
\`-- NN -> 01
${TEST_DIR}/${SYM_NAME}/other/cylc-run/${CYLC_TEST_REG_BASE}
\`-- ${FUNCTIONAL_DIR}
\`-- cylc-clean
\`-- ${TEST_NAME_BASE}
|-- log
| \`-- job
| \`-- 1
| \`-- santa
| |-- 01
| \`-- NN -> 01
| \`-- job -> ${TEST_DIR}/${SYM_NAME}/job/cylc-run/${WORKFLOW_NAME}/log/job
|-- share
| \`-- cycle -> ${TEST_DIR}/${SYM_NAME}/cycle/cylc-run/${WORKFLOW_NAME}/share/cycle
\`-- work
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/remote/04-symlink-dirs.t
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 106,7 @@ fi

# shellcheck disable=SC2016
LINK="$(${SSH} "${CYLC_TEST_HOST}" 'readlink "$HOME/cylc-run/'"$WORKFLOW_NAME"/log/job'"')"
if [[ "$LINK" == *"/test_cylc_symlink/cylctb_tmp_log_job_dir/cylc-run/${WORKFLOW_NAME}/log/job" ]]; then
if [[ "$LINK" == *"/cylctb_tmp_log_job_dir/cylc-run/${WORKFLOW_NAME}/log/job" ]]; then
ok "${TEST_NAME_BASE}-log/job-symlink-exists-ok.remotehost"
else
fail "${TEST_NAME_BASE}-log/job-symlink-exists-ok.remotehost"
Expand Down

0 comments on commit eb945d5

Please sign in to comment.