TileStache.Goodies.StatusServer | index

`StatusServer is a replacement for WSGITileServer that saves per-process
events to Redis and displays them in a chronological stream at /status.
The internal behaviors of a running WSGI server can be hard to inspect,
and StatusServer is designed to output data relevant to tile serving out
to Redis where it can be gathered and inspected.
Example usage, with gunicorn (http://gunicorn.org):
gunicorn --bind localhost:8888 "TileStache.Goodies.StatusServer:WSGIServer('tilestache.cfg')"
Example output, showing vertical alignment based on process ID:
13235 Attempted cache lock, 2 minutes ago
13235 Got cache lock in 0.001 seconds, 2 minutes ago
13235 Started /osm/15/5255/12664.png, 2 minutes ago
13235 Finished /osm/15/5255/12663.png in 0.724 seconds, 2 minutes ago
13233 Got cache lock in 0.001 seconds, 2 minutes ago
13233 Attempted cache lock, 2 minutes ago
13233 Started /osm/15/5249/12664.png, 2 minutes ago
13233 Finished /osm/15/5255/12661.png in 0.776 seconds, 2 minutes ago
13234 Got cache lock in 0.001 seconds, 2 minutes ago
13234 Attempted cache lock, 2 minutes ago
13234 Started /osm/15/5254/12664.png, 2 minutes ago
13234 Finished /osm/15/5249/12663.png in 0.466 seconds, 2 minutes ago
13235 Attempted cache lock, 2 minutes ago
13235 Got cache lock in 0.001 seconds, 2 minutes ago
13235 Started /osm/15/5255/12663.png, 2 minutes ago
13235 Finished /osm/15/5250/12664.png in 0.502 seconds, 2 minutes ago
13233 Got cache lock in 0.001 seconds, 2 minutes ago
13233 Attempted cache lock, 2 minutes ago
13233 Started /osm/15/5255/12661.png, 2 minutes ago`

Modules

``

TileStache |  |  |

Classes

``

TileStache.WSGITileServer
  WSGIServer
CacheWrap

class CacheWrap
`` | `Wraps up a TileStache cache object and reports events to Redis. Implements a cache provider: http://tilestache.org/doc/#custom-caches.`

Methods defined here:

__init__(self, cache, redis_kwargs)

lock(self, layer, coord, format)

read(self, layer, coord, format)

remove(self, layer, coord, format)

save(self, body, layer, coord, format)

unlock(self, layer, coord, format)

class WSGIServer(TileStache.WSGITileServer)
`` | `Create a WSGI application that can handle requests from any server that talks WSGI. Notable moments in the tile-making process such as time elapsed or cache lock events are sent as messages to Redis. Inherits the constructor from TileStache WSGI, which just loads a TileStache configuration file into self.config.`

Methods defined here:

__call__(self, environ, start_response)

__del__(self)

__init__(self, config, redis_host='localhost', redis_port=6379)

Functions

``

delete_statuses(pid, **redis_kwargs)

get_recent(**redis_kwargs)
  `Retrieve recent messages from Redis, in reverse chronological order.
  Two lists are returned: one a single most-recent status message from
  each process, the other a list of numerous messages from each process.
  Each message is a tuple with floating point seconds elapsed, integer
  process ID that created it, and an associated text message such as
  "Got cache lock in 0.001 seconds" or "Started /osm/12/656/1582.png".
  Keyword args are passed directly to redis.StrictRedis().`

getpid(...)
  `getpid() -> pid
  Return the current process id`

md5 = openssl_md5(...)
  `Returns a md5 hash object; optionally initialized with a string`

nice_time(time)
  `Format a time in seconds to a string like "5 minutes".`

pid_indent(pid)
  `Get an MD5-based indentation for a process ID.`

status_response(**redis_kwargs)
  `Retrieve recent messages from Redis and`

time(...)
  `time() -> floating point number
  Return the current time in seconds since the Epoch.
  Fractions of a second may be present if the system clock provides them.`

update_status(msg, **redis_kwargs)
  `Updated Redis with a message, prefix it with the current timestamp.
  Keyword args are passed directly to redis.StrictRedis().`