-
Notifications
You must be signed in to change notification settings - Fork 18
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
Adds version hierarchy to config files #301
Conversation
Codecov Report
@@ Coverage Diff @@
## master #301 +/- ##
==========================================
- Coverage 79.61% 79.57% -0.05%
==========================================
Files 9 9
Lines 981 979 -2
Branches 193 193
==========================================
- Hits 781 779 -2
Misses 165 165
Partials 35 35
Continue to review full report at Codecov.
|
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.
Should these two be deleted?
cylc-uiserver/cylc/uiserver/jupyterhub_config.py
Lines 45 to 48 in 0c17a39
# site configuration | |
SITE_CONF_PATH: Path = SITE_CONF_ROOT / 'jupyter_config.py' | |
# user configuration | |
USER_CONF_PATH: Path = USER_CONF_ROOT / 'jupyter_config.py' |
cylc/uiserver/jupyterhub_config.py
Outdated
@@ -49,21 +55,35 @@ def _load(path): | |||
exec(path.read_text()) | |||
|
|||
|
|||
def get_conf_dir_hierarchy(config_paths: List[Path]): |
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.
def get_conf_dir_hierarchy(config_paths: List[Path]): | |
def get_conf_dir_hierarchy(config_paths: List[Path]) -> List[Path]: |
cylc/uiserver/jupyterhub_config.py
Outdated
conf_hierarchy.append(Path(x[0], x[1], 'jupyter_config.py')) | ||
return conf_hierarchy | ||
|
||
|
||
def load(): |
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.
(Type annotations in a function body aren't checked unless the definition has type annotations)
def load(): | |
def load() -> None: |
cylc/uiserver/jupyterhub_config.py
Outdated
) | ||
else: | ||
site_conf_path: Path = SITE_CONF_PATH | ||
config_paths = [DEFAULT_CONF_PATH, site_conf_path, USER_CONF_PATH] | ||
site_conf_path: Path = SITE_CONF_ROOT |
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.
Already declared
site_conf_path: Path = SITE_CONF_ROOT | |
site_conf_path = SITE_CONF_ROOT |
For some reason it's not using the
|
I'll look into this now, thanks @MetRonnie |
It could be loading other config files which reset it back, try running in debug mode, you should see a log entry every time something changed. |
I have found no real difference in the log output with this PR or master checked out, other than:
In neither was there an indication of what |
(Updated) This bit of logging only works for cylc-uiserver/cylc/uiserver/app.py Lines 379 to 384 in aa31dea
This doesn't work for either:
This is also the case on master |
|
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.
Should do the trick for JupyterHub, needs a small addition to make it work for the UI Server too.
cylc/uiserver/jupyterhub_config.py
Outdated
@@ -49,21 +55,35 @@ def _load(path): | |||
exec(path.read_text()) | |||
|
|||
|
|||
def get_conf_dir_hierarchy(config_paths: List[Path]): |
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.
This file is only loaded by JupyterHub, to open it up to Jupyter Server too need to add it to the list of config_file_paths
in cylc.uiserver.CylcUIServer
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.
Need to update?
cylc-uiserver/cylc/uiserver/app.py
Lines 103 to 115 in 1b2a599
config_file_paths = list( | |
map( | |
str, | |
[ | |
# user configuration | |
USER_CONF_ROOT, | |
# site configuration | |
SITE_CONF_ROOT, | |
# base configuration - always used | |
Path(uis_pkg).parent, | |
] | |
) | |
) |
0e69c4e
to
efcaef1
Compare
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
cylc/uiserver/app.py
Outdated
) | ||
) | ||
config_file_paths.append(str(Path(uis_pkg).parent)) |
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.
We should add the path hierarchy here rather than loading the hub config, this lets Jupyter Server take care of loading the files correctly.
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.
hub -> uiserver here?
cylc-uiserver/cylc/uiserver/app.py
Lines 20 to 22 in 3dade03
* ``$CYLC_SITE_CONF_PATH/hub/jupyter_config.py`` (for site-level configuration) | |
* ``/etc/cylc/hub/jupyter_config.py`` (for system-level configuration) | |
* ``~/.cylc/hub/jupyter_config.py`` (for user-level configuration) |
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.
It is correctly loading the moved jupyter_config.py
now
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.
Ah wait, forgot about the requested change in my earlier comment
hub -> uiserver here?
cylc-uiserver/cylc/uiserver/app.py
Lines 20 to 22 in 3dade03
* ``$CYLC_SITE_CONF_PATH/hub/jupyter_config.py`` (for site-level configuration) * ``/etc/cylc/hub/jupyter_config.py`` (for system-level configuration) * ``~/.cylc/hub/jupyter_config.py`` (for user-level configuration)
Great, well spotted, that just came in on a rebase. |
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
…nto config-root-path
(flake8 unhappy) |
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.
Sorry, could do with shifting the logic out of the hub config, this file is only intended for JupyterHub and is not supposed to be imported directly for normal use because it auto-loads.
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 good to me, tested as working, just need to get the test passing.
Co-authored-by: Oliver Sanders <oliver.sanders@metoffice.gov.uk>
Yep thanks! On it now. I can't reproduce locally but I expect a path expansion problem. |
Co-authored-by: Oliver Sanders <oliver.sanders@metoffice.gov.uk>
For hub_version

0.6.0
, the load order can be seen below:These changes close #199 and #291
CONTRIBUTING.md
and added my name as a Code Contributor.