from pyutils import bootstrap, config, exec_utils, stopwatch
from typing import Optional
from pyutils import bootstrap, config, exec_utils, stopwatch
-from pyutils.datetimez import datetime_utils
+from pyutils.datetimes import datetime_utils
from pyutils.files import file_utils, lockfile
logger = logging.getLogger(__name__)
cfg = config.add_commandline_args(
from pyutils.files import file_utils, lockfile
logger = logging.getLogger(__name__)
cfg = config.add_commandline_args(
- f'Python Cron Runner ({__file__})',
- 'Wrapper for cron commands with locking, timeouts, and accounting.',
+ f"Python Cron Runner ({__file__})",
+ "Wrapper for cron commands with locking, timeouts, and accounting.",
)
cfg.add_argument(
)
cfg.add_argument(
- '--lockfile',
+ "--lockfile",
default=None,
default=None,
- metavar='LOCKFILE_PATH',
- help='Path to the lockfile to use to ensure that two instances of a command do not execute contemporaneously.',
+ metavar="LOCKFILE_PATH",
+ help="Path to the lockfile to use to ensure that two instances of a command do not execute contemporaneously.",
)
cfg.add_argument(
)
cfg.add_argument(
- '--lockfile_audit_record',
+ "--lockfile_audit_record",
default=None,
default=None,
- metavar='LOCKFILE_AUDIT_RECORD_FILENAME',
- help='Path to a record of when the logfile was held/released and for what reason',
+ metavar="LOCKFILE_AUDIT_RECORD_FILENAME",
+ help="Path to a record of when the logfile was held/released and for what reason",
)
cfg.add_argument(
)
cfg.add_argument(
- '--timeout',
+ "--timeout",
type=str,
type=str,
- metavar='TIMEOUT',
+ metavar="TIMEOUT",
default=None,
help='Maximum time for lock acquisition + command execution. Undecorated for seconds but "3m" or "1h 15m" work too.',
)
cfg.add_argument(
default=None,
help='Maximum time for lock acquisition + command execution. Undecorated for seconds but "3m" or "1h 15m" work too.',
)
cfg.add_argument(
- '--timestamp',
+ "--timestamp",
type=str,
type=str,
- metavar='TIMESTAMP_FILE',
+ metavar="TIMESTAMP_FILE",
default=None,
default=None,
- help='The /timestamp/TIMESTAMP_FILE file tracking the work being done; files\' mtimes will be set to the last successful run of a command for accounting purposes.',
+ help="The /timestamp/TIMESTAMP_FILE file tracking the work being done; files' mtimes will be set to the last successful run of a command for accounting purposes.",
)
cfg.add_argument(
)
cfg.add_argument(
- '--max_frequency',
+ "--max_frequency",
type=str,
type=str,
- metavar='FREQUENCY',
+ metavar="FREQUENCY",
default=None,
help='The maximum frequency with which to do this work; even if the wrapper is invoked more often than this it will not run the command. Requires --timestamp. Undecorated for seconds but "3h" or "1h 15m" work too.',
)
cfg.add_argument(
default=None,
help='The maximum frequency with which to do this work; even if the wrapper is invoked more often than this it will not run the command. Requires --timestamp. Undecorated for seconds but "3h" or "1h 15m" work too.',