Example #1
0
def recv_callback(msg):
    dom = xml.dom.minidom.parseString(msg.body)
    barcode = get_value(dom, 'barcode')
    state = get_value(dom, 'state')
    log.debug('Barcode: '+barcode)
    log.debug('State: '+state)
    # update the galaxy db
    galaxy = GalaxyDbInterface(dbconnstr)
    sample_id = galaxy.get_sample_id(field_name='bar_code', value=barcode)
    if sample_id == -1:
       log.debug('Invalid barcode.') 
       return
    galaxy.change_state(sample_id, state)
Example #2
0
def recv_callback(msg):
    dom = xml.dom.minidom.parseString(msg.body)
    barcode = get_value(dom, "barcode")
    state = get_value(dom, "state")
    log.debug("Barcode: " + barcode)
    log.debug("State: " + state)
    # update the galaxy db
    galaxy = GalaxyDbInterface(dbconnstr)
    sample_id = galaxy.get_sample_id(field_name="bar_code", value=barcode)
    if sample_id == -1:
        log.debug("Invalid barcode.")
        return
    galaxy.change_state(sample_id, state)
def update_sample_state(message):
    dom = xml.dom.minidom.parseString(message.body)
    barcode = get_value(dom, 'barcode')
    state = get_value(dom, 'state')
    api_key = get_value(dom, 'api_key')
    log.debug('Barcode: ' + barcode)
    log.debug('State: ' + state)
    log.debug('API Key: ' + api_key)
    # validate
    if not barcode or not state or not api_key:
        log.debug(
            'Incomplete sample_state_update message received. Sample barcode, desired state and user API key is required.'
        )
        return
    # update the sample state in Galaxy db
    dbconnstr = config.get("app:main", "database_connection")
    galaxydb = GalaxyDbInterface(dbconnstr)
    sample_id = galaxydb.get_sample_id(field_name='bar_code', value=barcode)
    if sample_id == -1:
        log.debug('Invalid barcode.')
        return
    galaxydb.change_state(sample_id, state)
    # after updating the sample state, update request status
    request_id = galaxydb.get_request_id(sample_id)
    update_request(api_key, request_id)
def update_sample_state( message ):
    dom = xml.dom.minidom.parseString(message.body)
    barcode = get_value(dom, 'barcode')
    state = get_value(dom, 'state')
    api_key = get_value(dom, 'api_key')
    log.debug('Barcode: ' + barcode)
    log.debug('State: ' + state)
    log.debug('API Key: ' + api_key)
    # validate 
    if not barcode or not state or not api_key:
        log.debug( 'Incomplete sample_state_update message received. Sample barcode, desired state and user API key is required.' )
        return
    # update the sample state in Galaxy db
    dbconnstr = config.get("app:main", "database_connection")
    galaxydb = GalaxyDbInterface( dbconnstr )
    sample_id = galaxydb.get_sample_id( field_name='bar_code', value=barcode )
    if sample_id == -1:
       log.debug( 'Invalid barcode.' ) 
       return
    galaxydb.change_state(sample_id, state)
    # after updating the sample state, update request status
    request_id = galaxydb.get_request_id(sample_id)
    update_request( api_key, request_id )