Skip to content

Commit

Permalink
mscolab server case
Browse files Browse the repository at this point in the history
  • Loading branch information
ReimarBauer committed May 28, 2024
1 parent db51269 commit 225815a
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 21 deletions.
2 changes: 1 addition & 1 deletion conda_recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{% set module = environ.get('MODULE', 'mss') %}
{% set project = load_file_data('requirements.d/mswms.toml', from_recipe_dir=False).get('project') %}
{% set project = load_file_data('requirements.d/mscolab.toml', from_recipe_dir=False).get('project') %}
{% set name = project.get('name') %}
{% set summary = project.get('description') %}

Expand Down
17 changes: 11 additions & 6 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
import keyring
except ModuleNotFoundError:
keyring = None
from mslib.mswms.demodata import DataFiles
try: # mscolab
from mslib.mswms.demodata import DataFiles
except ModuleNotFoundError:
DataFiles = None
import tests.constants as constants
from mslib.utils.loggerdef import configure_mpl_logger

Expand Down Expand Up @@ -96,7 +99,7 @@ def generate_initial_config():
sample_path = os.path.join(os.path.dirname(__file__), "tests", "data")
shutil.copy(os.path.join(sample_path, "example.ftml"), constants.ROOT_DIR)

if not constants.SERVER_CONFIG_FS.exists(constants.SERVER_CONFIG_FILE):
if DataFiles is not None and not constants.SERVER_CONFIG_FS.exists(constants.SERVER_CONFIG_FILE):
print('\n configure testdata')
# ToDo check pytest tmpdir_factory
examples = DataFiles(data_fs=constants.DATA_FS,
Expand Down Expand Up @@ -218,12 +221,14 @@ def _load_module(module_name, path):
sys.modules[module_name] = module
spec.loader.exec_module(module)


_load_module("mswms_settings", constants.SERVER_CONFIG_FILE_PATH)
if DataFiles is not None:
_load_module("mswms_settings", constants.SERVER_CONFIG_FILE_PATH)
_load_module("mscolab_settings", path)


generate_initial_config()
try: # mscolab
generate_initial_config()
except TypeError:
pass

try:
# This import must come after the call to generate_initial_config, otherwise SQLAlchemy will have a wrong database path
Expand Down
12 changes: 0 additions & 12 deletions mslib/mscolab/mscolab.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
add_all_users_to_all_operations, delete_user
from mslib.mscolab.utils import create_files
from mslib.utils import setup_logging
from mslib.utils.qt import Worker, Updater


def handle_start(args):
Expand Down Expand Up @@ -355,7 +354,6 @@ def handle_sso_metadata_init(repo_exists):
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--version", help="show version", action="store_true", default=False)
parser.add_argument("--update", help="Updates MSS to the newest version", action="store_true", default=False)

subparsers = parser.add_subparsers(help='Available actions', dest='action')

Expand Down Expand Up @@ -405,16 +403,6 @@ def main():
except git.exc.InvalidGitRepositoryError:
repo_exists = False

updater = Updater()
if args.update:
updater.on_update_available.connect(lambda old, new: updater.update_mss())
updater.on_log_update.connect(lambda s: print(s.replace("\n", "")))
updater.on_status_update.connect(lambda s: print(s.replace("\n", "")))
updater.run()
while Worker.workers:
list(Worker.workers)[0].wait()
sys.exit()

if args.action == "start":
handle_start(args)

Expand Down
102 changes: 102 additions & 0 deletions requirements.d/mscolab.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
[project]
name = "mscolab"

description = 'The MSColab server of the Mission Support System (MSS) - developed in the community to collaboratively exchange flight plans based on model data.'
readme = "README.md"
keywords = ["MSS", "collaboratively", "science", "flight planning"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"License :: OSI Approved :: Apache-2.0"
]
version = "9.0.0"

source_patches = [
'build_mswms_setuppy.patch'
]

dependencies = [
'python',
'pyyaml',
'future',
'defusedxml',
'chameleon',
'execnet',
'isodate',
'lxml',
'pillow',
'requests >=2.31.0',
'fs',
'cftime >=1.0.1',
'pyjwt',
'flask >=2.3.2',
'flask-httpauth',
'flask-mail',
'flask-migrate',
'werkzeug >=2.2.3, <3.0.0',
'flask-socketio >=5.1.0',
'flask-sqlalchemy >=3.0.0',
'flask-cors',
'flask-wtf',
'flask-login',
'pysaml2',
'libxmlsec1 # [not win]',
'email_validator',
'python-socketio >=5',
'python-engineio >=4',
'websocket-client',
'passlib',
'keyring',
'dbus-python # [not win]',
'gitpython',
'git',
'psycopg2',
'PyMySQL >=0.9.3',
'validate_email',
'multidict',
'markdown',
'xstatic',
'xstatic-jquery',
'xstatic-bootstrap',
'metpy',
'libtiff <4.5.0',
'python-slugify',
]

run_constrained = [
]
build_dependencies = [
'python',
'pip',
'setuptools',
'future',
]

host_dependencies = [
'python',
'setuptools',
'pip',
'future'
]

authors = ["see AUTHORS"]

maintainers = [
{name = "ReimarBauer", email = "[email protected]"}
]

test_imports = [
'mslib'
]
test_commands = [
'mscolab -h',
'msidp -h # [not win]'
]


[project.urls]
Homepage = "https://open-mss.github.io/"
Documentation = "https://mss.rtfd.io"
Repository = "https://github.com/open-mss/MSS"
Issues = "https://github.com/Open-MSS/MSS/issues"
Changelog = "https://github.com/Open-MSS/MSS/blob/stable/CHANGES.rst"
11 changes: 9 additions & 2 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
import multiprocessing
import time
import urllib
import mslib.mswms.mswms
try: # mscolab
import mslib.mswms.mswms
except ModuleNotFoundError:
pass

import eventlet
import eventlet.wsgi

Expand Down Expand Up @@ -178,7 +182,10 @@ def mscolab_server(mscolab_session_server, reset_mscolab):
:returns: The URL where the server is running.
"""
# Update mscolab URL to avoid "Update Server List" message boxes
modify_config_file({"default_MSCOLAB": [mscolab_session_server]})
try: # mscolab server tests should not access clients config
modify_config_file({"default_MSCOLAB": [mscolab_session_server]})
except TypeError:
pass
return mscolab_session_server


Expand Down

0 comments on commit 225815a

Please sign in to comment.