comparison chado.py @ 8:2b4c9d801a1e draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/chado commit f5c5d81fc9781371e12b91c0d609b9201587cda5
author gga
date Fri, 23 Nov 2018 10:59:04 -0500
parents b44be6289549
children 16753eb6b170
comparison
equal deleted inserted replaced
7:112be1519592 8:2b4c9d801a1e
404 if cacheKey not in cache: 404 if cacheKey not in cache:
405 # However if it ISN'T there, we know we're safe to fetch + put in 405 # However if it ISN'T there, we know we're safe to fetch + put in
406 # there. 406 # there.
407 data = _list_organisms(ci, *args, **kwargs) 407 data = _list_organisms(ci, *args, **kwargs)
408 cache[cacheKey] = data 408 cache[cacheKey] = data
409 ci.session.close()
409 return data 410 return data
410 try: 411 try:
411 # The cache key may or may not be in the cache at this point, it 412 # The cache key may or may not be in the cache at this point, it
412 # /likely/ is. However we take no chances that it wasn't evicted between 413 # /likely/ is. However we take no chances that it wasn't evicted between
413 # when we checked above and now, so we reference the object from the 414 # when we checked above and now, so we reference the object from the
414 # cache in preparation to return. 415 # cache in preparation to return.
415 data = cache[cacheKey] 416 data = cache[cacheKey]
417 ci.session.close()
416 return data 418 return data
417 except KeyError: 419 except KeyError:
418 # If access fails due to eviction, we will fail over and can ensure that 420 # If access fails due to eviction, we will fail over and can ensure that
419 # data is inserted. 421 # data is inserted.
420 data = _list_organisms(ci, *args, **kwargs) 422 data = _list_organisms(ci, *args, **kwargs)
421 cache[cacheKey] = data 423 cache[cacheKey] = data
424 ci.session.close()
422 return data 425 return data
423 426
424 427
425 def _list_organisms(ci, *args, **kwargs): 428 def _list_organisms(ci, *args, **kwargs):
426 # Fetch the orgs. 429 # Fetch the orgs.
445 # However if it ISN'T there, we know we're safe to fetch + put in 448 # However if it ISN'T there, we know we're safe to fetch + put in
446 # there.<?xml version="1.0"?> 449 # there.<?xml version="1.0"?>
447 450
448 data = _list_analyses(ci, *args, **kwargs) 451 data = _list_analyses(ci, *args, **kwargs)
449 cache[cacheKey] = data 452 cache[cacheKey] = data
453 ci.session.close()
450 return data 454 return data
451 try: 455 try:
452 # The cache key may or may not be in the cache at this point, it 456 # The cache key may or may not be in the cache at this point, it
453 # /likely/ is. However we take no chances that it wasn't evicted between 457 # /likely/ is. However we take no chances that it wasn't evicted between
454 # when we checked above and now, so we reference the object from the 458 # when we checked above and now, so we reference the object from the
455 # cache in preparation to return. 459 # cache in preparation to return.
456 data = cache[cacheKey] 460 data = cache[cacheKey]
461 ci.session.close()
457 return data 462 return data
458 except KeyError: 463 except KeyError:
459 # If access fails due to eviction, we will fail over and can ensure that 464 # If access fails due to eviction, we will fail over and can ensure that
460 # data is inserted. 465 # data is inserted.
461 data = _list_analyses(ci, *args, **kwargs) 466 data = _list_analyses(ci, *args, **kwargs)
462 cache[cacheKey] = data 467 cache[cacheKey] = data
468 ci.session.close()
463 return data 469 return data
464 470
465 471
466 def _list_analyses(ci, *args, **kwargs): 472 def _list_analyses(ci, *args, **kwargs):
467 ans_data = [] 473 ans_data = []