def get():
    """Return list of Scheduling Blocks Instances known to SDP ."""
    LOG.debug('GET list of SBIs.')

    # Construct response object.
    _url = get_root_url()
    response = dict(scheduling_blocks=[],
                    links=dict(home='{}'.format(_url)))

    # Get ordered list of SBI ID's.
    block_ids = DB.get_sched_block_instance_ids()

    # Loop over SBIs and add summary of each to the list of SBIs in the
    # response.
    for block in DB.get_block_details(block_ids):
        block_id = block['id']
        LOG.debug('Adding SBI %s to list', block_id)
        LOG.debug(block)

        block['num_processing_blocks'] = len(block['processing_block_ids'])

        temp = ['OK'] * 10 + ['WAITING'] * 4 + ['FAILED'] * 2
        block['status'] = choice(temp)
        try:
            del block['processing_block_ids']
        except KeyError:
            pass
        block['links'] = {
            'detail': '{}/scheduling-block/{}' .format(_url, block_id)
        }
        response['scheduling_blocks'].append(block)
    return response, HTTPStatus.OK
Return list of Scheduling Blocks Instances known to SDP .