~justin-fathomdb/nova/justinsb-openstack-api-volumes

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/doc/core/howto/basics.html

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html  PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'  'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
 
2
  <head>
 
3
<title>Twisted Documentation: The Basics</title>
 
4
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
 
5
  </head>
 
6
 
 
7
  <body bgcolor="white">
 
8
    <h1 class="title">The Basics</h1>
 
9
    <div class="toc"><ol><li><a href="#auto0">Application</a></li><li><a href="#auto1">twistd</a></li><li><a href="#auto2">tap2deb</a></li><li><a href="#auto3">tap2rpm</a></li></ol></div>
 
10
    <div class="content">
 
11
<span/>
 
12
 
 
13
<h2>Application<a name="auto0"/></h2>
 
14
 
 
15
<p>Twisted programs usually work with
 
16
<code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.application.service.Application.html" title="twisted.application.service.Application">twisted.application.service.Application</a></code>.
 
17
This class usually holds all persistent configuration of
 
18
a running server -- ports to bind to, places where connections
 
19
to must be kept or attempted, periodic actions to do and almost
 
20
everything else. It is the root object in a tree of services implementing
 
21
<code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.application.service.IService.html" title="twisted.application.service.IService">IService</a></code>.</p>
 
22
 
 
23
<p>Other HOWTOs describe how to write custom code for Applications,
 
24
but this one describes how to use already written code (which can be
 
25
part of Twisted or from a third-party Twisted plugin developer).  The
 
26
Twisted distribution comes with an important tool to deal with
 
27
Applications, <code>twistd</code>.</p>
 
28
 
 
29
<p><code>Application</code>s are just Python objects, which can
 
30
be created and manipulated in the same ways as any other object.
 
31
</p>
 
32
 
 
33
<h2>twistd<a name="auto1"/></h2><a name="twistd" shape="rect"/>
 
34
 
 
35
<p>The Twisted Daemon is a program that knows how to run Applications.
 
36
This program
 
37
is <code class="shell">twistd(1)</code>.  Strictly
 
38
speaking, <code class="shell">twistd</code> is not necessary --
 
39
fetching the application, getting the <code>IService</code> component,
 
40
calling <code>startService</code>, scheduling <code>stopService</code> when
 
41
the reactor shuts down, and then calling <code>reactor.run()</code> could be
 
42
done manually. <code class="shell">twistd(1)</code>, however, supplies 
 
43
many options which are highly useful for program set up.</p>
 
44
 
 
45
<p><code class="shell">twistd</code> supports choosing a reactor (for more on
 
46
reactors, see <a href="choosing-reactor.html" shape="rect">Choosing a Reactor</a>), logging
 
47
to a logfile, daemonizing and more. <code class="shell">twistd</code> supports all
 
48
Applications mentioned above -- and an additional one. Sometimes
 
49
it is convenient to write the code for building a class in straight
 
50
Python. One big source of such Python files is the <code>doc/examples</code>
 
51
directory. When a straight Python file which defines an <code>Application</code>
 
52
object called <code>application</code> is used, use the <code class="shell">-y</code>
 
53
option.</p>
 
54
 
 
55
<p>When <code class="shell">twistd</code> runs, it records its process id in a
 
56
<code>twistd.pid</code> file (this can be configured via a command line
 
57
switch). In order to shutdown the <code class="shell">twistd</code> process, kill that
 
58
pid (usually you would do <code class="shell">kill `cat twistd.pid`</code>).
 
59
</p>
 
60
 
 
61
<p>As always, the gory details are in the manual page.</p>
 
62
 
 
63
<h2>tap2deb<a name="auto2"/></h2>
 
64
 
 
65
<p>
 
66
For Twisted-based server application developers who want to deploy on
 
67
Debian, Twisted supplies the <code class="shell">tap2deb</code> program. This program
 
68
wraps a Twisted Application file (of any of the supported formats -- Python,
 
69
source, xml or pickle)
 
70
in a Debian package, including correct installation and removal scripts
 
71
and <code>init.d</code> scripts. This frees the installer from manually
 
72
stopping or starting the service, and will make sure it goes properly up
 
73
on startup and down on shutdown and that it obeys the init levels.
 
74
</p>
 
75
 
 
76
<p>
 
77
For the more savvy Debian users, the
 
78
<code class="shell">tap2deb</code> also generates the source package, allowing her
 
79
to modify and polish things which automated software cannot detect
 
80
(such as dependencies or relationships to virtual packages). In addition,
 
81
the Twisted team itself intends to produce Debian packages for some common
 
82
services, such as web servers and an inetd replacement. Those packages
 
83
will enjoy the best of all worlds -- both the consistency which comes
 
84
from being based on the <code class="shell">tap2deb</code> and the delicate manual
 
85
tweaking of a Debian maintainer, insuring perfect integration with
 
86
Debian.
 
87
</p>
 
88
 
 
89
<h2>tap2rpm<a name="auto3"/></h2>
 
90
 
 
91
<p><code class="shell">tap2rpm</code> is similar to <code class="shell">tap2deb</code>, except that
 
92
it generates RPMs for Redhat and other related platforms.</p>
 
93
 
 
94
</div>
 
95
 
 
96
    <p><a href="index.html">Index</a></p>
 
97
    <span class="version">Version: 10.0.0</span>
 
98
  </body>
 
99
</html>
 
 
b'\\ No newline at end of file'