-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symlink dirs cli #4250
Symlink dirs cli #4250
Conversation
I'm not sure about this. The original |
I'm slight confused about how this works (from a quick test, without examining the code). If I set (e.g.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, looks good:
$ cylc config -i '[install][symlink dirs]'
[[[localhost]]]
log = $HOME/cylc-log
run = $HOME/cylc-runn
share =
share/cycle =
work =
$ cylc install one
INSTALLED one/run1 from .../one
$ cylc install one --symlink-dirs=
INSTALLED one/run2 from .../one
$ cylc install one --symlink-dirs=log=$HOME/cylc-log
INSTALLED one/run3 from .../one
$ tree -l
.
├── _cylc-install
│ └── source -> .../one
│ └── suite.rc
├── run1 -> /cylc-runn/cylc-run/one/run1
│ ├── flow.cylc -> suite.rc
│ ├── log -> /cylc-log/cylc-run/one/run1/log
│ │ ├── install
│ │ │ └── 20210616T102225Z-install.log
│ │ └── version
│ │ ├── uncommitted.diff
│ │ └── vcs.conf
│ └── suite.rc
├── run2
│ ├── flow.cylc -> suite.rc
│ ├── log
│ │ ├── install
│ │ │ └── 20210616T102232Z-install.log
│ │ └── version
│ │ ├── uncommitted.diff
│ │ └── vcs.conf
│ └── suite.rc
├── run3
│ ├── flow.cylc -> suite.rc
│ ├── log -> /cylc-log/cylc-run/one/run3/log
│ │ ├── install
│ │ │ └── 20210616T102253Z-install.log
│ │ └── version
│ │ ├── uncommitted.diff
│ │ └── vcs.conf
│ └── suite.rc
└── runN -> run3 [recursive, not followed]
Tested again overriding run and work, the cylc play
overriding has been addressed.
65a8564
to
8f0883c
Compare
Sorry about that @hjoliver chatted this through with the team this end and have implemented the following changes.
The dropping of Hope this is ok, happy to make changes if you wish. |
69976de
to
7ab5c5f
Compare
The flake8 rules have just become a little stricter due to #4271, one small violation:
Find out more here - https://github.com/MartinThoma/flake8-simplify#rules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, tests as working, just a few minor suggestions and questions.
e3af61f
to
b6d8a98
Compare
cfffcd1
to
c98505b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the PR you wanted me to check after #4237 was merged
cylc/flow/pathutil.py
Outdated
if path.exists(): | ||
# Trying to link to itself; no symlink needed | ||
# (e.g. path's parent is symlink to target's parent) | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is needed for the case of share
and share/cycle
in global.cylc
pointing to the same place
[symlink dirs]
share = ~/sym-share
share/cycle = ~/sym-share
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 226 has the the return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this checks if the path exists after the target is created.
- When the
~/cylc-run/foo/share -> ~/sym-share/cylc-run/foo/share
symlink & target already exist, and we're now onshare/cycle
- The line
target.mkdir(...)
above will create~/sym-share/cylc-run/foo/share/cycle
. - At this point
path
exists now -path
is~/cylc-run/foo/share/cycle
, but because~/cylc-run/foo/share
is a symlink,path
is actually~/sym-share/cylc-run/foo/share/cycle
(Sorry, the comment in the code doesn't give a good explanation I now realise! And I should have created a test case for share
and share/cycle
being the same)
cylc/flow/pathutil.py
Outdated
if path.exists(): | ||
# Trying to link to itself; no symlink needed | ||
# (e.g. path's parent is symlink to target's parent) | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this checks if the path exists after the target is created.
- When the
~/cylc-run/foo/share -> ~/sym-share/cylc-run/foo/share
symlink & target already exist, and we're now onshare/cycle
- The line
target.mkdir(...)
above will create~/sym-share/cylc-run/foo/share/cycle
. - At this point
path
exists now -path
is~/cylc-run/foo/share/cycle
, but because~/cylc-run/foo/share
is a symlink,path
is actually~/sym-share/cylc-run/foo/share/cycle
(Sorry, the comment in the code doesn't give a good explanation I now realise! And I should have created a test case for share
and share/cycle
being the same)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this now, assuming @MetRonnie's final comments will be addressed (or countered). Very nice, thanks @datamel 👍
symlink-dirs=, cylc play skip local sym-dirs for installed workflows
Co-authored-by: Hilary James Oliver <[email protected]> Rebase Tidy
042d1b0
to
c14b904
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy with the response to my review
Adds cli option (
--symlink-dirs
) for over-riding localhost symlink dirs in global config when executingcylc install
.Removes --no-symlink-dirs option, this is replaced by --symlink-dirs=None
Also moves symlink dirs into install section of config...(these changes close #4219)
CONTRIBUTING.md
and added my name as a Code Contributor.setup.py
andconda-environment.yml
.