Changes between Initial Version and Version 1 of PythonAppDev


Ignore:
Timestamp:
Sep 20, 2007, 7:53:01 AM (17 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PythonAppDev

    v1 v1  
     1= PyBOINC: simplified BOINC application development in Python (design doc) =
     2
     3This is a proposed design for making developing
     4BOINC applications as simple as possible.
     5PyBOINC provides a master/slave model:
     6the master runs on the server, and the slave is distributed.
     7
     8Here's an example, which sums the squares of integers from 1 to 100.
     9The application consists of three files.
     10The first, '''app_types.py''', defines the input and output types:
     11{{{
     12class Input:
     13    def __init__(self, arg):
     14        self.value = arg
     15
     16class Output:
     17    def __init__(self, arg):
     18        self.value = arg;
     19}}}
     20
     21The second file, '''app_master.py''', is the master program:
     22{{{
     23import app_types
     24
     25def make_calls():
     26    for i in range(100):
     27       input = Input(i);
     28       pyboinc_call('app_slave.py', input)
     29
     30def handle_result(output):
     31    sum += output.value
     32
     33sum = 0
     34
     35pyboinc_master(make_calls, handle_result)
     36
     37print "The answer is %d", sum
     38}}}
     39
     40The third file, '''pyboinc_slave.py''', is the slave function:
     41
     42{{{
     43import app_types
     44
     45input = pyboinc_get_input()
     46output = Output(input.value*input.value);
     47pyboinc_return_output(output);
     48}}}