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_deploy_ramp_event_options(session_scope_function): database_config = read_config(database_config_template()) ramp_config = generate_ramp_config(read_config(ramp_config_template())) deploy_ramp_event(database_config_template(), ramp_config_template()) # deploy again by forcing the deployment deploy_ramp_event(database_config_template(), ramp_config_template(), force=True) # do not deploy the kit to trigger the error in the problem with we don't # force the deployment msg_err = 'The RAMP problem already exists in the database.' with pytest.raises(ValueError, match=msg_err): with session_scope(database_config['sqlalchemy']) as session: problem = get_problem(session, 'iris') problem.path_ramp_kit = problem.path_ramp_kit + '_xxx' session.commit() deploy_ramp_event(database_config_template(), ramp_config_template(), setup_ramp_repo=False, force=False) problem = get_problem(session, 'iris') problem.path_ramp_kit = ramp_config['ramp_kit_dir'] problem.path_ramp_data = problem.path_ramp_data + '_xxx' session.commit() deploy_ramp_event(database_config_template(), ramp_config_template(), setup_ramp_repo=False, force=False)
def deploy_event(config, event_config, cloning, force): """Deploy event (add problem and event to the database, optionally clone kit and data) """ deploy.deploy_ramp_event(config, event_config, cloning, force)
def deploy_ramp_event(config, event_config, cloning, force): deploy.deploy_ramp_event(config, event_config, cloning, force)