Skip to content

Commit

Permalink
fix: Remove tx.close() with Neo4j driver upgrade (#143)
Browse files Browse the repository at this point in the history
* Remove tx.close() with Neo4j driver upgrade

Remove tx.close() with Neo4j driver upgrade

* Update setup.py

* Update setup.py
  • Loading branch information
jinhyukchang authored Jun 12, 2020
1 parent 3c0149c commit 5f1d056
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
20 changes: 2 additions & 18 deletions metadata_service/proxy/neo4j_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ def _put_resource_description(self, *,
raise e

finally:
tx.close()
if LOGGER.isEnabledFor(logging.DEBUG):
LOGGER.debug('Update process elapsed for {} seconds'.format(time.time() - start))

Expand Down Expand Up @@ -491,9 +490,6 @@ def put_column_description(self, *,
raise e

finally:

tx.close()

if LOGGER.isEnabledFor(logging.DEBUG):
LOGGER.debug('Update process elapsed for {} seconds'.format(time.time() - start))

Expand Down Expand Up @@ -532,14 +528,12 @@ def add_owner(self, *,
raise RuntimeError('Failed to create relation between '
'owner {owner} and table {tbl}'.format(owner=owner,
tbl=table_uri))
tx.commit()
except Exception as e:
if not tx.closed():
tx.rollback()
# propagate the exception back to api
raise e
finally:
tx.commit()
tx.close()

@timer_with_counter
def delete_owner(self, *,
Expand Down Expand Up @@ -567,7 +561,6 @@ def delete_owner(self, *,
raise e
finally:
tx.commit()
tx.close()

@timer_with_counter
def add_tag(self, *,
Expand Down Expand Up @@ -628,9 +621,6 @@ def add_tag(self, *,
tx.rollback()
# propagate the exception back to api
raise e
finally:
if not tx.closed():
tx.close()

@timer_with_counter
def delete_tag(self, *,
Expand Down Expand Up @@ -662,14 +652,12 @@ def delete_tag(self, *,
tx.run(delete_query, {'tag': tag,
'key': id,
'tag_type': tag_type})
tx.commit()
except Exception as e:
# propagate the exception back to api
if not tx.closed():
tx.rollback()
raise e
finally:
tx.commit()
tx.close()

@timer_with_counter
def get_tags(self) -> List:
Expand Down Expand Up @@ -1049,8 +1037,6 @@ def add_resource_relation_by_user(self, *,
tx.rollback()
# propagate the exception back to api
raise e
finally:
tx.close()

@timer_with_counter
def delete_resource_relation_by_user(self, *,
Expand Down Expand Up @@ -1086,8 +1072,6 @@ def delete_resource_relation_by_user(self, *,
if not tx.closed():
tx.rollback()
raise e
finally:
tx.close()

@timer_with_counter
def get_dashboard(self,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import setup, find_packages

__version__ = '2.5.3'
__version__ = '2.5.4'


requirements_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'requirements.txt')
Expand Down

0 comments on commit 5f1d056

Please sign in to comment.