Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7163791
D1502.id4942.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
D1502.id4942.diff
View Options
diff --git a/swh/scheduler/cli/__init__.py b/swh/scheduler/cli/__init__.py
--- a/swh/scheduler/cli/__init__.py
+++ b/swh/scheduler/cli/__init__.py
@@ -3,13 +3,15 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
-import click
import logging
-from swh.core.cli import CONTEXT_SETTINGS
+import click
+
+from swh.core.cli import CONTEXT_SETTINGS, AliasedGroup
-@click.group(context_settings=CONTEXT_SETTINGS)
+@click.group(name='scheduler', context_settings=CONTEXT_SETTINGS,
+ cls=AliasedGroup)
@click.option('--config-file', '-C', default=None,
type=click.Path(exists=True, dir_okay=False,),
help="Configuration file.")
@@ -21,11 +23,10 @@
help="Do NOT output logs on the console")
@click.pass_context
def cli(ctx, config_file, database, url, no_stdout):
- """Scheduler CLI interface.
+ """Software Heritage Scheduler tools.
- Default to use the the local scheduler instance (plugged to the
+ Use a local scheduler instance by default (plugged to the
main scheduler db).
-
"""
from swh.core import config
from swh.scheduler.celery_backend.config import setup_log_handler
@@ -64,11 +65,15 @@
ctx.obj['scheduler'] = scheduler
ctx.obj['config'] = conf
-
from . import admin, task, task_type # noqa
def main():
+ import click.core
+ click.core.DEPRECATED_HELP_NOTICE = '''
+
+DEPRECATED! Please use the command 'swh scheduler'.'''
+ cli.deprecated = True
return cli(auto_envvar_prefix='SWH_SCHEDULER')
diff --git a/swh/scheduler/cli/admin.py b/swh/scheduler/cli/admin.py
--- a/swh/scheduler/cli/admin.py
+++ b/swh/scheduler/cli/admin.py
@@ -11,7 +11,7 @@
from . import cli
-@cli.command('runner')
+@cli.command('start-runner')
@click.option('--period', '-p', default=0,
help=('Period (in s) at witch pending tasks are checked and '
'executed. Set to 0 (default) for a one shot.'))
@@ -46,7 +46,7 @@
ctx.exit(0)
-@cli.command('listener')
+@cli.command('start-listener')
@click.pass_context
def listener(ctx):
"""Starts a swh-scheduler listener service.
@@ -65,7 +65,7 @@
event_monitor(app, backend=scheduler)
-@cli.command('api-server')
+@cli.command('rpc-serve')
@click.option('--host', default='0.0.0.0',
help="Host to run the scheduler server api")
@click.option('--port', default=5008, type=click.INT,
@@ -75,7 +75,7 @@
"Defaults to True if log-level is DEBUG, False otherwise.")
)
@click.pass_context
-def api_server(ctx, host, port, debug):
+def rpc_server(ctx, host, port, debug):
"""Starts a swh-scheduler API HTTP server.
"""
if ctx.obj['config']['scheduler']['cls'] == 'remote':
@@ -90,24 +90,29 @@
server.app.run(host, port=port, debug=bool(debug))
-@cli.command('updater')
+@cli.command('start-updater')
@click.option('--verbose/--no-verbose', '-v', default=False,
help='Verbose mode')
@click.pass_context
def updater(ctx, verbose):
- """Insert tasks in the scheduler from the scheduler-updater's events
+ """Starts a scheduler-updater service.
+
+ Insert tasks in the scheduler from the scheduler-updater's events read from
+ the db cache (filled e.g. by the ghtorrent consumer service) .
"""
from swh.scheduler.updater.writer import UpdaterWriter
UpdaterWriter(**ctx.obj['config']).run()
-@cli.command('ghtorrent')
+@cli.command('start-ghtorrent')
@click.option('--verbose/--no-verbose', '-v', default=False,
help='Verbose mode')
@click.pass_context
def ghtorrent(ctx, verbose):
- """Consume events from ghtorrent and write them to cache.
+ """Starts a ghtorrent consumer service.
+
+ Consumes events from ghtorrent and write them to a cache.
"""
from swh.scheduler.updater.ghtorrent import GHTorrentConsumer
@@ -117,3 +122,12 @@
back_config = ctx.obj['config'].get('scheduler_updater', {})
backend = SchedulerUpdaterBackend(**back_config)
GHTorrentConsumer(backend, **ght_config).run()
+
+
+# for bw compat
+cli.add_alias(ghtorrent, 'ghtorrent')
+cli.add_alias(listener, 'listerner')
+cli.add_alias(runner, 'runner')
+cli.add_alias(updater, 'updater')
+cli.add_alias(rpc_server, 'serve')
+cli.add_alias(rpc_server, 'api-server')
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 30, 3:38 PM (1 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3233947
Attached To
D1502: cli: rename a admin cli commands
Event Timeline
Log In to Comment