ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran-z <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #75: ARIA-117-Log-model-should-have-an-Task...
Date Sun, 12 Mar 2017 14:53:25 GMT
Github user ran-z commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/75#discussion_r105559391
  
    --- Diff: aria/orchestrator/context/operation.py ---
    @@ -64,11 +67,19 @@ def task(self):
             The task in the model storage
             :return: Task model
             """
    -        if not self._task:
    +        # SQLAlchemy prevents from accessing an object which was created on a different
thread.
    +        # So we retrieve the object from the storage if the current thread isn't the
same as the
    +        # original thread.
    +        if not self._task or self._current_thread_id != self._current_thread:
                 self._task = self.model.task.get(self._task_id)
    +            self._current_thread = self._current_thread_id
             return self._task
     
         @property
    +    def _current_thread_id(self):
    --- End diff --
    
    be a man. save it in a thread local.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message