You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/05/10 16:27:45 UTC

incubator-ariatosca git commit: better handling

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-213-Sporadic-tests-failures-over-locked-database-issue 6e54fef39 -> decbc4ee5


better handling


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/decbc4ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/decbc4ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/decbc4ee

Branch: refs/heads/ARIA-213-Sporadic-tests-failures-over-locked-database-issue
Commit: decbc4ee59034b06eddae8ec9227884c20bec7c1
Parents: 6e54fef
Author: max-orlov <ma...@gigaspaces.com>
Authored: Wed May 10 19:27:40 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Wed May 10 19:27:40 2017 +0300

----------------------------------------------------------------------
 aria/storage/instrumentation.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/decbc4ee/aria/storage/instrumentation.py
----------------------------------------------------------------------
diff --git a/aria/storage/instrumentation.py b/aria/storage/instrumentation.py
index b1e9cd7..b0738c8 100644
--- a/aria/storage/instrumentation.py
+++ b/aria/storage/instrumentation.py
@@ -102,13 +102,11 @@ class _Instrumentation(object):
             session.expunge(instance)
             tracked_instances = self.new_instances.setdefault(instance.__modelname__, {})
             tracked_attributes = tracked_instances.setdefault(self._new_instance_id, {})
-            # TODO: we need a better way to get all of the attributes
-            tracked_attributes.update(execution_fk=instance.execution_fk,
-                                      task_fk=instance.task_fk,
-                                      **instance.to_dict())
-        listener_args = (getattr(ctx.model, instrumented_class.__tablename__)._session,
-                         'after_attach',
-                         listener)
+            instance_as_dict = instance.to_dict()
+            instance_as_dict.update((k, getattr(instance, k)) for k in instance.__private_fields__)
+            tracked_attributes.update(instance_as_dict)
+        session = getattr(ctx.model, instrumented_class.__tablename__)._session
+        listener_args = (session, 'after_attach', listener)
         sqlalchemy.event.listen(*listener_args)
         self.listeners.append(listener_args)