| 61 | |
| 62 | |
| 63 | == Implementation == |
| 64 | |
| 65 | PyBOINC uses the following files and subdirectories in the job directory: |
| 66 | |
| 67 | * pyboinc_checkpoint: If present, this contains a job ID |
| 68 | * new/: result files not yet handled |
| 69 | * old/: result files already handled |
| 70 | |
| 71 | Pseudocode for the various PyBOINC functions: |
| 72 | {{{ |
| 73 | static jobID |
| 74 | |
| 75 | pyboinc_call(slave_filename, input) |
| 76 | create a uniquely-named file x in the download hierarchy |
| 77 | Pickler(x).dump(input) |
| 78 | create_work() |
| 79 | |
| 80 | pyboinc_master(make_calls, handle_result) |
| 81 | read jobID from pyboinc_checkpoint |
| 82 | if none |
| 83 | create a batch record; jobID = its ID |
| 84 | make_calls() |
| 85 | write jobID to checkpoint file |
| 86 | move all files from old/ to new/ |
| 87 | while (not all jobs done) |
| 88 | if there is a file x in new/ |
| 89 | output = Pickler.load(x) |
| 90 | handle_result(output) |
| 91 | else |
| 92 | sleep(1) |
| 93 | |
| 94 | pyboinc_get_input() |
| 95 | boinc_resolve_filename("input", infile) |
| 96 | return Pickler.load(infile) |
| 97 | |
| 98 | pyboinc_return_output(output) |
| 99 | boinc_resolve_filename("output", outfile) |
| 100 | Pickler(outfile).dump(output) |