Skip to content

Commit

Permalink
added a new show schedulers cli command
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmad-Wahid <59763365+Ahmad-Wahid@users.noreply.github.com>
  • Loading branch information
Ahmad-Wahid committed May 31, 2023
1 parent e4c77cc commit 86cf87f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions documentation/cli/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ of which some are referred to in this documentation.
``flexmeasures show data-sources`` List available data sources.
``flexmeasures show beliefs`` Plot time series data.
``flexmeasures show reporters`` List available reporters.
``flexmeasures show schedulers`` List available schedulers.
================================================= =======================================


Expand Down
5 changes: 5 additions & 0 deletions flexmeasures/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ def create( # noqa C901

app.reporters = get_classes_module("flexmeasures.data.models.reporting", Reporter)

# Register Schedulers
from flexmeasures.data.models.planning import Scheduler

app.schedulers = get_classes_module("flexmeasures.data.models.planning", Scheduler)

# add auth policy

from flexmeasures.auth import register_at as register_auth_at
Expand Down
24 changes: 24 additions & 0 deletions flexmeasures/cli/data_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,28 @@ def list_reporters():
)


@fm_show_data.command("schedulers")
@with_appcontext
def list_schedulers():
"""
Show available schedulers.
"""

click.echo("Schedulers:\n")
click.echo(
tabulate(
[
(
scheduler_name,
scheduler_class.__version__,
scheduler_class.__author__,
scheduler_class.__module__,
)
for scheduler_name, scheduler_class in app.schedulers.items()
],
headers=["name", "version", "author", "module"],
)
)


app.cli.add_command(fm_show_data)

0 comments on commit 86cf87f

Please sign in to comment.