Code Monkey home page Code Monkey logo

moodle-parallel-phpunit's Introduction

moodle-parallel-phpunit

Parallel phpunit tool for moodle.

INTRO:

This is a tool for enabling parallel phpunit for moodle.

HOW TO USE:

  1. Install docker

  2. git clone https://github.com/JoeyAndres/moodle-parallel-phpunit.git

  3. edit config.py Set moodle_directory to the absolute path of your moodle instance.

    Also change container_count to the number of cpu cores that you have.

    If it gives you faster result with 2 * core count, then go ahead. I'm not recommending it at the moment since it might influence the execution time estimates.

  4. Change the config.php of your moodle instance to the following:

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'pgsql';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodledb';
$CFG->dbuser    = 'moodle';
$CFG->dbpass    = 'moodle';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
);

$CFG->wwwroot   = 'http://localhost';
$CFG->dataroot  = '//moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

$CFG->phpunit_prefix = 'phpu_';
$CFG->phpunit_dataroot = '/phpu_moodledata';
$CFG->phpunit_dbhost    = '0.0.0.0';

$CFG->behat_prefix = 'b_';
$CFG->behat_dataroot = '//b_moodledata';
$CFG->behat_wwwroot = 'http://127.0.0.1';

require_once(dirname(__FILE__) . '/lib/setup.php');

(Currently only handles postgres for Pre-Alpha)

  1. Execute ./moodle-parallel-phpunit.py setup --create-image

  2. Execute ./moodle-parallel-phpunit.py test

  3. Result should be in data/result.out

Problems or Question?:

Contact me at [email protected]

moodle-parallel-phpunit's People

Stargazers

Justin Garrick avatar

Watchers

James Cloos avatar Joey Andres avatar

moodle-parallel-phpunit's Issues

MAIN-4: Change all eclass reference to moodle

Currently, this tool is riddled with eclass strings (a specific instance of moodle in uofa), get rid of it and replace it with moodle. After all, this is meant to be agnostic of what moodle instance you are running.

MAIN-3: Best performance scheduling

To implement the best performance wrt to scheduling: Sort phpunit by execution time and execute each phpunit in that order. That guarantees best time.

MAIN-2: Some files are hard coded

Some files are hard coded, specially in phpunit_container.py and and all the bash files. Unless there is a concrete argument that they will never change, make them a parameter.

MAIN-22: Locking in jenkins

After some investigation, there is a thread lock in jenkins. For some reason, this lock is not being experience in my pc. But whatever the reason, the following is a semantic error.

def _pop_testsuite(self):
        self._testsuites_lock.acquire(True)

        testsuite = None
        if len(self.testsuites) > 0:
            testsuite = self.testsuites.pop()
            self._testsuites_lock.release()

        return testsuite

As you can see, lock is never released when len(self.testsuites) is 0 or empty, thus the lock always occur at the very end.

MAIN-23: More jenkins starvation

This is a different kind of starvation. Not halting the whole operation, but slowing it down. Only one core is doing the job, specifically in a two core Jenkins environment. I can't keep track if this is going on in an 8 core machine (I feel like I don't see some numbers showing up in the log, thus might be an evidence of starvation on some threads).

MAIN-24: Prompt test_assigned/test_total is inaccurate

Currently, this number is printed after the test is done. Since this is test_assigned/test_total, last tests can have total_test/total_test, since at this point all tests are assinged. Either, way this is confusing. Two solutions:

Change this to test_completed/test_total or move this prior to starting test (or when test is assigned).

MAIN-1: Implement test/tests method

Now that docker containers are encapsulated in phpunit_container classes, setup.py is now much cleaner and straight forward. test.py is still rampant with direct bash execution and implementing test/tests method in the phpunit_container_abstract should clean test.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.