def create_ith_slave_container(ith, master_container): assert ith > 0 slave_container = phpunit_container_slave( config.slave_image_name, config.container_names[ith], master_container, config.container_temp_result_file_template[ith], True) print("--- {0}s seconds ---".format( utility.execute_and_time(slave_container.create_and_instantiate)))
def setup(args): if '--help' in args: print """ moodle-parallel-phpunit setup [OPTIONS] Options: --create-image: Creates the image based off the config.py's master/slave_image. Creating an image that already exist simply replaces the older one. --only-update-slaves: This is meant to be for those using this tool in personal machine in which there is a human that knows there's no need for db update (no new plugin, or new test files). (Note: This is to be deprecated in Alpha release, in which this checking will be automated.) (Note: Pre-Alpha doesn't handle starting containers if not yet started, so do it yourself atm.) Prior to calling "moodle-parallel-phpunit setup", ensure that config.py's parameters are properly set with your environment. """ return const.OK if utility.handle_option('--create-image', args, create_image, "") is const.ERROR: return const.ERROR if utility.handle_option('--only-update-slaves', args, only_update_slaves_handler, "") is const.ERROR: # Boolean are reference. return const.ERROR # Create necessary directory(ies). create_necessary_directories() # Create the master container obj. result_file = config.container_temp_result_file_template.format( config.master_container_name) master_container = phpunit_container_master(config.master_image_name, config.master_container_name, result_file, True, config.master_container_phpunit_dataroot) if config.only_update_slaves is False: print("--- {0}s seconds ---".format( utility.execute_and_time(master_container.create_and_instantiate))) # Create the slave obj(s). [create_ith_slave_container(i, master_container) for i in range(1, config.container_count)] # Check if "execution time file" exist. If not, create one. initialize_execution_time_file() return const.OK
def setup(args): if '--help' in args: print """ moodle-parallel-phpunit setup [OPTIONS] Options: --create-image: Creates the image based off the config.py's master/slave_image. Creating an image that already exist simply replaces the older one. --only-update-slaves: This is meant to be for those using this tool in personal machine in which there is a human that knows there's no need for db update (no new plugin, or new test files). (Note: This is to be deprecated in Alpha release, in which this checking will be automated.) (Note: Pre-Alpha doesn't handle starting containers if not yet started, so do it yourself atm.) Prior to calling "moodle-parallel-phpunit setup", ensure that config.py's parameters are properly set with your environment. """ return const.OK if utility.handle_option('--create-image', args, create_image, "") is const.ERROR: return const.ERROR if utility.handle_option('--only-update-slaves', args, only_update_slaves_handler, "") is const.ERROR: # Boolean are reference. return const.ERROR # Create necessary directory(ies). create_necessary_directories() # Create the master container obj. result_file = config.container_temp_result_file_template.format( config.master_container_name) master_container = phpunit_container_master( config.master_image_name, config.master_container_name, result_file, True, config.master_container_phpunit_dataroot) if config.only_update_slaves is False: print("--- {0}s seconds ---".format( utility.execute_and_time(master_container.create_and_instantiate))) # Create the slave obj(s). [ create_ith_slave_container(i, master_container) for i in range(1, config.container_count) ] # Check if "execution time file" exist. If not, create one. initialize_execution_time_file() return const.OK
def create_ith_slave_container(ith, master_container): assert ith > 0 slave_container = phpunit_container_slave( config.slave_image_name, config.container_names[ith], master_container, config.container_temp_result_file_template[ith], True) print("--- {0}s seconds ---".format(utility.execute_and_time( slave_container.create_and_instantiate)))