1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Author: Sandro Tosi <morph@debian.org>
Description: This patch removes the default password from pp code, requiring users to
explicitly write one; it updates the documentation along the source code
Index: parallelpython-1.6.2/doc/ppdoc.html
===================================================================
--- parallelpython-1.6.2.orig/doc/ppdoc.html 2012-06-03 09:39:09.000000000 +0200
+++ parallelpython-1.6.2/doc/ppdoc.html 2012-06-07 22:22:03.412216150 +0200
@@ -140,7 +140,7 @@
<table class="contentpaneopen">
<tr>
<td valign="top" colspan="2">
- <p> <a href="http://www.parallelpython.com/content/view/15/30/#API">Module API</a> <br /> <a href="http://www.parallelpython.com/content/view/15/30/#QUICKSMP">Quick start guide, SMP</a><br /> <a href="http://www.parallelpython.com/content/view/15/30/#QUICKCLUSTERS">Quick start guide, clusters<br /> </a><a href="http://www.parallelpython.com/content/view/15/30/#QUICKCLUSTERSAUTO">Quick start guide, clusters with auto-discovery</a><br /> <a href="http://www.parallelpython.com/content/view/15/30/#ADVANCEDCLUSTERS">Advanced guide, clusters</a><br /> <a href="http://www.parallelpython.com/content/view/15/30/#COMMANDLINE">Command line arguments, ppserver.py</a><br /> <a href="http://www.parallelpython.com/content/view/15/30/#SECURITY">Security and secret key</a><br /> <a href="component/option,com_smf/Itemid,29/topic,210.msg653#msg653" title="PP FAQ">PP FAQ</a> </p><hr /> <p> </p><h1 id="API"> pp 1.6.2 module API</h1> <p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section"> <tbody><tr bgcolor="#ffc8d8"> <td colspan="3" valign="bottom"> <br /> <font face="helvetica, arial" color="#000000"><a name="Server" title="Server"></a>class <strong>Server</strong></font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan="2"> </td> <td colspan="2">Parallel Python SMP execution server class<br /> </td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br /> <dl><dt><a name="Server-__init__" title="Server-__init__"></a><strong>__init__</strong>(self, ncpus<font color="#909090">='autodetect'</font>, ppservers<font color="#909090">=()</font>, secret<font color="#909090">=None</font>, restart<font color="#909090">=False</font>, proto<font color="#909090">=2</font>, socket_timeout<font color="#909090">=3600</font>)</dt><dd>Creates <a href="http://www.parallelpython.com/content/view/15/30/#Server">Server</a> instance<br /> </dd><dd> </dd><dd> </dd><dd> ncpus - the number of worker processes to start on the local <br /> computer, if parameter is omitted it will be set to <br /> the number of processors in the system<br /> ppservers - list of active parallel python execution servers <br /> to connect with<br /> secret - passphrase for network connections, if omitted a default<br /> passphrase will be used. It's highly recommended to use a <br /> custom passphrase for all network connections.<br /></dd><dd>restart - whether to restart worker process after each task completion <br /> proto - protocol number for pickle module</dd><dd>socket_timeout - socket timeout in seconds which is also the maximum <br /> time a remote job could be executed. Increase this value<br /> if you have long running jobs or decrease if connectivity<br /> to remote ppservers is often lost. <br /></dd><dd> <br /> With ncpus = 1 all tasks are executed consequently<br /> For the best performance either use the default "autodetect" value<br /> or set ncpus to the total number of processors in the system</dd></dl><dl><dt><a name="Server-destroy" title="Server-destroy"></a><strong>destroy</strong>(self)</dt><dd>Kills ppworkers and closes open files</dd></dl> <dl><dt><a name="Server-get_active_nodes" title="Server-get_active_nodes"></a><strong>get_active_nodes</strong>(self)</dt><dd>Returns active nodes as a dictionary <br /> [keys - nodes, values - ncpus]</dd></dl> <dl><dt><a name="Server-get_ncpus" title="Server-get_ncpus"></a><strong>get_ncpus</strong>(self)</dt><dd>Returns the number of local worker processes (ppworkers)</dd></dl> <dl><dt><a name="Server-get_stats" title="Server-get_stats"></a><strong>get_stats</strong>(self)</dt><dd>Returns job execution statistics as a dictionary</dd></dl><dl><dt><a name="Server-print_stats" title="Server-print_stats"></a><strong>print_stats</strong>(self)</dt><dd>Prints job execution statistics. Useful for benchmarking on <br /> clusters</dd></dl> <dl><dt><a name="Server-set_ncpus" title="Server-set_ncpus"></a><strong>set_ncpus</strong>(self, ncpus<font color="#909090">='autodetect'</font>)</dt><dd>Sets the number of local worker processes (ppworkers)<br /> <br /> ncpus - the number of worker processes, if parammeter is omitted<br /> it will be set to the number of processors in the system</dd></dl> <dl><dt><a name="Server-submit" title="Server-submit"></a><strong>submit</strong>(self, func, args<font color="#909090">=()</font>, depfuncs<font color="#909090">=()</font>, modules<font color="#909090">=()</font>, callback<font color="#909090">=None</font>, callbackargs<font color="#909090">=()</font>, group<font color="#909090">='default'</font>, globals<font color="#909090">=None</font>)</dt><dd>Submits function to the execution queue<br /> <br /> func - function to be executed<br /> args - tuple with arguments of the 'func'<br /> depfuncs - tuple with functions which might be called from 'func'<br /> modules - tuple with module names to import<br /> callback - callback function which will be called with argument <br /> list equal to callbackargs+(result,) <br /> as soon as calculation is done<br /> callbackargs - additional arguments for callback function<br /> group - job group, is used when <a href="http://www.parallelpython.com/content/view/15/30/#Server-wait">wait</a>(group) is called to wait for<br /> jobs in a given group to finish<br /> globals - dictionary from which all modules, functions and classes<br /> will be imported, for instance: globals=globals()</dd></dl> <dl><dt><a name="Server-wait" title="Server-wait"></a><strong>wait</strong>(self, group<font color="#909090">=None</font>)</dt><dd>Waits for all jobs in a given group to finish.<br /> If group is omitted waits for all jobs to finish</dd></dl> <dl><dt><strong>default_port</strong> = 60000</dt></dl> <dl><dt><strong>default_secret</strong> = 'epo20pdosl;dksldkmm'</dt></dl> </td></tr></tbody></table> </p><p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section"> <tbody><tr bgcolor="#ffc8d8"> <td colspan="3" valign="bottom"> <br /> <font face="helvetica, arial" color="#000000"><a name="Template" title="Template"></a>class <strong>Template</strong></font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan="2"> </td> <td colspan="2"><a href="http://www.parallelpython.com/content/view/15/30/#Template">Template</a> class<br /> </td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br /> <dl><dt><a name="Template-__init__" title="Template-__init__"></a><strong>__init__</strong>(self, job_server, func, depfuncs<font color="#909090">=()</font>, modules<font color="#909090">=()</font>, callback<font color="#909090">=None</font>, callbackargs<font color="#909090">=()</font>, group<font color="#909090">='default'</font>, globals<font color="#909090">=None</font>)</dt><dd>Creates <a href="http://www.parallelpython.com/content/view/15/30/#Template">Template</a> instance<br /> <br /> jobs_server - pp server for submitting jobs<br /> func - function to be executed<br /> depfuncs - tuple with functions which might be called from 'func'<br /> modules - tuple with module names to import<br /> callback - callback function which will be called with argument <br /> list equal to callbackargs+(result,) <br /> as soon as calculation is done<br /> callbackargs - additional arguments for callback function<br /> group - job group, is used when wait(group) is called to wait for<br /> jobs in a given group to finish<br /> globals - dictionary from which all modules, functions and classes<br /> will be imported, for instance: globals=globals()</dd></dl> <dl><dt><a name="Template-submit" title="Template-submit"></a><strong>submit</strong>(self, *args)</dt><dd>Submits function with *arg arguments to the execution queue</dd></dl> </td></tr></tbody></table></p><p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section"> <tbody><tr bgcolor="#55aa55"> <td colspan="3" valign="bottom"> <br /> <font face="helvetica, arial" color="#ffffff"><strong>Data</strong></font></td></tr> <tr><td bgcolor="#55aa55"> </td><td> </td> <td width="100%"><strong>copyright</strong> = 'Copyright (c) 2005-2012 Vitalii Vanovschi. All rights reserved'<br /> <strong>version</strong> = '1.6.2'</td></tr></tbody></table> </p><hr /><h1 id="QUICKSMP"> Quick start guide, SMP<br /></h1> <p>1) Import pp module:</p><p><strong> import pp</strong></p><p>2) Start pp execution server with the number of workers set to the number of processors in the system </p><p><strong> job_server = pp.Server() </strong></p><p>3) Submit all the tasks for parallel execution:</p><p><strong> f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong> f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong> f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p> ...etc...<br /></p><p>4) Retrieve the results as needed:</p><p><strong> r1 = f1()</strong></p><p><strong> r2 = f2()</strong></p><p><strong> r3 = f3() </strong> </p><p> ...etc...</p><p> To find out how to achieve efficient parallelization with pp please take a look at <a href="content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p> <hr /><h1 id="QUICKCLUSTERS"> Quick start guide, clusters </h1><p><em><strong>On the nodes</strong></em> <br /></p><p>1) Start parallel python execution server on all your remote computational nodes:</p><p><strong> node-1> ./ppserver.py </strong></p><p><strong> node-2> ./ppserver.py</strong></p><p><strong> node-3> ./ppserver.py</strong></p><p><em><strong>On the client</strong></em> <br /></p><p>2) Import pp module:</p><p><strong> import pp</strong></p><p>3) Create a list of all the nodes in your cluster (computers where you've run ppserver.py) </p><p><strong> ppservers=("node-1", "node-2", "node-3")</strong><br /></p><p>4) Start pp execution server with the number of workers set to the number of processors in the system and list of ppservers to connect with :</p><p><strong> job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>) </strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong> f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong> f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong> f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p> ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong> r1 = f1()</strong></p><p><strong> r2 = f2()</strong></p><p><strong> r3 = f3() </strong> </p><p> ...etc...</p><p> To find out how to achieve efficient parallelization with pp please take a look at <a href="content/view/17/31/" title="Parallel Python Implementation Examples">examples</a></p> <hr /><h1 id="QUICKCLUSTERSAUTO"> Quick start guide, clusters with autodiscovery<br /> </h1><p><em><strong>On the nodes</strong></em> </p><p>1) Start parallel python execution server on all your remote computational nodes:</p><p><strong> node-1> ./ppserver.py -a<br /> </strong></p><p><strong> node-2> ./ppserver.py -a</strong></p><p><strong> node-3> ./ppserver.py -a<br /></strong></p><p><em><strong>On the client</strong></em></p><p>2) Import pp module:</p><p><strong> import pp</strong></p><p>3) Set ppservers list to auto-discovery: </p><p><strong> ppservers=("*",)</strong><br /></p><p>4) Start pp execution server with the number of workers set to the number of processors in the system and list of ppservers to connect with :</p><p><strong> job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>) </strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong> f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong> f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong> f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p> ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong> r1 = f1()</strong></p><p><strong> r2 = f2()</strong></p><p><strong> r3 = f3() </strong> </p><p> ...etc...</p><p> To find out how to achieve efficient parallelization with pp please take a look at <a href="content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p><hr /><h1 id="ADVANCEDCLUSTERS"> Advanced guide, clusters </h1> <p><em><strong>On the nodes</strong></em> </p><p>1) Start parallel python execution server on all your remote computational nodes (listen to a given port 35000,<br /> and local network interface only, accept only connections which know correct secret):</p><p><strong> node-1> ./ppserver.py -p 35000 -i 192.168.0.101 -s "mysecret"<br /></strong></p><p><strong> node-2> ./ppserver.py -p 35000 -i 192.168.0.102</strong><strong> -s "mysecret"</strong></p><p><strong> node-3> ./ppserver.py -p 35000 -i 192.168.0.103</strong><strong> -s "mysecret"</strong></p><p><em><strong>On the client</strong></em> <br /></p> <p>2) Import pp module:</p><p><strong> import pp</strong></p><p>3) Create a list of all the nodes in your cluster (computers where you've run ppserver.py) </p><p><strong> ppservers=("node-1:35000", "node-2:</strong><strong>35000</strong><strong>", "node-3:</strong><strong>35000</strong><strong>")</strong><br /></p><p>4) Start pp execution server with the number of workers set to the number of processors in the system, <br />list of ppservers to connect with and secret key to authorize the connection:</p><p><strong> job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>, secret="</strong><strong>mysecret</strong><strong>") </strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong> f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong> f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong> f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p> ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong> r1 = f1()</strong></p><p><strong> r2 = f2()</strong></p><p><strong> r3 = f3() </strong> </p><p> ...etc...</p><p> 7) Print the execution statistics:<br /></p><p><strong> job_server.print_stats()</strong></p><p>To find out how to achieve efficient parallelization with pp please take a look at <a href="content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p><hr /><h1 id="COMMANDLINE"> Command line options, ppserver.py </h1> <pre>Usage: ppserver.py [-hda] [-i interface] [-b broadcast] [-p port] [-w nworkers] [-s secret] [-t seconds]<br /> Options:<br /> -h : this help message<br /> -d : debug<br /> -a : enable auto-discovery service<br /> -i interface : interface to listen<br /> -b broadcast : broadcast address for auto-discovery service<br /> -p port : port to listen<br /> -w nworkers : number of workers to start<br /> -s secret : secret for authentication<br /> -t seconds : timeout to exit if no connections with clients exist<br /> -k seconds : socket timeout in seconds <br /></pre><hr /><h1 id="COMMANDLINE"> Security and secret key<a name="SECURITY" title="SECURITY"></a></h1><p> Due to the security concerns it is highly recommended to run ppserver.py with an non-trivial secret key (-s command line argument) which should be paired with the matching <em>secret</em> keyword of PP Server class constructor. Since PP 1.5.3 it is possible to set secret key by assigning <strong>pp_secret</strong> variable in the configuration file <strong>.pythonrc.py</strong> which should be located in the user home directory (please make this file readable and writable only by user). The key set in .pythonrc.py could be overridden by command line argument (for ppserver.py) and <em>secret</em> keyword (for PP Server class constructor). </p>
</td>
+ <p> <a href="http://www.parallelpython.com/content/view/15/30/#API">Module API</a> <br /> <a href="http://www.parallelpython.com/content/view/15/30/#QUICKSMP">Quick start guide, SMP</a><br /> <a href="http://www.parallelpython.com/content/view/15/30/#QUICKCLUSTERS">Quick start guide, clusters<br /> </a><a href="http://www.parallelpython.com/content/view/15/30/#QUICKCLUSTERSAUTO">Quick start guide, clusters with auto-discovery</a><br /> <a href="http://www.parallelpython.com/content/view/15/30/#ADVANCEDCLUSTERS">Advanced guide, clusters</a><br /> <a href="http://www.parallelpython.com/content/view/15/30/#COMMANDLINE">Command line arguments, ppserver.py</a><br /> <a href="http://www.parallelpython.com/content/view/15/30/#SECURITY">Security and secret key</a><br /> <a href="component/option,com_smf/Itemid,29/topic,210.msg653#msg653" title="PP FAQ">PP FAQ</a> </p><hr /> <p> </p><h1 id="API"> pp 1.6.2 module API</h1> <p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section"> <tbody><tr bgcolor="#ffc8d8"> <td colspan="3" valign="bottom"> <br /> <font face="helvetica, arial" color="#000000"><a name="Server" title="Server"></a>class <strong>Server</strong></font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan="2"> </td> <td colspan="2">Parallel Python SMP execution server class<br /> </td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br /> <dl><dt><a name="Server-__init__" title="Server-__init__"></a><strong>__init__</strong>(self, ncpus<font color="#909090">='autodetect'</font>, ppservers<font color="#909090">=()</font>, secret<font color="#909090">=None</font>, restart<font color="#909090">=False</font>, proto<font color="#909090">=2</font>, socket_timeout<font color="#909090">=3600</font>)</dt><dd>Creates <a href="http://www.parallelpython.com/content/view/15/30/#Server">Server</a> instance<br /> </dd><dd> </dd><dd> </dd><dd> ncpus - the number of worker processes to start on the local <br /> computer, if parameter is omitted it will be set to <br /> the number of processors in the system<br /> ppservers - list of active parallel python execution servers <br /> to connect with<br /> secret - passphrase for network connections, if omitted a default<br /> passphrase will be used. It's highly recommended to use a <br /> custom passphrase for all network connections.<br /></dd><dd>restart - whether to restart worker process after each task completion <br /> proto - protocol number for pickle module</dd><dd>socket_timeout - socket timeout in seconds which is also the maximum <br /> time a remote job could be executed. Increase this value<br /> if you have long running jobs or decrease if connectivity<br /> to remote ppservers is often lost. <br /></dd><dd> <br /> With ncpus = 1 all tasks are executed consequently<br /> For the best performance either use the default "autodetect" value<br /> or set ncpus to the total number of processors in the system</dd></dl><dl><dt><a name="Server-destroy" title="Server-destroy"></a><strong>destroy</strong>(self)</dt><dd>Kills ppworkers and closes open files</dd></dl> <dl><dt><a name="Server-get_active_nodes" title="Server-get_active_nodes"></a><strong>get_active_nodes</strong>(self)</dt><dd>Returns active nodes as a dictionary <br /> [keys - nodes, values - ncpus]</dd></dl> <dl><dt><a name="Server-get_ncpus" title="Server-get_ncpus"></a><strong>get_ncpus</strong>(self)</dt><dd>Returns the number of local worker processes (ppworkers)</dd></dl> <dl><dt><a name="Server-get_stats" title="Server-get_stats"></a><strong>get_stats</strong>(self)</dt><dd>Returns job execution statistics as a dictionary</dd></dl><dl><dt><a name="Server-print_stats" title="Server-print_stats"></a><strong>print_stats</strong>(self)</dt><dd>Prints job execution statistics. Useful for benchmarking on <br /> clusters</dd></dl> <dl><dt><a name="Server-set_ncpus" title="Server-set_ncpus"></a><strong>set_ncpus</strong>(self, ncpus<font color="#909090">='autodetect'</font>)</dt><dd>Sets the number of local worker processes (ppworkers)<br /> <br /> ncpus - the number of worker processes, if parammeter is omitted<br /> it will be set to the number of processors in the system</dd></dl> <dl><dt><a name="Server-submit" title="Server-submit"></a><strong>submit</strong>(self, func, args<font color="#909090">=()</font>, depfuncs<font color="#909090">=()</font>, modules<font color="#909090">=()</font>, callback<font color="#909090">=None</font>, callbackargs<font color="#909090">=()</font>, group<font color="#909090">='default'</font>, globals<font color="#909090">=None</font>)</dt><dd>Submits function to the execution queue<br /> <br /> func - function to be executed<br /> args - tuple with arguments of the 'func'<br /> depfuncs - tuple with functions which might be called from 'func'<br /> modules - tuple with module names to import<br /> callback - callback function which will be called with argument <br /> list equal to callbackargs+(result,) <br /> as soon as calculation is done<br /> callbackargs - additional arguments for callback function<br /> group - job group, is used when <a href="http://www.parallelpython.com/content/view/15/30/#Server-wait">wait</a>(group) is called to wait for<br /> jobs in a given group to finish<br /> globals - dictionary from which all modules, functions and classes<br /> will be imported, for instance: globals=globals()</dd></dl> <dl><dt><a name="Server-wait" title="Server-wait"></a><strong>wait</strong>(self, group<font color="#909090">=None</font>)</dt><dd>Waits for all jobs in a given group to finish.<br /> If group is omitted waits for all jobs to finish</dd></dl> <dl><dt><strong>default_port</strong> = 60000</dt></dl> <dl><dt><strong>default_secret</strong> = 'epo20pdosl;dksldkmm'</dt></dl> </td></tr></tbody></table> </p><p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section"> <tbody><tr bgcolor="#ffc8d8"> <td colspan="3" valign="bottom"> <br /> <font face="helvetica, arial" color="#000000"><a name="Template" title="Template"></a>class <strong>Template</strong></font></td></tr> <tr bgcolor="#ffc8d8"><td rowspan="2"> </td> <td colspan="2"><a href="http://www.parallelpython.com/content/view/15/30/#Template">Template</a> class<br /> </td></tr> <tr><td> </td> <td width="100%">Methods defined here:<br /> <dl><dt><a name="Template-__init__" title="Template-__init__"></a><strong>__init__</strong>(self, job_server, func, depfuncs<font color="#909090">=()</font>, modules<font color="#909090">=()</font>, callback<font color="#909090">=None</font>, callbackargs<font color="#909090">=()</font>, group<font color="#909090">='default'</font>, globals<font color="#909090">=None</font>)</dt><dd>Creates <a href="http://www.parallelpython.com/content/view/15/30/#Template">Template</a> instance<br /> <br /> jobs_server - pp server for submitting jobs<br /> func - function to be executed<br /> depfuncs - tuple with functions which might be called from 'func'<br /> modules - tuple with module names to import<br /> callback - callback function which will be called with argument <br /> list equal to callbackargs+(result,) <br /> as soon as calculation is done<br /> callbackargs - additional arguments for callback function<br /> group - job group, is used when wait(group) is called to wait for<br /> jobs in a given group to finish<br /> globals - dictionary from which all modules, functions and classes<br /> will be imported, for instance: globals=globals()</dd></dl> <dl><dt><a name="Template-submit" title="Template-submit"></a><strong>submit</strong>(self, *args)</dt><dd>Submits function with *arg arguments to the execution queue</dd></dl> </td></tr></tbody></table></p><p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section"> <tbody><tr bgcolor="#55aa55"> <td colspan="3" valign="bottom"> <br /> <font face="helvetica, arial" color="#ffffff"><strong>Data</strong></font></td></tr> <tr><td bgcolor="#55aa55"> </td><td> </td> <td width="100%"><strong>copyright</strong> = 'Copyright (c) 2005-2012 Vitalii Vanovschi. All rights reserved'<br /> <strong>version</strong> = '1.6.2'</td></tr></tbody></table> </p><hr /><h1 id="QUICKSMP"> Quick start guide, SMP<br /></h1> <p>1) Import pp module:</p><p><strong> import pp</strong></p><p>2) Start pp execution server with the number of workers set to the number of processors in the system </p><p><strong> job_server = pp.Server() </strong></p><p>3) Submit all the tasks for parallel execution:</p><p><strong> f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong> f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong> f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p> ...etc...<br /></p><p>4) Retrieve the results as needed:</p><p><strong> r1 = f1()</strong></p><p><strong> r2 = f2()</strong></p><p><strong> r3 = f3() </strong> </p><p> ...etc...</p><p> To find out how to achieve efficient parallelization with pp please take a look at <a href="content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p> <hr /><h1 id="QUICKCLUSTERS"> Quick start guide, clusters </h1><p><em><strong>On the nodes</strong></em> <br /></p><p>1) Start parallel python execution server on all your remote computational nodes:</p><p><strong> node-1> ./ppserver.py </strong></p><p><strong> node-2> ./ppserver.py</strong></p><p><strong> node-3> ./ppserver.py</strong></p><p><em><strong>On the client</strong></em> <br /></p><p>2) Import pp module:</p><p><strong> import pp</strong></p><p>3) Create a list of all the nodes in your cluster (computers where you've run ppserver.py) </p><p><strong> ppservers=("node-1", "node-2", "node-3")</strong><br /></p><p>4) Start pp execution server with the number of workers set to the number of processors in the system and list of ppservers to connect with :</p><p><strong> job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>) </strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong> f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong> f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong> f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p> ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong> r1 = f1()</strong></p><p><strong> r2 = f2()</strong></p><p><strong> r3 = f3() </strong> </p><p> ...etc...</p><p> To find out how to achieve efficient parallelization with pp please take a look at <a href="content/view/17/31/" title="Parallel Python Implementation Examples">examples</a></p> <hr /><h1 id="QUICKCLUSTERSAUTO"> Quick start guide, clusters with autodiscovery<br /> </h1><p><em><strong>On the nodes</strong></em> </p><p>1) Start parallel python execution server on all your remote computational nodes:</p><p><strong> node-1> ./ppserver.py -a<br /> </strong></p><p><strong> node-2> ./ppserver.py -a</strong></p><p><strong> node-3> ./ppserver.py -a<br /></strong></p><p><em><strong>On the client</strong></em></p><p>2) Import pp module:</p><p><strong> import pp</strong></p><p>3) Set ppservers list to auto-discovery: </p><p><strong> ppservers=("*",)</strong><br /></p><p>4) Start pp execution server with the number of workers set to the number of processors in the system and list of ppservers to connect with :</p><p><strong> job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>) </strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong> f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong> f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong> f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p> ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong> r1 = f1()</strong></p><p><strong> r2 = f2()</strong></p><p><strong> r3 = f3() </strong> </p><p> ...etc...</p><p> To find out how to achieve efficient parallelization with pp please take a look at <a href="content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p><hr /><h1 id="ADVANCEDCLUSTERS"> Advanced guide, clusters </h1> <p><em><strong>On the nodes</strong></em> </p><p>1) Start parallel python execution server on all your remote computational nodes (listen to a given port 35000,<br /> and local network interface only, accept only connections which know correct secret):</p><p><strong> node-1> ./ppserver.py -p 35000 -i 192.168.0.101 -s "mysecret"<br /></strong></p><p><strong> node-2> ./ppserver.py -p 35000 -i 192.168.0.102</strong><strong> -s "mysecret"</strong></p><p><strong> node-3> ./ppserver.py -p 35000 -i 192.168.0.103</strong><strong> -s "mysecret"</strong></p><p><em><strong>On the client</strong></em> <br /></p> <p>2) Import pp module:</p><p><strong> import pp</strong></p><p>3) Create a list of all the nodes in your cluster (computers where you've run ppserver.py) </p><p><strong> ppservers=("node-1:35000", "node-2:</strong><strong>35000</strong><strong>", "node-3:</strong><strong>35000</strong><strong>")</strong><br /></p><p>4) Start pp execution server with the number of workers set to the number of processors in the system, <br />list of ppservers to connect with and secret key to authorize the connection:</p><p><strong> job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>, secret="</strong><strong>mysecret</strong><strong>") </strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong> f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong> f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong> f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p> ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong> r1 = f1()</strong></p><p><strong> r2 = f2()</strong></p><p><strong> r3 = f3() </strong> </p><p> ...etc...</p><p> 7) Print the execution statistics:<br /></p><p><strong> job_server.print_stats()</strong></p><p>To find out how to achieve efficient parallelization with pp please take a look at <a href="content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p><hr /><h1 id="COMMANDLINE"> Command line options, ppserver.py </h1> <pre>Usage: ppserver.py [-hda] [-i interface] [-b broadcast] [-p port] [-w nworkers] [-s secret] [-t seconds]<br /> Options:<br /> -h : this help message<br /> -d : debug<br /> -a : enable auto-discovery service<br /> -i interface : interface to listen<br /> -b broadcast : broadcast address for auto-discovery service<br /> -p port : port to listen<br /> -w nworkers : number of workers to start<br /> -s secret : secret for authentication<br /> -t seconds : timeout to exit if no connections with clients exist<br /> -k seconds : socket timeout in seconds <br /></pre><hr /><h1 id="COMMANDLINE"> Security and secret key<a name="SECURITY" title="SECURITY"></a></h1><p> Due to the security concerns, in Debian we decided to disable default password authentication, and require to run <strong>ppserver</strong> with a non-trivial secret key (<trong>-s</strong> command line argument) which should be paired with the matching <em>secret</em> keyword of PP Server class constructor. An alternative way to set a secret key is by assigning <strong>pp_secret</strong> variable in the configuration file <strong>.pythonrc.py</strong> which should be located in the user home directory (please make this file readable and writable only by user). The secret key set in <strong>.pythonrc.py</strong> could be overridden by command line argument (for <strong>ppserver</strong>) and <em>secret</em> keyword (for PP Server class constructor). Note that passing the password on the command line allows every user to see it (e.g. using <strong>ps(1)</strong>), and that running it on an open/untrusted network can be a security problem as traffic, including the password, is not encrypted.</p>
</td>
</tr>
</table>
Index: parallelpython-1.6.2/pp.py
===================================================================
--- parallelpython-1.6.2.orig/pp.py 2012-06-03 09:35:53.000000000 +0200
+++ parallelpython-1.6.2/pp.py 2012-06-07 22:18:28.186360649 +0200
@@ -277,7 +277,6 @@
"""
default_port = 60000
- default_secret = "epo20pdosl;dksldkmm"
def __init__(self, ncpus="autodetect", ppservers=(), secret=None,
restart=False, proto=2, socket_timeout=3600):
@@ -288,9 +287,8 @@
the number of processors in the system
ppservers - list of active parallel python execution servers
to connect with
- secret - passphrase for network connections, if omitted a default
- passphrase will be used. It's highly recommended to use a
- custom passphrase for all network connections.
+ secret - passphrase for network connections; it can be set via
+ command-line or configuration file
restart - whether to restart worker process after each task completion
proto - protocol number for pickle module
socket_timeout - socket timeout in seconds which is also the maximum
@@ -372,7 +370,7 @@
raise TypeError("secret must be of a string type")
self.secret = str(secret)
else:
- self.secret = Server.default_secret
+ raise ValueError("secret must be set using command-line option or configuration file")
self.__connect()
self.__creation_time = time.time()
self.logger.info("pp local server started with %d workers"
|