How to use the ramp-engine.ramp_engine.aws.api._is_ready function in ramp-engine

To help you get started, we’ve selected a few ramp-engine 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-engine / ramp_engine / aws / aws_train.py View on Github external
"""
    Wait until an ec2 instance is ready.

    Parameters
    ----------

    config : dict
        configuration

    instance_id : str

    """
    logger.info('Waiting until instance "{}" is ready...'.format(instance_id))
    conf_aws = config[AWS_CONFIG_SECTION]
    secs = int(conf_aws[CHECK_STATUS_INTERVAL_SECS_FIELD])
    while not _is_ready(conf_aws, instance_id):
        time.sleep(secs)
github paris-saclay-cds / ramp-board / ramp-engine / ramp_engine / aws / aws_train.py View on Github external
_add_or_update_tag(conf_aws, instance.id, 'train_loop', '1')
            _add_or_update_tag(conf_aws, instance.id, 'event_name', event_name)
            logger.info('Launched instance "{}" for submission "{}"'.format(
                instance.id, submission))
            set_submission_state(config, submission.id, 'sent_to_training')
        # Score tested submissions
        submissions = get_submissions(config, event_name, 'tested')
        for submission_id, _ in submissions:
            label = _get_submission_label_by_id(config, submission_id)
            logger.info('Scoring submission : {}'.format(label))
            score_submission(config, submission_id)
            _run_hook(config, HOOK_SUCCESSFUL_TRAINING, submission_id)
        # Get running instances and process events
        instance_ids = list_ec2_instance_ids(conf_aws)
        for instance_id in instance_ids:
            if not _is_ready(conf_aws, instance_id):
                continue
            tags = _get_tags(conf_aws, instance_id)
            # Filter instances that were not launched
            # by the training loop API
            # if 'submission_id' not in tags:  # no longer added to tags
            #     continue
            if tags.get('event_name') != event_name:
                continue
            if 'train_loop' not in tags:
                continue
            # Process each instance
            submission_name = tags['Name']
            assert submission_name.startswith('submission_')
            submission_id = int(submission_name[11:])
            submission = get_submission_by_id(config, submission_id)
            label = '{}_{}'.format(submission_id, submission.name)