~ubuntu-branches/ubuntu/oneiric/pyro/oneiric

« back to all changes in this revision

Viewing changes to examples/distributed-computing/client.py

  • Committer: Bazaar Package Importer
  • Author(s): Bernd Zeimetz
  • Date: 2007-09-01 23:12:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070901231252-veufo1dqva5oipo1
Tags: 3.7-1
* Adopting the package in the name of the Python Modules Team
  (Closes: #439048)
  - Thanks to Alexandre Fayolle and Jérémy Bobbio for the previous NMUs
    (Closes: #216731, #377680, #391808)
* New upstream version
* debian/watch:
  - Adding file
* debian/control:
  - Reflecting maintainer change
  - Adding XS-Vcs-Svn and XS-Vcs-Browser fields
  - Moving python to Build-Depends because it's used in the clean target
  - Adding dpatch to Build-Depends
  - Putting pyro-doc into the doc Section
* debian/semantic.cache:
  - Removing file, not needed for packaging pyro
* debian/setup.cfg:
  - Adding file to configure upstream's very special setup.py
* debian/rules:
  - Fixing build process to use debian/setup.cfg
  - Adding dpatch targets/include
* debian/README.Debian:
  - Removing file, explanation not needed anymore
* debian/NEWS.Debian:
  - Adding file, explaining upstream's change in the script names
* debian/patches:
  - Adding patch to cleanup/fix shebangs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import Pyro.core
2
2
import Pyro.errors
3
 
from tasks import md5crack
4
 
from tasks import sorting
 
3
import Pyro.util
 
4
import tasks.md5crack
 
5
import tasks.sorting
5
6
import time
6
7
 
7
8
 
12
13
selected_task = raw_input("What task do you want to run (md5 or sorting; m/s): ")
13
14
 
14
15
if selected_task in ('m','md5'):
15
 
        UIClass = md5crack.UserInterface
16
 
        TaskClass = md5crack.CrackTask
 
16
        UIClass = tasks.md5crack.UserInterface
 
17
        TaskClass = tasks.md5crack.CrackTask
17
18
elif selected_task in ('s','sorting'):
18
 
        UIClass = sorting.UserInterface
19
 
        TaskClass = sorting.SortTask
 
19
        UIClass = tasks.sorting.UserInterface
 
20
        TaskClass = tasks.sorting.SortTask
20
21
else:
21
22
        raise ValueError("invalid task chosen")
22
23
                
45
46
        print "(using distributed parallel processing)"
46
47
        dispatcher = Pyro.core.getProxyForURI("PYRONAME://:Distributed.Dispatcher")
47
48
        start=time.time()
48
 
        result=dispatcher.process(task)        # the interesting stuff happens here :)
 
49
        try:
 
50
                result=dispatcher.process(task)        # the interesting stuff happens here :)
 
51
        except Exception,x:
 
52
                print "".join(Pyro.util.getPyroTraceback(x))
49
53
        duration=time.time()-start
50
54
                
51
55
ui.result(result)