def test_deploy_ramp_event(session_scope_function): database_config = read_config(database_config_template()) event_config_filename = ramp_config_template() event_config = read_config(event_config_filename) ramp_config = generate_ramp_config(event_config) deploy_ramp_event(database_config_template(), ramp_config_template()) # simulate that we add users and sign-up for the event and that they # submitted the starting kit with session_scope(database_config['sqlalchemy']) as session: add_users(session) sign_up_team(session, ramp_config['event_name'], 'test_user') submit_starting_kits(session, ramp_config['event_name'], 'test_user', ramp_config['ramp_kit_submissions_dir']) # run the dispatcher on the event which are in the dataset dispatcher = Dispatcher(config=database_config, event_config=event_config, worker=CondaEnvWorker, n_workers=-1, hunger_policy='exit') dispatcher.launch() # the iris kit contain a submission which should fail for a user with session_scope(database_config['sqlalchemy']) as session: submission = get_submissions(session, event_config['ramp']['event_name'], 'training_error') assert len(submission) == 1
def test_submit_starting_kits(base_db): session = base_db config = ramp_config_iris() event_name, username = _setup_sign_up(session) ramp_config = generate_ramp_config(read_config(config)) submit_starting_kits(session, event_name, username, ramp_config['ramp_kit_submissions_dir']) submissions = get_submissions(session, event_name, None) submissions_id = [sub[0] for sub in submissions] assert len(submissions) == 5 expected_submission_name = {'starting_kit', 'starting_kit_test', 'random_forest_10_10', 'error'} submission_name = {get_submission_by_id(session, sub_id).name for sub_id in submissions_id} assert submission_name == expected_submission_name
def test_submit_starting_kits(base_db): session = base_db config = read_config(ramp_config_template()) event_name, username = _setup_sign_up(session, config) ramp_config = generate_ramp_config(config) submit_starting_kits( session, event_name, username, os.path.join(ramp_config['ramp_kits_dir'], ramp_config['event'], config['ramp']['submissions_dir'])) submissions = get_submissions(session, event_name, None) submissions_id = [sub[0] for sub in submissions] assert len(submissions) == 5 expected_submission_name = { 'starting_kit', 'starting_kit_test', 'random_forest_10_10', 'error' } submission_name = set( get_submission_by_id(session, sub_id).name for sub_id in submissions_id) assert submission_name == expected_submission_name