From ab15527d57dd5971b588123640b6b610870e381c Mon Sep 17 00:00:00 2001 From: Karl Chen Date: Thu, 4 Sep 2003 05:54:55 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2249 --- checkin_notes | 4 ++- doc/python.php | 69 +++++++++++++++++++++++++++++++++++++++ doc/software.php | 39 +++++++++++++--------- doc/test.php | 33 ++++--------------- py/Boinc/database.py | 12 ++++--- py/Boinc/setup_project.py | 15 +++++---- test/.cvsignore | 1 + test/boinc_db.py | 41 ----------------------- 8 files changed, 120 insertions(+), 94 deletions(-) create mode 100644 doc/python.php delete mode 100644 test/boinc_db.py diff --git a/checkin_notes b/checkin_notes index aac0da10f9..c345ce9c9b 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6086,7 +6086,7 @@ quarl 2003/09/03 - start and add.py know where config.xml and run_state.xml are (customizable too) - - starting web documentation of python framework + - wrote documentation for python framework; revised other documentation py/Boinc/ (added entire tree) Makefile.am @@ -6111,3 +6111,5 @@ quarl 2003/09/03 doc/ python.php (added) + software.php + test.php diff --git a/doc/python.php b/doc/python.php new file mode 100644 index 0000000000..f4bf9f2868 --- /dev/null +++ b/doc/python.php @@ -0,0 +1,69 @@ + + +See the section on Python in the Software +Prerequisites. + +

Structure

+ +The directory boinc/py/Boinc contains the Boinc +module. This means if you have boinc/py/ in your python path you can +write for example: +
+from Boinc.setup_project import * +
+ +To ensure boinc/py/ is in your python path: +
+import boinc_path_config +
+This is a special kludge module that configure places in relevant +directories which then modifies sys.path appropriately. + +

Project-specific settings

+The module boinc_project_path is imported to get the paths +for config.xml and run_state.xml. The default +paths for these are the parent directory of the invocation script. You can +override these defaults +
    +
  1. modify this file directly (if you have only one project on your server + or have separate copies for each) +
  2. create a new boinc_project_path.py and place it earlier in PYTHONPATH + than the default one +
  3. define environment variables +
+ +Example boinc_project_path.py +
+  config_xml_filename = '/etc/boinc/yetiathome/config.xml'
+  run_state_xml_filename = '/var/lib/boinc/yetiathome/run_state.xml'
+
+ +See the source of file boinc/py/Boinc/boinc_project_path.py for +details. + +

Directories containing python scripts

+ + + + + +
boinc/py/ Boinc/*.py + Main BOINC python modules +
boinc/sched/ start + BOINC start / Super Cron program +
boinc/tools/ add + Adds objects to the database +
boinc/test/ test*.py
cgiserver.py
+ Test scripts: see the testing framework. +
+ + + + + diff --git a/doc/software.php b/doc/software.php index ac7657a6d3..be8b7c3583 100644 --- a/doc/software.php +++ b/doc/software.php @@ -19,27 +19,36 @@ Required for compiling:
  • Other standard development tools assumed: make, gzip, etc. -Required to run automated tests, create a project and other various tools: - - Required on the database server: Required on the master/scheduler server(s): + +The test suite simulates all servers on a single machine +as well as a client, so to run make check you need most of the +usual server and client software: + Optional, required only if you change */Makefile.am: @@ -52,7 +61,7 @@ Optional, required only if you change */Makefile.am: On Debian Linux you can install all of the above software using
    - apt-get install g++ python python-mysqldb python-xml mysql-server mysql-client apache php automake autoconf + apt-get install g++ python python-mysqldb python-xml mysql-server mysql-client apache php4 automake autoconf
    diff --git a/doc/test.php b/doc/test.php index 526f410e5d..c19ec5f406 100644 --- a/doc/test.php +++ b/doc/test.php @@ -3,10 +3,16 @@ page_head("Testing BOINC"); ?> +See the section on testing in the Software +Prerequisites. Note that a performance web server with PHP is required for +running a real server, but that requires a lot of path and permissions +configuration so we opt not to use them in testing. +

    Python testing framework

    The test/ directory contains a library of Python modules that -make end-to-end testing of BOINC easy. +make end-to-end testing of BOINC easy. See the Python +framework.

    Quick start

    Single test: @@ -55,31 +61,6 @@ The following system attributes are planned but not implemented yet: (out of disk space, crash/reboot, etc.). -

    Software

    -

    Pre-requisites

    -
      -
    1. MySQL installed and running with permissions for the test script - user to create databases. Currently the script expects it to be - running on localhost but that could be changed. -
    2. Python 2.2, Python module - MySQLdb -
    - -

    Other optional software

    -
      -
    1. PHPMyAdmin: Useful for viewing database. -
    2. Apache or other web server: normal the test system uses a custom - CGI/PHP web server based on the Python BaseHTTPServer module, but - a real web server could be used to test things like permissions and - throughput. -
    3. PHP: Useful for viewing web server output, but not necessary - (otherwise a stub fake_php.py program is used) -
    - -Note that a performance web server with PHP is required for running a real -server, but that requires a lot of path and permissions configuration so we -opt not to use them in testing. - diff --git a/py/Boinc/database.py b/py/Boinc/database.py index 44d26145db..e32a7fcbcb 100644 --- a/py/Boinc/database.py +++ b/py/Boinc/database.py @@ -495,10 +495,14 @@ class Workunit(DatabaseObject): 'name', 'xml_doc', 'batch', - 'rsc_fpops', - 'rsc_iops', - 'rsc_memory', - 'rsc_disk', + # 'rsc_fpops', + # 'rsc_iops', + # 'rsc_memory', + # 'rsc_disk', + 'rsc_fpops_est', + 'rsc_fpops_bound', + 'rsc_memory_bound', + 'rsc_disk_bound', 'need_validate', 'canonical_resultid', 'canonical_credit', diff --git a/py/Boinc/setup_project.py b/py/Boinc/setup_project.py index 6861b3e796..15c1d574e1 100644 --- a/py/Boinc/setup_project.py +++ b/py/Boinc/setup_project.py @@ -2,6 +2,7 @@ # TODO: make things work if build_dir != src_dir +import boinc_path_config import version from boinc_db import * import os, sys, glob, time, shutil, re, random @@ -177,10 +178,10 @@ def account_file_name(url): return 'account_' + _url_to_filename(url) + '.xml' def srcdir(*dirs): - return apply(os.path.join,(TOP_SRC_DIR,)+dirs) + return apply(os.path.join,(boinc_path_config.TOP_SOURCE_DIR,)+dirs) def builddir(*dirs): - return apply(os.path.join,(TOP_BUILD_DIR,)+dirs) + return apply(os.path.join,(boinc_path_config.TOP_BUILD_DIR,)+dirs) def run_tool(cmd): verbose_shell_call(builddir('tools', cmd)) @@ -271,7 +272,7 @@ class Platform: class CoreVersion: def __init__(self): self.version = 1 - self.platform = Platform(PLATFORM) + self.platform = Platform(version.PLATFORM) self.exec_dir = builddir('client') self.exec_name = options.client_bin_filename @@ -281,13 +282,13 @@ class App: self.name = name class AppVersion: - def __init__(self, app, version = 1, exec_names=None): + def __init__(self, app, appversion = 1, exec_names=None): self.exec_names = [] self.exec_dir = builddir('apps') self.exec_names = exec_names or [app.name] self.app = app - self.version = 1 - self.platform = Platform(PLATFORM) + self.version = appversion + self.platform = Platform(version.PLATFORM) class Project: def __init__(self, @@ -323,7 +324,7 @@ class Project: self.core_versions = core_versions or [CoreVersion()] self.app_versions = app_versions or [AppVersion(App(appname))] self.apps = apps or unique(map(lambda av: av.app, self.app_versions)) - self.platforms = [Platform(PLATFORM)] + self.platforms = [Platform(version.PLATFORM)] # convenience vars: self.app_version = self.app_versions[0] self.app = self.apps[0] diff --git a/test/.cvsignore b/test/.cvsignore index b88bf16bff..d227b6156f 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -1,2 +1,3 @@ version.inc testproxy.log +run-* diff --git a/test/boinc_db.py b/test/boinc_db.py deleted file mode 100644 index 44914e5564..0000000000 --- a/test/boinc_db.py +++ /dev/null @@ -1,41 +0,0 @@ -# Generated by db_def_to_py on Wed Jul 2 17:30:40 PDT 2003 -MAX_BLOB_SIZE = 4096 -TEAM_TYPE_CLUB = 1 -TEAM_TYPE_COMPANY = 2 -TEAM_TYPE_PRIMARY = 3 -TEAM_TYPE_SECONDARY = 4 -TEAM_TYPE_JUNIOR_COLLEGE = 5 -TEAM_TYPE_UNIVERSITY = 6 -TEAM_TYPE_GOVERNMENT = 7 -FILE_DELETE_INIT = 0 -FILE_DELETE_READY = 1 -FILE_DELETE_DONE = 2 -ASSIMILATE_INIT = 0 -ASSIMILATE_READY = 1 -ASSIMILATE_DONE = 2 -WU_ERROR_COULDNT_SEND_RESULT = 1 -WU_ERROR_TOO_MANY_ERROR_RESULTS = 2 -WU_ERROR_TOO_MANY_RESULTS = 4 -RESULT_SERVER_STATE_INACTIVE = 1 -RESULT_SERVER_STATE_UNSENT = 2 -RESULT_SERVER_STATE_UNSENT_SEQ = 3 -RESULT_SERVER_STATE_IN_PROGRESS = 4 -RESULT_SERVER_STATE_OVER = 5 -RESULT_OUTCOME_INIT = 0 -RESULT_OUTCOME_SUCCESS = 1 -RESULT_OUTCOME_COULDNT_SEND = 2 -RESULT_OUTCOME_CLIENT_ERROR = 3 -RESULT_OUTCOME_NO_REPLY = 4 -RESULT_OUTCOME_DIDNT_NEED = 5 -VALIDATE_STATE_INIT = 0 -VALIDATE_STATE_VALID = 1 -VALIDATE_STATE_INVALID = 2 -WORKSEQ_STATE_UNASSIGNED = 0 -WORKSEQ_STATE_ASSIGNED = 1 -WORKSEQ_STATE_DONE = 2 -RESULT_NEW = 0 -RESULT_FILES_DOWNLOADING = 1 -RESULT_FILES_DOWNLOADED = 2 -RESULT_COMPUTE_DONE = 3 -RESULT_FILES_UPLOADING = 4 -RESULT_FILES_UPLOADED = 5