Package schrodinger :: Package application :: Package glide :: Module http_server
[hide private]
[frames] | no frames]

Module http_server

Glide HTTP Server

This module implements the functions necessary to turn Glide into a persistent
HTTP server that accepts ligands via POST requests and sends the poses back.

To use, just add the following lines to a Glide input file:

    CLIENT_MODULE schrodinger.application.glide.http_server
    CLIENT_OPTIONS "host=localhost; port=8000"

The server may then be tested using a web browser by opening
http://localhost:8000/. For programmatic access, see
schrodinger.application.glide.http_client.py.

The server responds to the following paths:

    /               a form that can be used for testing from a browser
    /shutdown       break out of the ligand loop and terminate
    /dock_ligand    POST a ligand and get the poses back

NOTE: the server is single-threaded, single-process, hence it's not designed to
accept concurrent connections. While Glide is busy docking a ligand, the
server won't be accepting connections. This server is meant for uses where
there is a single client that only needs to do one ligand at a time!

Classes [hide private]
  GlideHTTPHandler
This class, derived from BaseHTTPRequestHandler, implements the do_GET and do_POST methods.
  GlideHTTPServer
This is a variant on HTTPServer that doesn't shut down requests immediately, but keeps them around until glide_shutdown_request is called.
Functions [hide private]
 
start(options)
Start the HTTP server.
 
pull_ligand()
Wait until someone POSTs a ligand and return its mmct handle.
 
push_ligand(poses, msg)
Sent the HTTP response as an m2io file of docked poses.
 
stop()
Delete the HTTP server object and stop listening.
Variables [hide private]
  DEFAULT_FORM = '\n<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01...
  httpd = None
hash(x)
  __package__ = 'schrodinger.application.glide'
Function Details [hide private]

start(options)

 

Start the HTTP server. Takes a string as an argument that may specify the host and port as, for example, "host=localhost; port=8000; timeout=0". These are in fact the default values. To accept connections from remote hosts, set host to an empty string (i.e., "host="). If the timeout value is greater than zero, pull_ligand will return -1, indicating no more ligands, after waiting for that time in seconds.

pull_ligand()

 

Wait until someone POSTs a ligand and return its mmct handle. If we were asked to shut down by the client, return -1.

push_ligand(poses, msg)

 

Sent the HTTP response as an m2io file of docked poses. Takes an array of mmct handles and an error message (the latter is currently unused.)


Variables Details [hide private]

DEFAULT_FORM

Value:
'''
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <title>Glide HTTP server test form</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-88\
...