Compare commits
21 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f56cb41e69 | ||
![]() |
07dda66bae | ||
![]() |
949c9ee5a1 | ||
![]() |
fa4cb5dc9a | ||
![]() |
7fe5e9aea6 | ||
![]() |
8021ac818e | ||
![]() |
55c84c6efe | ||
![]() |
56d7a48e45 | ||
![]() |
fe0840d3e0 | ||
![]() |
f36759dc48 | ||
![]() |
ff0af6732a | ||
![]() |
6257362534 | ||
![]() |
be4d6bfe4d | ||
![]() |
f4682c9070 | ||
![]() |
eb8962003c | ||
![]() |
6b4280a6aa | ||
![]() |
784f75ac3f | ||
![]() |
f01faaf2f9 | ||
![]() |
3fde33ac84 | ||
![]() |
3f46ee6a30 | ||
![]() |
9a39db4546 |
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,4 @@
|
||||||
|
*~
|
||||||
|
*.pyc
|
||||||
|
dist/
|
||||||
rattail_tempmon.egg-info/
|
rattail_tempmon.egg-info/
|
||||||
|
|
53
CHANGELOG.md
Normal file
53
CHANGELOG.md
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
All notable changes to rattail-tempmon will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## v0.4.6 (2024-08-19)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- avoid deprecated base class for config extension
|
||||||
|
|
||||||
|
## v0.4.5 (2024-07-02)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- fix signature for calls to `get_engines()`
|
||||||
|
|
||||||
|
## v0.4.4 (2024-07-02)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- avoid deprecated function for engine config
|
||||||
|
|
||||||
|
## v0.4.3 (2024-07-01)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- remove references, dependency for `six` package
|
||||||
|
|
||||||
|
## v0.4.2 (2024-07-01)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- remove legacy command definitions
|
||||||
|
|
||||||
|
## v0.4.1 (2024-06-14)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- fallback to `importlib_metadata` on older python
|
||||||
|
|
||||||
|
## v0.4.0 (2024-06-10)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- switch from setup.cfg to pyproject.toml + hatchling
|
||||||
|
|
||||||
|
|
||||||
|
## Older Releases
|
||||||
|
|
||||||
|
Please see `docs/OLDCHANGES.rst` for older release notes.
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
rattail-tempmon
|
# rattail-tempmon
|
||||||
===============
|
|
||||||
|
|
||||||
Rattail is a retail software framework, released under the GNU General Public
|
Rattail is a retail software framework, released under the GNU General Public
|
||||||
License.
|
License.
|
||||||
|
@ -8,6 +7,5 @@ License.
|
||||||
This is the ``rattail-tempmon`` package, which provides a database schema, and
|
This is the ``rattail-tempmon`` package, which provides a database schema, and
|
||||||
client/server daemons for recording and processing temperature data.
|
client/server daemons for recording and processing temperature data.
|
||||||
|
|
||||||
Please see Rattail's `home page`_ for more information.
|
Please see Rattail's [home page](https://rattailproject.org/) for more
|
||||||
|
information.
|
||||||
.. _home page: https://rattailproject.org/
|
|
|
@ -2,6 +2,16 @@
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
NB. this file contains "old" release notes only. for newer releases
|
||||||
|
see the `CHANGELOG.md` file in the source root folder.
|
||||||
|
|
||||||
|
|
||||||
|
0.3.0 (2024-05-30)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* Migrate all commands to use ``typer``.
|
||||||
|
|
||||||
|
|
||||||
0.2.10 (2023-11-30)
|
0.2.10 (2023-11-30)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
52
pyproject.toml
Normal file
52
pyproject.toml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "rattail-tempmon"
|
||||||
|
version = "0.4.6"
|
||||||
|
description = "Retail Software Framework - Temperature monitoring add-on"
|
||||||
|
readme = "README.md"
|
||||||
|
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
|
||||||
|
license = {text = "GNU GPL v3+"}
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 3 - Alpha",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
||||||
|
"Natural Language :: English",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
"Programming Language :: Python",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Topic :: Office/Business",
|
||||||
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
|
]
|
||||||
|
dependencies = [
|
||||||
|
"rattail[db]",
|
||||||
|
"sqlsoup",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Homepage = "https://rattailproject.org"
|
||||||
|
Repository = "https://forgejo.wuttaproject.org/rattail/rattail-tempmon"
|
||||||
|
Changelog = "https://forgejo.wuttaproject.org/rattail/rattail-tempmon/src/branch/master/CHANGELOG.md"
|
||||||
|
|
||||||
|
|
||||||
|
[project.entry-points."rattail.config.extensions"]
|
||||||
|
tempmon = "rattail_tempmon.config:TempmonConfigExtension"
|
||||||
|
|
||||||
|
|
||||||
|
[project.entry-points."rattail.typer_imports"]
|
||||||
|
rattail_tempmon = "rattail_tempmon.commands"
|
||||||
|
|
||||||
|
|
||||||
|
[project.entry-points."rattail.emails"]
|
||||||
|
rattail_tempmon = "rattail_tempmon.emails"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.commitizen]
|
||||||
|
version_provider = "pep621"
|
||||||
|
tag_format = "v$version"
|
||||||
|
update_changelog_on_bump = true
|
|
@ -1,3 +1,9 @@
|
||||||
# -*- coding: utf-8; -*-
|
# -*- coding: utf-8; -*-
|
||||||
|
|
||||||
__version__ = '0.2.10'
|
try:
|
||||||
|
from importlib.metadata import version
|
||||||
|
except ImportError:
|
||||||
|
from importlib_metadata import version
|
||||||
|
|
||||||
|
|
||||||
|
__version__ = version('rattail-tempmon')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2017 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -24,137 +24,157 @@
|
||||||
Tempmon commands
|
Tempmon commands
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals, absolute_import
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
from enum import Enum
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from rattail import commands
|
import typer
|
||||||
from rattail.time import localtime, make_utc
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
|
from rattail.commands import rattail_typer
|
||||||
|
from rattail.commands.typer import importer_command, typer_get_runas_user
|
||||||
|
from rattail.commands.importing import ImportCommandHandler
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ExportHotCooler(commands.ImportSubcommand):
|
class ServiceAction(str, Enum):
|
||||||
|
start = 'start'
|
||||||
|
stop = 'stop'
|
||||||
|
|
||||||
|
|
||||||
|
@rattail_typer.command()
|
||||||
|
@importer_command
|
||||||
|
def export_hotcooler(
|
||||||
|
ctx: typer.Context,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
Export data from Rattail-Tempmon to HotCooler
|
Export data from Rattail-Tempmon to HotCooler
|
||||||
"""
|
"""
|
||||||
name = 'export-hotcooler'
|
config = ctx.parent.rattail_config
|
||||||
description = __doc__.strip()
|
progress = ctx.parent.rattail_progress
|
||||||
handler_spec = 'rattail_tempmon.hotcooler.importing.tempmon:FromTempmonToHotCooler'
|
handler = ImportCommandHandler(
|
||||||
|
config,
|
||||||
|
import_handler_spec='rattail_tempmon.hotcooler.importing.tempmon:FromTempmonToHotCooler')
|
||||||
|
kwargs['user'] = typer_get_runas_user(ctx)
|
||||||
|
handler.run(kwargs, progress=progress)
|
||||||
|
|
||||||
|
|
||||||
class PurgeTempmon(commands.Subcommand):
|
@rattail_typer.command()
|
||||||
|
def purge_tempmon(
|
||||||
|
ctx: typer.Context,
|
||||||
|
keep_days: Annotated[
|
||||||
|
int,
|
||||||
|
typer.Option('--keep',
|
||||||
|
help="Number of days for which data should be kept.")] = ...,
|
||||||
|
dry_run: Annotated[
|
||||||
|
bool,
|
||||||
|
typer.Option('--dry-run',
|
||||||
|
help="Go through the full motions and allow logging etc. to "
|
||||||
|
"occur, but rollback (abort) the transaction at the end.")] = False,
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
Purge stale data from Tempmon database
|
Purge stale data from Tempmon database
|
||||||
"""
|
"""
|
||||||
name = 'purge-tempmon'
|
config = ctx.parent.rattail_config
|
||||||
description = __doc__.strip()
|
progress = ctx.parent.rattail_progress
|
||||||
|
do_purge(config, keep_days, dry_run=dry_run, progress=progress)
|
||||||
def add_parser_args(self, parser):
|
|
||||||
parser.add_argument('--keep', metavar='DAYS', required=True, type=int,
|
|
||||||
help="Number of days for which data should be kept.")
|
|
||||||
parser.add_argument('--dry-run', action='store_true',
|
|
||||||
help="Go through the full motions and allow logging etc. to "
|
|
||||||
"occur, but rollback (abort) the transaction at the end.")
|
|
||||||
|
|
||||||
def run(self, args):
|
|
||||||
from rattail_tempmon.db import Session as TempmonSession, model as tempmon
|
|
||||||
|
|
||||||
cutoff = localtime(self.config).date() - datetime.timedelta(days=args.keep)
|
|
||||||
cutoff = localtime(self.config, datetime.datetime.combine(cutoff, datetime.time(0)))
|
|
||||||
session = TempmonSession()
|
|
||||||
|
|
||||||
readings = session.query(tempmon.Reading)\
|
|
||||||
.filter(tempmon.Reading.taken < make_utc(cutoff))
|
|
||||||
count = readings.count()
|
|
||||||
|
|
||||||
def purge(reading, i):
|
|
||||||
session.delete(reading)
|
|
||||||
if i % 200 == 0:
|
|
||||||
session.flush()
|
|
||||||
|
|
||||||
self.progress_loop(purge, readings, count=count, message="Purging stale readings")
|
|
||||||
log.info("deleted {} stale readings".format(count))
|
|
||||||
|
|
||||||
if args.dry_run:
|
|
||||||
session.rollback()
|
|
||||||
log.info("dry run, so transaction was rolled back")
|
|
||||||
else:
|
|
||||||
session.commit()
|
|
||||||
log.info("transaction was committed")
|
|
||||||
session.close()
|
|
||||||
|
|
||||||
|
|
||||||
class TempmonClient(commands.Subcommand):
|
@rattail_typer.command()
|
||||||
|
def tempmon_client(
|
||||||
|
ctx: typer.Context,
|
||||||
|
action: Annotated[
|
||||||
|
ServiceAction,
|
||||||
|
typer.Argument(help="Action to perform for the service.")] = ...,
|
||||||
|
pidfile: Annotated[
|
||||||
|
Path,
|
||||||
|
typer.Option('--pidfile', '-p',
|
||||||
|
help="Path to PID file.")] = None,
|
||||||
|
# TODO: deprecate / remove this
|
||||||
|
daemonize: Annotated[
|
||||||
|
bool,
|
||||||
|
typer.Option('--daemonize',
|
||||||
|
help="Daemonize when starting.")] = False,
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
Manage the tempmon-client daemon
|
Manage the tempmon-client daemon
|
||||||
"""
|
"""
|
||||||
name = 'tempmon-client'
|
from rattail_tempmon.client import make_daemon
|
||||||
description = __doc__.strip()
|
|
||||||
|
|
||||||
def add_parser_args(self, parser):
|
config = ctx.parent.rattail_config
|
||||||
subparsers = parser.add_subparsers(title='subcommands')
|
daemon = make_daemon(config, pidfile)
|
||||||
|
if action == 'start':
|
||||||
start = subparsers.add_parser('start', help="Start daemon")
|
daemon.start(daemonize)
|
||||||
start.set_defaults(subcommand='start')
|
elif action == 'stop':
|
||||||
stop = subparsers.add_parser('stop', help="Stop daemon")
|
daemon.stop()
|
||||||
stop.set_defaults(subcommand='stop')
|
|
||||||
|
|
||||||
parser.add_argument('-p', '--pidfile',
|
|
||||||
help="Path to PID file.", metavar='PATH')
|
|
||||||
parser.add_argument('-D', '--daemonize', action='store_true',
|
|
||||||
help="Daemonize when starting.")
|
|
||||||
|
|
||||||
def run(self, args):
|
|
||||||
from rattail_tempmon.client import make_daemon
|
|
||||||
|
|
||||||
daemon = make_daemon(self.config, args.pidfile)
|
|
||||||
if args.subcommand == 'start':
|
|
||||||
daemon.start(args.daemonize)
|
|
||||||
elif args.subcommand == 'stop':
|
|
||||||
daemon.stop()
|
|
||||||
|
|
||||||
|
|
||||||
class TempmonServer(commands.Subcommand):
|
@rattail_typer.command()
|
||||||
"""
|
def tempmon_problems(
|
||||||
Manage the tempmon-server daemon
|
ctx: typer.Context,
|
||||||
"""
|
):
|
||||||
name = 'tempmon-server'
|
|
||||||
description = __doc__.strip()
|
|
||||||
|
|
||||||
def add_parser_args(self, parser):
|
|
||||||
subparsers = parser.add_subparsers(title='subcommands')
|
|
||||||
|
|
||||||
start = subparsers.add_parser('start', help="Start daemon")
|
|
||||||
start.set_defaults(subcommand='start')
|
|
||||||
stop = subparsers.add_parser('stop', help="Stop daemon")
|
|
||||||
stop.set_defaults(subcommand='stop')
|
|
||||||
|
|
||||||
parser.add_argument('-p', '--pidfile',
|
|
||||||
help="Path to PID file.", metavar='PATH')
|
|
||||||
parser.add_argument('-D', '--daemonize', action='store_true',
|
|
||||||
help="Daemonize when starting.")
|
|
||||||
|
|
||||||
def run(self, args):
|
|
||||||
from rattail_tempmon.server import make_daemon
|
|
||||||
|
|
||||||
daemon = make_daemon(self.config, args.pidfile)
|
|
||||||
if args.subcommand == 'start':
|
|
||||||
daemon.start(args.daemonize)
|
|
||||||
elif args.subcommand == 'stop':
|
|
||||||
daemon.stop()
|
|
||||||
|
|
||||||
|
|
||||||
class TempmonProblems(commands.Subcommand):
|
|
||||||
"""
|
"""
|
||||||
Email report(s) of various Tempmon data problems
|
Email report(s) of various Tempmon data problems
|
||||||
"""
|
"""
|
||||||
name = 'tempmon-problems'
|
from rattail_tempmon import problems
|
||||||
description = __doc__.strip()
|
|
||||||
|
|
||||||
def run(self, args):
|
config = ctx.parent.rattail_config
|
||||||
from rattail_tempmon import problems
|
progress = ctx.parent.rattail_progress
|
||||||
|
problems.disabled_probes(config, progress=progress)
|
||||||
|
|
||||||
problems.disabled_probes(self.config, progress=self.progress)
|
|
||||||
|
@rattail_typer.command()
|
||||||
|
def tempmon_server(
|
||||||
|
ctx: typer.Context,
|
||||||
|
action: Annotated[
|
||||||
|
ServiceAction,
|
||||||
|
typer.Argument(help="Action to perform for the service.")] = ...,
|
||||||
|
pidfile: Annotated[
|
||||||
|
Path,
|
||||||
|
typer.Option('--pidfile', '-p',
|
||||||
|
help="Path to PID file.")] = None,
|
||||||
|
# TODO: deprecate / remove this
|
||||||
|
daemonize: Annotated[
|
||||||
|
bool,
|
||||||
|
typer.Option('--daemonize',
|
||||||
|
help="Daemonize when starting.")] = False,
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Manage the tempmon-server daemon
|
||||||
|
"""
|
||||||
|
from rattail_tempmon.server import make_daemon
|
||||||
|
|
||||||
|
config = ctx.parent.rattail_config
|
||||||
|
daemon = make_daemon(config, pidfile)
|
||||||
|
if action == 'start':
|
||||||
|
daemon.start(daemonize)
|
||||||
|
elif action == 'stop':
|
||||||
|
daemon.stop()
|
||||||
|
|
||||||
|
|
||||||
|
def do_purge(config, keep_days, dry_run=False, progress=None):
|
||||||
|
from rattail_tempmon.db import Session, model
|
||||||
|
from rattail.db.util import finalize_session
|
||||||
|
|
||||||
|
app = config.get_app()
|
||||||
|
cutoff = app.today() - datetime.timedelta(days=keep_days)
|
||||||
|
cutoff = app.localtime(datetime.datetime.combine(cutoff, datetime.time(0)))
|
||||||
|
session = Session()
|
||||||
|
|
||||||
|
readings = session.query(model.Reading)\
|
||||||
|
.filter(model.Reading.taken < app.make_utc(cutoff))\
|
||||||
|
.all()
|
||||||
|
|
||||||
|
def purge(reading, i):
|
||||||
|
session.delete(reading)
|
||||||
|
if i % 200 == 0:
|
||||||
|
session.flush()
|
||||||
|
|
||||||
|
app.progress_loop(purge, readings, progress,
|
||||||
|
message="Purging stale readings")
|
||||||
|
log.info("deleted %s stale readings", len(readings))
|
||||||
|
finalize_session(session, dry_run=dry_run)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8; -*-
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2017 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -24,14 +24,13 @@
|
||||||
Tempmon config extension
|
Tempmon config extension
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals, absolute_import
|
from wuttjamaican.db import get_engines
|
||||||
|
from wuttjamaican.conf import WuttaConfigExtension
|
||||||
|
|
||||||
from rattail.config import ConfigExtension
|
|
||||||
from rattail.db.config import get_engines
|
|
||||||
from rattail_tempmon.db import Session
|
from rattail_tempmon.db import Session
|
||||||
|
|
||||||
|
|
||||||
class TempmonConfigExtension(ConfigExtension):
|
class TempmonConfigExtension(WuttaConfigExtension):
|
||||||
"""
|
"""
|
||||||
Config extension for tempmon; adds tempmon DB engine/Session etc. Expects
|
Config extension for tempmon; adds tempmon DB engine/Session etc. Expects
|
||||||
something like this in your config:
|
something like this in your config:
|
||||||
|
@ -53,10 +52,10 @@ class TempmonConfigExtension(ConfigExtension):
|
||||||
def configure(self, config):
|
def configure(self, config):
|
||||||
|
|
||||||
# tempmon
|
# tempmon
|
||||||
config.tempmon_engines = get_engines(config, section='rattail_tempmon.db')
|
config.tempmon_engines = get_engines(config, 'rattail_tempmon.db')
|
||||||
config.tempmon_engine = config.tempmon_engines.get('default')
|
config.tempmon_engine = config.tempmon_engines.get('default')
|
||||||
Session.configure(bind=config.tempmon_engine)
|
Session.configure(bind=config.tempmon_engine)
|
||||||
|
|
||||||
# hotcooler
|
# hotcooler
|
||||||
config.hotcooler_engines = get_engines(config, section='hotcooler.db')
|
config.hotcooler_engines = get_engines(config, 'hotcooler.db')
|
||||||
config.hotcooler_engine = config.hotcooler_engines.get('default')
|
config.hotcooler_engine = config.hotcooler_engines.get('default')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2018 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -24,13 +24,10 @@
|
||||||
Tempmon server daemon
|
Tempmon server daemon
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals, absolute_import
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import six
|
|
||||||
import humanize
|
import humanize
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
from sqlalchemy.exc import OperationalError
|
from sqlalchemy.exc import OperationalError
|
||||||
|
@ -91,7 +88,7 @@ class TempmonServerDaemon(Daemon):
|
||||||
# first time after DB stop. but in the case of DB stop,
|
# first time after DB stop. but in the case of DB stop,
|
||||||
# subsequent errors will instead match the second test
|
# subsequent errors will instead match the second test
|
||||||
if error.connection_invalidated or (
|
if error.connection_invalidated or (
|
||||||
'could not connect to server: Connection refused' in six.text_type(error)):
|
'could not connect to server: Connection refused' in str(error)):
|
||||||
|
|
||||||
# only suppress logging for 3 failures, after that we let them go
|
# only suppress logging for 3 failures, after that we let them go
|
||||||
# TODO: should make the max attempts configurable
|
# TODO: should make the max attempts configurable
|
||||||
|
@ -99,7 +96,7 @@ class TempmonServerDaemon(Daemon):
|
||||||
log_error = False
|
log_error = False
|
||||||
log.debug("database connection failure #%s: %s",
|
log.debug("database connection failure #%s: %s",
|
||||||
self.failed_checks,
|
self.failed_checks,
|
||||||
six.text_type(error))
|
str(error))
|
||||||
|
|
||||||
# send error email unless we're suppressing it for now
|
# send error email unless we're suppressing it for now
|
||||||
if log_error:
|
if log_error:
|
||||||
|
|
47
setup.cfg
47
setup.cfg
|
@ -1,47 +0,0 @@
|
||||||
# -*- coding: utf-8; -*-
|
|
||||||
|
|
||||||
[metadata]
|
|
||||||
name = rattail-tempmon
|
|
||||||
version = attr: rattail_tempmon.__version__
|
|
||||||
author = Lance Edgar
|
|
||||||
author_email = lance@edbob.org
|
|
||||||
url = https://rattailproject.org/
|
|
||||||
license = GNU GPL v3
|
|
||||||
description = Retail Software Framework - Temperature monitoring add-on
|
|
||||||
long_description = file: README.rst
|
|
||||||
classifiers =
|
|
||||||
Development Status :: 3 - Alpha
|
|
||||||
Intended Audience :: Developers
|
|
||||||
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
||||||
Natural Language :: English
|
|
||||||
Operating System :: OS Independent
|
|
||||||
Programming Language :: Python
|
|
||||||
Programming Language :: Python :: 3
|
|
||||||
Topic :: Office/Business
|
|
||||||
Topic :: Software Development :: Libraries :: Python Modules
|
|
||||||
|
|
||||||
|
|
||||||
[options]
|
|
||||||
install_requires =
|
|
||||||
rattail[db]
|
|
||||||
six
|
|
||||||
sqlsoup
|
|
||||||
|
|
||||||
packages = find:
|
|
||||||
include_package_data = True
|
|
||||||
|
|
||||||
|
|
||||||
[options.entry_points]
|
|
||||||
|
|
||||||
rattail.subcommands =
|
|
||||||
export-hotcooler = rattail_tempmon.commands:ExportHotCooler
|
|
||||||
purge-tempmon = rattail_tempmon.commands:PurgeTempmon
|
|
||||||
tempmon-client = rattail_tempmon.commands:TempmonClient
|
|
||||||
tempmon-problems = rattail_tempmon.commands:TempmonProblems
|
|
||||||
tempmon-server = rattail_tempmon.commands:TempmonServer
|
|
||||||
|
|
||||||
rattail.config.extensions =
|
|
||||||
tempmon = rattail_tempmon.config:TempmonConfigExtension
|
|
||||||
|
|
||||||
rattail.emails =
|
|
||||||
rattail_tempmon = rattail_tempmon.emails
|
|
29
setup.py
29
setup.py
|
@ -1,29 +0,0 @@
|
||||||
# -*- coding: utf-8; -*-
|
|
||||||
################################################################################
|
|
||||||
#
|
|
||||||
# Rattail -- Retail Software Framework
|
|
||||||
# Copyright © 2010-2023 Lance Edgar
|
|
||||||
#
|
|
||||||
# This file is part of Rattail.
|
|
||||||
#
|
|
||||||
# Rattail is free software: you can redistribute it and/or modify it under the
|
|
||||||
# terms of the GNU General Public License as published by the Free Software
|
|
||||||
# Foundation, either version 3 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
#
|
|
||||||
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
# details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with
|
|
||||||
# Rattail. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
################################################################################
|
|
||||||
"""
|
|
||||||
setup script for rattail-tempmon
|
|
||||||
"""
|
|
||||||
|
|
||||||
from setuptools import setup
|
|
||||||
|
|
||||||
setup()
|
|
10
tasks.py
10
tasks.py
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2023 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -30,16 +30,14 @@ import shutil
|
||||||
from invoke import task
|
from invoke import task
|
||||||
|
|
||||||
|
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
exec(open(os.path.join(here, 'rattail_tempmon', '_version.py')).read())
|
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def release(c):
|
def release(c):
|
||||||
"""
|
"""
|
||||||
Release a new version of `rattail-tempmon`
|
Release a new version of `rattail-tempmon`
|
||||||
"""
|
"""
|
||||||
|
if os.path.exists('dist'):
|
||||||
|
shutil.rmtree('dist')
|
||||||
if os.path.exists('rattail_tempmon.egg-info'):
|
if os.path.exists('rattail_tempmon.egg-info'):
|
||||||
shutil.rmtree('rattail_tempmon.egg-info')
|
shutil.rmtree('rattail_tempmon.egg-info')
|
||||||
c.run('python -m build --sdist')
|
c.run('python -m build --sdist')
|
||||||
c.run('twine upload dist/rattail-tempmon-{}.tar.gz'.format(__version__))
|
c.run('twine upload dist/*')
|
||||||
|
|
Loading…
Reference in a new issue