How to use the ramp-utils.ramp_utils.ramp.generate_ramp_config function in ramp-utils

To help you get started, we’ve selected a few ramp-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paris-saclay-cds / ramp-board / ramp-utils / ramp_utils / deploy.py View on Github external
given RAMP event. It will also setup the database.

    Parameters
    ----------
    config : str
        The path to the YAML file containing the database information.
    event_config : str
        The path to the YAML file containing the RAMP infomation.
    setup_ramp_repo : bool, default is True
        Whether or not to setup the RAMP kit and data repositories.
    force : bool, default is False
        Whether or not to potentially overwrite the repositories, problem and
        event in the database.
    """
    database_config = read_config(config, filter_section='sqlalchemy')
    ramp_config = generate_ramp_config(event_config, config)

    with session_scope(database_config) as session:
        setup_files_extension_type(session)
        if setup_ramp_repo:
            setup_ramp_kit_ramp_data(
                ramp_config, ramp_config['problem_name'], force
            )
        else:
            # we do not clone the repository but we need to convert the
            # notebook to html
            current_directory = os.getcwd()
            problem_kit_path = ramp_config['ramp_kit_dir']
            os.chdir(problem_kit_path)
            subprocess.check_output(["jupyter", "nbconvert", "--to", "html",
                                     "{}_starting_kit.ipynb"
                                     .format(ramp_config['problem_name'])])
github paris-saclay-cds / ramp-board / ramp-utils / ramp_utils / worker.py View on Github external
given as well. When a ``dict`` is provided, all paths should be given.
    database_config : str, optional
        The database configuration filename. It is required when
        ``event_config`` is a ``str``..

    Returns
    -------
    worker_config : dict
        The configuration for the RAMP worker.
    """
    if isinstance(event_config, str):
        ramp_config = generate_ramp_config(event_config, database_config)
        event_config = read_config(
            event_config, filter_section=['ramp', 'worker'])
    else:
        ramp_config = generate_ramp_config(event_config)

    # copy the specific information for the given worker configuration
    worker_config = event_config['worker'].copy()
    # define the directory of the ramp-kit for the event
    worker_config['kit_dir'] = ramp_config['ramp_kit_dir']
    # define the directory of the ramp-data for the event
    worker_config['data_dir'] = ramp_config['ramp_data_dir']
    # define the directory of the submissions
    worker_config['submissions_dir'] = ramp_config['ramp_submissions_dir']
    # define the directory of the predictions
    worker_config['predictions_dir'] = ramp_config['ramp_predictions_dir']
    # define the directory of the logs
    worker_config['logs_dir'] = ramp_config['ramp_logs_dir']

    if worker_config['worker_type'] in REQUIRED_KEYS.keys():
        required_fields = REQUIRED_KEYS[worker_config['worker_type']]
github paris-saclay-cds / ramp-board / ramp-utils / ramp_utils / worker.py View on Github external
----------
    event_config : dict or str
        Either the loaded configuration or the configuration YAML file. When
        the configuration filename is given, ``database_config`` need to be
        given as well. When a ``dict`` is provided, all paths should be given.
    database_config : str, optional
        The database configuration filename. It is required when
        ``event_config`` is a ``str``..

    Returns
    -------
    worker_config : dict
        The configuration for the RAMP worker.
    """
    if isinstance(event_config, str):
        ramp_config = generate_ramp_config(event_config, database_config)
        event_config = read_config(
            event_config, filter_section=['ramp', 'worker'])
    else:
        ramp_config = generate_ramp_config(event_config)

    # copy the specific information for the given worker configuration
    worker_config = event_config['worker'].copy()
    # define the directory of the ramp-kit for the event
    worker_config['kit_dir'] = ramp_config['ramp_kit_dir']
    # define the directory of the ramp-data for the event
    worker_config['data_dir'] = ramp_config['ramp_data_dir']
    # define the directory of the submissions
    worker_config['submissions_dir'] = ramp_config['ramp_submissions_dir']
    # define the directory of the predictions
    worker_config['predictions_dir'] = ramp_config['ramp_predictions_dir']
    # define the directory of the logs

ramp-utils

Utilities shared across the RAMP bundle

BSD-3-Clause
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages