gavo.user.serve module

A wrapper script suitable for starting the server.

class gavo.user.serve.ExitPage[source]

Bases: Resource

render(request)[source]

Render a given resource. See L{IResource}’s render method.

I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.

Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.

@see: L{IResource.render}

gavo.user.serve.daemonize(logFile, callable)[source]
gavo.user.serve.debug(args)[source]
gavo.user.serve.expireRDs(args)[source]
gavo.user.serve.getLogFile(baseName)[source]

returns a log file group-writable by gavo.

gavo.user.serve.main()[source]
gavo.user.serve.manageResourceLimits()[source]

raises some resource limits to their hard limits.

This is, in particular, the number of open FDs, as DaCHS may need a lot of those.

gavo.user.serve.reload(args)[source]
gavo.user.serve.restart(args)[source]
gavo.user.serve.setupServer(rootPage, runIntervalJobs=True)[source]

sets the process up for running a server.

This involves managing server resource limits, doing a notification, and, in particular, starting up the scheduler.

runIntervalJobs can be set to False to suppress running jobs that are probably maintenance jobs on a running instance and which would be unwelcome on debug instances.

gavo.user.serve.start(args)[source]
gavo.user.serve.stop(args)[source]
gavo.user.serve.updateCertificate(args)[source]
gavo.user.serve.waitForUnloadedServer(stopTimeout)[source]

delays while the service [web]serverURL appears to serve clients or stopTimeout seconds are over.

This will also return fine if no server is running. If the service keeps having clients after stopTimeout, a ReportableError is raised.