Separate once
option into separate command
This commit is contained in:
parent
aedda06ace
commit
532d7309e3
1 changed files with 12 additions and 12 deletions
|
@ -1,4 +1,3 @@
|
||||||
import argparse
|
|
||||||
import logging
|
import logging
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
|
|
||||||
|
@ -20,17 +19,18 @@ def cli():
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option('--once', is_flag=True)
|
def start():
|
||||||
def start(once):
|
Process(target=run_server, args=(get_server(),)).start()
|
||||||
if once:
|
Process(target=create_scheduler().start).start()
|
||||||
|
|
||||||
|
|
||||||
|
@cli.command()
|
||||||
|
def once():
|
||||||
scheduler = create_scheduler()
|
scheduler = create_scheduler()
|
||||||
jobs = {job.func for job in scheduler.get_jobs()}
|
jobs = {job.func for job in scheduler.get_jobs()}
|
||||||
for job in jobs:
|
for job in jobs:
|
||||||
logger.info("Executing '{}'".format(get_callable_name(job)))
|
logger.info("Executing '{}'".format(get_callable_name(job)))
|
||||||
job()
|
job()
|
||||||
else:
|
|
||||||
Process(target=run_server, args=(get_server(),)).start()
|
|
||||||
Process(target=create_scheduler().start).start()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Reference in a new issue