def suspend(cli_config, duration, **options): """Suspends all workers, to resume run `rq resume`""" if duration is not None and duration < 1: click.echo("Duration must be an integer greater than 1") sys.exit(1) connection_suspend(cli_config.connection, duration) if duration: msg = """Suspending workers for {0} seconds. No new jobs will be started during that time, but then will automatically resume""".format(duration) click.echo(msg) else: click.echo("Suspending workers. No new jobs will be started. But current jobs will be completed")
def suspend(url, config, duration): """Suspends all workers, to resume run `rq resume`""" if duration is not None and duration < 1: click.echo("Duration must be an integer greater than 1") sys.exit(1) connection = connect(url, config) connection_suspend(connection, duration) if duration: msg = """Suspending workers for {0} seconds. No new jobs will be started during that time, but then will automatically resume""".format(duration) click.echo(msg) else: click.echo("Suspending workers. No new jobs will be started. But current jobs will be completed")