Skip to content
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

feat:command changes #2644

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ Acknowledgements
We are very grateful for your continuing support for MSS!

See our [Contributors page](https://mss.readthedocs.io/en/stable/authors.html) for a list of authors. See also our info on [funding](
https://mss.readthedocs.io/en/stable/funding.html).
https://mss.readthedocs.io/en/stable/funding.html).
2 changes: 1 addition & 1 deletion docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ MSS repository needs a different folder, e.g. workspace/MSS. Avoid to mix data a

:ref:`demodata <demodata>` is provided by executing::

mswms_demodata --seed
mswms --seed

To use this data add the mswms_settings.py in your python path::

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,6 @@ You can start server and client by loading the image ::
$ singularity build -f mss.sif Singularity.def
$ singularity shell mss.sif
$ Singularity > msui # starts the ui
$ Singularity > mswms_demodata --seed # creates in your $HOME a mss/ folder with testdata
$ Singularity > mswms --seed # creates in your $HOME a mss/ folder with testdata
$ Singularity > export PYTHONPATH=$HOME/mss; mswms # starts the development server
$ Singularity > mscolab db --init; mscolab start # starts the mscolab development server
2 changes: 1 addition & 1 deletion docs/mswms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Simulated Data and its configuration
------------------------------------


We provide demodata by executing the :code:`mswms_demodata --seed` program. This creates in your home directory
We provide demodata by executing the :code:`mswms --seed` program. This creates in your home directory
data files and also the needed server configuration files. The program creates 70MB of examples.
This script does not overwrite an existing mswms_settings.py.

Expand Down
24 changes: 12 additions & 12 deletions mslib/mswms/demodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,8 @@ def main():
"""
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--version", help="show version", action="store_true", default=False)
parser.add_argument("-s", "--seed", help="creates demodata for the mswms server",
action="store_true", default=False)
# parser.add_argument("-s", "--seed", help="creates demodata for the mswms server",
# action="store_true", default=False)
args = parser.parse_args()
if args.version:
print("***********************************************************************")
Expand All @@ -1245,16 +1245,16 @@ def main():
print("Documentation: http://mss.rtfd.io")
print("Version:", __version__)
sys.exit()
if args.seed:
root_fs = fs.open_fs("~/")
if not root_fs.exists("mss/testdata"):
root_fs.makedirs("mss/testdata")

examples = DataFiles(data_fs=fs.open_fs("~/mss/testdata"),
server_config_fs=fs.open_fs("~/mss"))
examples.create_server_config(detailed_information=True)
examples.create_data()
print("\nTo use this setup you need the mswms_settings.py in your python path e.g. \nexport PYTHONPATH=~/mss")
# if args.seed:
# root_fs = fs.open_fs("~/")
# if not root_fs.exists("mss/testdata"):
# root_fs.makedirs("mss/testdata")

# examples = DataFiles(data_fs=fs.open_fs("~/mss/testdata"),
# server_config_fs=fs.open_fs("~/mss"))
# examples.create_server_config(detailed_information=True)
# examples.create_data()
# print("\nTo use this setup you need the mswms_settings.py in your python path e.g. \nexport PYTHONPATH=~/mss")


if __name__ == '__main__':
Expand Down
15 changes: 15 additions & 0 deletions mslib/mswms/mswms.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
from mslib import __version__
from mslib.utils import setup_logging
from mslib.mswms.wms import app as application
from mslib.mswms.demodata import DataFiles
import fs


def main():
Expand All @@ -44,6 +46,8 @@ def main():
parser.add_argument("--debug", help="show debugging log messages on console", action="store_true", default=False)
parser.add_argument("--logfile", help="If set to a name log output goes to that file", dest="logfile",
default=None)
parser.add_argument("-s", "--seed", help="creates demodata for the mswms server",
action="store_true", default=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and what does this?

Have you tried the examples?

Copy link
Contributor Author

@anj20 anj20 Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and what does this?

Have you tried the examples?

It adds an argument '-s' or '--seed' to enable data seeding using the mswms command.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and how is the method called?

Does it create demodata in a dir as the description says?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it is not creating

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can u give some hint where to do the changes?

Copy link
Member

@ReimarBauer ReimarBauer Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look in conftest for an example, this creates also demodata for the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi i have added the seed function. Can u jst review it?


subparsers = parser.add_subparsers(help='Available actions', dest='action')
gallery = subparsers.add_parser("gallery", help="Subcommands surrounding the gallery")
Expand Down Expand Up @@ -84,6 +88,17 @@ def main():
print("Documentation: http://mss.rtfd.io")
print("Version:", __version__)
sys.exit()

if args.seed:
root_fs = fs.open_fs("~/")
if not root_fs.exists("mss/testdata"):
root_fs.makedirs("mss/testdata")

examples = DataFiles(data_fs=fs.open_fs("~/mss/testdata"),
server_config_fs=fs.open_fs("~/mss"))
examples.create_server_config(detailed_information=True)
examples.create_data()
print("\nTo use this setup you need the mswms_settings.py in your python path e.g. \nexport PYTHONPATH=~/mss")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when this is now copied here and we won´t call mswms_demodata any more the main function of demodata can be removed.

setup.py needs changes

and the docs need changes too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok lemme make the changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi do i need to remove the entire main funtion?


setup_logging(args)

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"mss = mslib.msui.mss:main",
"mssautoplot = mslib.utils.mssautoplot:main",
"msui = mslib.msui.msui:main",
"mswms = mslib.mswms.mswms:main",
"mswms_demodata = mslib.mswms.demodata:main"]
"mswms = mslib.mswms.mswms:main",]
# "mswms_demodata = mslib.mswms.demodata:main"]
if os.name != 'nt':
console_scripts.append('msidp = mslib.msidp.idp:main')

Expand Down
Loading