Opened 12 years ago

Closed 8 years ago

#884 defect closed duplicate (duplicate)

[NEED HELP] application howto has no example of writing a custom service

Reported by: itamarst Owned by:
Priority: high Milestone:
Component: core Keywords: documentation
Cc: Jean-Paul Calderone, itamarst Branch:


Change History (10)

comment:1 Changed 12 years ago by itamarst

This is a very basic piece of information that ought to be there.

comment:2 Changed 12 years ago by hypatia

See also bug 633, although they aren't exactly the same. I think the current
problem is that I don't understand Services at all: I regard them purely as
boilerplate. So there's a learning curve before I can do the doc.

But I'll look at it as soon as I've finished looking at the problem of replacing
all the components stuff with z.i

comment:3 Changed 12 years ago by hypatia

I need examples of custom services to be able to write this document, the
twisted code base is quite bare of them.

Why would I write a custom service?

comment:4 Changed 12 years ago by Jean-Paul Calderone

Services are for two things.

In terms of what the code actually enforces/provides, they give you start up and
shut down notifications, giving your application a chance to do
initialization-type things and cleanup-type things.  They can also delay the
completion of certain state transitions in the reactor.  For example, deferreds
returned from stopService block application shutdown until they are fired.

In terms of high-level conceptual importance, services are a protocol-agnostic
place to hang your application data (or methods for accessing your application
data).  This is convention, though.  No code enforces or even suggests this use.

Hopefully the description of these features suggests some possible use-cases for
services.  If not, I'll try to write more on the topic.

comment:5 Changed 12 years ago by hypatia

Thanks for the help. I think after that the best thing would be examples: radix
says there's some in the Quotient source?

comment:6 Changed 12 years ago by Jean-Paul Calderone

exarkun@boson:~/Projects/svn/Quotient/trunk$ find -name '*.py' | xargs grep -E
'class (.*?)Service'
./atop/test/ StoreService(Storeup):
./atop/test/ Service(unittest.TestCase):
./atop/ StrongCache(service.Service):
./atop/ StorageService(service.Service):
./atop/ ServicePool(store.Pool):
./atop/ Serviceup(powerup.Storeup):
./atop/ HotshotProfilerService(service.Service):
./atop/ SignalService(service.Service):
./atop/ AdapterRegistrationService(service.Service):
./quotient/test/webtest/ SekritAgent(pb.Root, Service):
./quotient/test/webtest/ SekritService(Service):
./quotient/test/ BogusService(object):
./quotient/test/ BogusIndexer(BogusService):
./quotient/test/ TestIndexerService(unittest.TestCase):
./quotient/test/ IndexerServiceTestCase(unittest.TestCase):
./quotient/proto/ STUNService(internet.UDPServer):
./quotient/ StatLogger(service.Service):
./quotient/ IndexerService(service.MultiService):
./quotient/ StdioPBService(service.Service):
./quotient/ QuotientService(MantissaService):
./mantissa/test/ Serv(deployment.DependencyService):
./mantissa/ Q2QService(service.Service):
./mantissa/ DependencyService(service.MultiService):
./mantissa/ MantissaService(DependencyService):

Not sure which of these make great examples, though.  svn is browseable via http
at <>, but viewcvs is so slow it'd probably be less
painful to do a checkout and browse locally.

comment:7 Changed 11 years ago by hypatia

Cc: hypatia removed
Component: conch
Owner: changed from hypatia to edsuom

comment:8 Changed 11 years ago by Jean-Paul Calderone

Component: conchcore
Keywords: core removed

comment:9 Changed 8 years ago by Thijs Triemstra

Resolution: duplicate
Status: newclosed

Duplicate of #375

comment:10 Changed 6 years ago by <automation>

Owner: edsuom deleted
Note: See TracTickets for help on using tickets.