Opened 10 years ago

Closed 6 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: exarkun, itamarst Branch:
Author: Launchpad Bug:

Description


Change History (10)

comment:1 Changed 10 years ago by itamarst

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

comment:2 Changed 10 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 10 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 10 years ago by exarkun

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 10 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 10 years ago by exarkun

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

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

comment:7 Changed 9 years ago by hypatia

  • Cc hypatia removed
  • Component set to conch
  • Owner changed from hypatia to edsuom

comment:8 Changed 9 years ago by exarkun

  • Component changed from conch to core
  • Keywords core removed

comment:9 Changed 6 years ago by thijs

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #375

comment:10 Changed 4 years ago by <automation>

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