Skip to main content

Installation

pip install noseapp_daemon

Create Runner

from noseapp.ext.daemon import DaemonRunner

class MyPythonDaemon(DaemonRunner):

    CMD_PREFIX = 'python'
    DAEMON_BIN = '/path/to/daemon/daemon.py'


my_daemon = MyPythonDaemon('my_daemon')
my_daemon.add_cmd_option('-c', '/path/to/config')
my_daemon.start()

Create daemon plugin

from noseapp.ext.daemon import DaemonPlugin


class MyPythonDaemonPlugin(DaemonPlugin):

    def init(self, daemon):
        # do something

    def before_start(self, daemon):
        # do something

    def after_start(self, daemon):
        # do something

    def before_stop(self, daemon):
        # do something

    def after_stop(self, daemon):
        # do something


my_daemon = MyPythonDaemon('my_daemon', plugin=MyPythonDaemonPlugin())

Create Service

from noseapp.ext.daemon import DaemonService

class MyDaemonService(DaemonService):

  name = 'my_service'

  def setup(self):
      self.daemon = MyPythonDaemon('my_daemon')

  def start(self):
      self.daemon.start()

  def stop(self):
      self.daemon.stop()

  ...


service = MyDaemonService()
service.start()
service.restart()

Create Management

from noseapp.ext.daemon import DaemonManagement

management = DaemonManagement(app)
management.add_daemon(
    MyPythonDaemon('my_daemon', plugin=MyPythonDaemonPlugin()),
)
daemon = management.daemon('my_daemon')

def error_handler(daemon, e):
    # do something

with management.checkout_daemon('my_daemon', except_exc=Exception, error_handler=error_handler) as daemon:
    daemon.restart()

management.add_service(MyDaemonService())
service = management.service('my_service')

# to install as extension
management.install(app)

suite = Suite(__name__, require=['my_daemon'])

# management.stop_all()
# management.stop_daemons()
# management.stop_services()
# management.restart_all()
# etc ...

Presets

noseapp.ext.daemon.presets import NGINXDaemon
noseapp.ext.daemon.presets import UWSGIDaemon
...


nginx = NGINXDaemon()
uwsgi = UWSGIDaemon()

nginx.add_cmd_option('-c', '/path/to/config')
uwsgi.add_dmd_option('--ini', '/path/to/config')

nginx.start()
uwsgi.start()
...

Metadata

Release files for noseapp_daemon 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for noseapp_daemon 2.3.0
File Size Uploaded Provenance
noseapp_daemon-2.3.0.tar.gz 7.8 kB Without provenance Details

Release files / noseapp_daemon-2.3.0.tar.gz

Download URL noseapp_daemon-2.3.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b56864e3c7511c366329b34e72e9551d996f0baab942938c0374667187519ccd
BLAKE2b-256 checksum
How to use checksums
bb1ccdfa8dcb71187f3756f34f0df77a989b1b16ca91a770e8407711e0774c81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for noseapp_daemon 2.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page