Skip to main content

Persistent filesystem based flags for state and control.

Project description

Filesystem visible boolean flags for control and status, allowing easy monitoring of services or other status, and control by flag management for programmes which also monitor the flags.

The flags are expressed as individual files with uppercase names in a common directory ($HOME/var/flags by default); an empty or missing file is “false” and a nonempty file is “true”.

The Flags class provides easy Pythonic access to this directory. It presents as a modifiable mapping whose keys are the flag names:

flags = Flags()
flags['UNTOPPOST'] = True

The is also a FlaggedMixin class providing convenient methods and attributes for maintaining a collection of flags associated with some object with flag names prefixed by the object’s .name attribute uppercased and with an underscore appended:

class SvcD(...,FlaggedMixin):
  def __init__(self, name, ...)
    self.name = name
    FlaggedMixin.__init__(self)
    ...
  def disable(self):
    self.flag_disabled = True
  def restart(self):
    self.flag_restart = True
  def _restart(self):
    self.flag_restart = False
    ... restart the SvcD ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
cs.app.flag-20170906.2.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None Sep 6, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page