Skip to content

Commit

Permalink
Merge branch 'master' into 1.4.x-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Apr 5, 2024
2 parents d477500 + df7cba0 commit db7a942
Show file tree
Hide file tree
Showing 21 changed files with 607 additions and 54 deletions.
27 changes: 27 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Codecov settings
# After modifying this file, you can validate it, see https://api.codecov.io/validate

codecov:
notify:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
# define the colour bar limits here (red...green)
range: "75...100"

# diff type
status:
project:
default:
# fail if coverage below this:
target: '85%'
# fail if coverage drops by this much:
threshold: '2%'
patch:
default:
target: '85%'

# turn off comments to pull requests
comment: false
2 changes: 1 addition & 1 deletion .github/workflows/1_create_release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: cylc/release-actions/check-shortlog@v1

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
# return to 3.x once cylc-flow is compatible with 3.10+ (pyuv)
python-version: '3.9'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/2_auto_publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
ref: ${{ env.MERGE_SHA }}

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
# return to 3.x once cylc-flow is compatible with 3.10+ (pyuv)
python-version: '3.9'
Expand All @@ -39,7 +39,7 @@ jobs:
uses: cylc/release-actions/build-python-package@v1

- name: Publish distribution to PyPI
uses: pypa/[email protected].10
uses: pypa/[email protected].14
with:
user: __token__ # uses the API token feature of PyPI - least permissions possible
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/branch_sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sync PR

on:
push:
branches:
- '*.*.x'
schedule:
- cron: '49 03 * * 1-5' # 03:49 UTC Mon-Fri
workflow_dispatch:
inputs:
head_branch:
description: Branch to merge into master
required: true

jobs:
sync:
uses: cylc/release-actions/.github/workflows/branch-sync.yml@v1
with:
head_branch: ${{ inputs.head_branch }}
secrets: inherit
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ jobs:
timeout-minutes: 2
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download coverage artifacts
uses: actions/download-artifact@v4

- name: Codecov upload
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
name: ${{ github.workflow }}
fail_ci_if_error: true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ This means you should not decorate async test functions with

## Copyright and Terms of Use

Copyright (C) 2019-<span actions:bind='current-year'>2023</span> NIWA & British Crown (Met Office) & Contributors.
Copyright (C) 2019-<span actions:bind='current-year'>2024</span> NIWA & British Crown (Met Office) & Contributors.

Cylc is free software: you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation,
Expand Down
1 change: 1 addition & 0 deletions changes.d/507.feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added functionality for routing to a multiuser deployment when running cylc gui command.
1 change: 1 addition & 0 deletions changes.d/548.feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve the performance of the GraphQL server.
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.4.5.dev"
__version__ = "1.5.0.dev"

import os
from typing import Dict
Expand Down
26 changes: 26 additions & 0 deletions cylc/uiserver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
from tornado import ioloop
from tornado.web import RedirectHandler
from traitlets import (
Bool,
Dict,
Float,
Int,
Expand All @@ -75,12 +76,14 @@
default,
validate,
)
from types import SimpleNamespace

from jupyter_server.extension.application import ExtensionApp

from cylc.flow.network.graphql import (
CylcGraphQLBackend, IgnoreFieldMiddleware
)
from cylc.flow.profiler import Profiler
from cylc.uiserver import (
__file__ as uis_pkg,
)
Expand Down Expand Up @@ -334,6 +337,16 @@ class CylcUIServer(ExtensionApp):
''',
default_value=100,
)
profile = Bool(
config=True,
help='''
Turn on Python profiling.
The profile results will be saved to ~/.cylc/uiserver/profile.prof
in cprofile format.
''',
default_value=False,
)

@validate('ui_build_dir')
def _check_ui_build_dir_exists(self, proposed):
Expand Down Expand Up @@ -417,6 +430,8 @@ def initialize_settings(self):
self.settings.update({'<trait>':...})
"""
super().initialize_settings()

# startup messages
self.log.info("Starting Cylc UI Server")
self.log.info(f'Serving UI from: {self.ui_path}')
self.log.debug(
Expand All @@ -425,6 +440,16 @@ def initialize_settings(self):
for key, value in self.config['CylcUIServer'].items()
)
)

# start profiling
self.profiler = Profiler(
# the profiler is designed to attach to a Cylc scheduler
schd=SimpleNamespace(workflow_log_dir=USER_CONF_ROOT),
# profiling is turned on via the "profile" traitlet
enabled=self.profile,
)
self.profiler.start()

# start the async scan task running (do this on server start not init)
ioloop.IOLoop.current().add_callback(
self.workflows_mgr.run
Expand Down Expand Up @@ -554,3 +579,4 @@ async def stop_extension(self):
self.data_store_mgr.executor.shutdown(wait=False)
# Destroy ZeroMQ context of all sockets
self.workflows_mgr.context.destroy()
self.profiler.stop()
5 changes: 5 additions & 0 deletions cylc/uiserver/authorise.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ class CylcAuthorizer(Authorizer):
"""

# This is here just to fix sphinx autodoc warning from traitlets' __init__
# see https://github.com/cylc/cylc-uiserver/pull/560
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def is_authorized(self, handler, user, action, resource) -> bool:
"""Allow a user to access their own server.
Expand Down
Loading

0 comments on commit db7a942

Please sign in to comment.