Many people evidently want a proposal for a “service” interface, and saw part of what they wanted in the separate discussion of the “Standard daemon process library”. As discussed there, a Unix daemon is a quite distinct, yet complementary, concept to a service.
This is a skeleton of a PEP, presented in order that discussion of what people want from a “service” has a concrete focus. The specification is based on work from Trent Nelson.
Note that I'm *not* intending to propose, implement, or champion this PEP. I present it as is because there is a clear desire to see something like it, and in the hope that those with more enthusiasm for it can take it and improve on it to the point where it gets a champion.
:PEP: XXX :Title: Background process services :Version: 0.1 :Last-Modified: 2009-01-30 16:40 :Author: Ben Finney firstname.lastname@example.org :Status: Draft :Type: Standards Track :Content-Type: text/x-rst :Created: 2009-01-30 :Python-Version: 3.1 :Post-History:
======== Abstract ========
This PEP introduces a package to the Python standard library that provides an interface to the task of creating a separate background process, and maintaining an ongoing service channel with that process.
.. contents:: .. Table of Contents: Abstract Specification Interface ``Service`` objects Motivation Rationale Reference Implementation References Copyright
============= Specification =============
A new package, `service`, is added to the standard library.
The package defines a class, `Service`, used to set up and maintain the service.
``Service`` objects ===================
A `Service` instance represents a control channel to a separate, background process that runs concurrently with the existing program. The existing program communicates with that background process via the corresponding `Service` instance.
`__init__(self, func, name, desc=None, startup_type=StartupType.Auto)` Initialises the parameters of a new service […]
The `func` argument is a callable, which will be called to run in the background process when the service is started.
`is_running()` Returns ``True`` if the background process is currently running […]
`is_installed()` Returns ``True`` if […]
`report_event(self, msg, event_type, id, category, data)` […]
`start()` Start a new background process running the `func` callable […]
* On Unix, this creates a new daemon process.
* On MacOS, […].
* On MS Windows, […].
`stop()` Stop the background process […]
========== Motivation ==========
========= Rationale =========
======================== Reference Implementation ========================
========== References ==========
========= Copyright =========
This work is hereby placed in the public domain. To the extent that placing a work in the public domain is not legally possible, the copyright holder hereby grants to all recipients of this work all rights and freedoms that would otherwise be restricted by copyright.
.. Local variables: mode: rst coding: utf-8 time-stamp-start: "^:Last-Modified:[ ]+" time-stamp-end: "$" time-stamp-line-limit: 20 time-stamp-format: "%:y-%02m-%02d %02H:%02M" End: vim: filetype=rst fileencoding=utf-8 :