Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/python/redo/redo/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  cmd.py

  Sprache: Python
 

# ***** BEGIN LICENSE BLOCK *****
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
# ***** END LICENSE BLOCK *****
import logging
import sys
from subprocess import CalledProcessError, check_call

from redo import retrying

log = logging.getLogger(__name__)


def main(argv=None):
    from argparse import REMAINDER, ArgumentParser

    if argv is None:
        argv = sys.argv

    parser = ArgumentParser()
    parser.add_argument("-a""--attempts", type=int, default=5, help="How many times to retry.")
    parser.add_argument(
        "-s""--sleeptime", type=int, default=60, help="How long to sleep between attempts. Sleeptime doubles after each attempt."
    )
    parser.add_argument(
        "-m""--max-sleeptime", type=int, default=5 * 60, help="Maximum length of time to sleep between attempts (limits backoff length)."
    )
    parser.add_argument("-v""--verbose", action="store_true", default=False)
    parser.add_argument("cmd", nargs=REMAINDER, help="Command to run. Eg: wget http://blah")

    args = parser.parse_args(argv[1:])

    if args.verbose:
        logging.basicConfig(level=logging.INFO)
        logging.getLogger("retry").setLevel(logging.INFO)
    else:
        logging.basicConfig(level=logging.ERROR)
        logging.getLogger("retry").setLevel(logging.ERROR)

    try:
        with retrying(
            check_call,
            attempts=args.attempts,
            sleeptime=args.sleeptime,
            max_sleeptime=args.max_sleeptime,
            retry_exceptions=(CalledProcessError,),
        ) as r_check_call:
            r_check_call(args.cmd)
    except KeyboardInterrupt:
        sys.exit(-1)
    except Exception as e:
        log.error("Unable to run command after %d attempts" % args.attempts, exc_info=True)
        rc = getattr(e, "returncode", -2)
        sys.exit(rc)


if __name__ == "__main__":
    main()

Messung V0.5 in Prozent
C=92 H=100 G=95

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-08-26) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.