Skip to content

Commit

Permalink
Merge branch 'master' into 1.5.x-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Nov 7, 2024
2 parents 87ca49e + def8d01 commit 3b7cf56
Show file tree
Hide file tree
Showing 7 changed files with 320 additions and 210 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/2_auto_publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: cylc/release-actions/build-python-package@v1

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@v1.9.0
uses: pypa/gh-action-pypi-publish@v1.10.3
with:
user: __token__ # uses the API token feature of PyPI - least permissions possible
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions changes.d/619.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure that subprocesses created by Cylc UI Server are cleaned up correctly when the server shuts down.
2 changes: 1 addition & 1 deletion cylc/uiserver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

__version__ = "1.5.2.dev"
__version__ = "1.6.0.dev"

import os
from typing import Dict
Expand Down
32 changes: 22 additions & 10 deletions cylc/uiserver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@
the environment variable ``CYLC_SITE_CONF_PATH``.
"""

from concurrent.futures import ProcessPoolExecutor
import getpass
import os
from pathlib import Path, PurePath
import sys
from concurrent.futures import ProcessPoolExecutor
from pathlib import Path, PurePath
from textwrap import dedent
from typing import List, Optional
from types import SimpleNamespace
from typing import List, Optional, Union

from jupyter_server.extension.application import ExtensionApp
from pkg_resources import parse_version
from tornado import ioloop
from tornado.web import RedirectHandler
Expand All @@ -76,9 +78,7 @@
default,
validate,
)
from types import SimpleNamespace

from jupyter_server.extension.application import ExtensionApp
from traitlets.config.loader import LazyConfigValue

from cylc.flow.network.graphql import (
CylcGraphQLBackend, IgnoreFieldMiddleware
Expand Down Expand Up @@ -109,6 +109,7 @@
from cylc.uiserver.websockets.tornado import TornadoSubscriptionServer
from cylc.uiserver.workflows_mgr import WorkflowsManager


INFO_FILES_DIR = Path(USER_CONF_ROOT / "info_files")


Expand Down Expand Up @@ -549,15 +550,26 @@ def set_sub_server(self):
auth=self.authobj,
)

def set_auth(self):
def set_auth(self) -> Authorization:
"""Create authorization object.
One for the lifetime of the UIServer.
"""
user_auth: Union[LazyConfigValue, dict] = (
self.config.CylcUIServer.user_authorization
)
site_auth: Union[LazyConfigValue, dict] = (
self.config.CylcUIServer.site_authorization
)
if isinstance(user_auth, LazyConfigValue):
user_auth = user_auth.to_dict()
if isinstance(site_auth, LazyConfigValue):
site_auth = site_auth.to_dict()

return Authorization(
getpass.getuser(),
self.config.CylcUIServer.user_authorization,
self.config.CylcUIServer.site_authorization,
self.log
user_auth,
site_auth,
self.log,
)

def initialize_templates(self):
Expand Down
Loading

0 comments on commit 3b7cf56

Please sign in to comment.