Skip to content

Commit

Permalink
Remove tx.close() with Neo4j driver upgrade
Browse files Browse the repository at this point in the history
Remove tx.close() with Neo4j driver upgrade
  • Loading branch information
jinhyukchang authored Jun 12, 2020
1 parent 3c0149c commit 2124981
Showing 1 changed file with 2 additions and 18 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

0 comments on commit 2124981

Please sign in to comment.