ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxmrlv <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #156: ARIA-278 remove core tasks
Date Tue, 20 Jun 2017 12:10:50 GMT
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/156#discussion_r122956604
  
    --- Diff: tests/orchestrator/workflows/executor/__init__.py ---
    @@ -12,69 +12,80 @@
     # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     # See the License for the specific language governing permissions and
     # limitations under the License.
    -import uuid
     import logging
    -from collections import namedtuple
    +import uuid
     from contextlib import contextmanager
     
     import aria
     from aria.modeling import models
     
     
    +class MockContext(object):
    +
    +    def __init__(self, storage, task_kwargs=None):
    +        self.logger = logging.getLogger('mock_logger')
    +        self._task_kwargs = task_kwargs or {}
    +        self._storage = storage
    +        self.task = MockTask(storage, **task_kwargs)
    +        self.states = []
    +        self.exception = None
    +
    +    @property
    +    def serialization_dict(self):
    +        return {
    +            'context_cls': self.__class__,
    +            'context': {
    +                'storage_kwargs': self._storage.serialization_dict,
    +                'task_kwargs': self._task_kwargs
    +            }
    +        }
    +
    +    def __getattr__(self, item):
    +        return None
    +
    +    def close(self):
    +        pass
    +
    +    @classmethod
    +    def instantiate_from_dict(cls, storage_kwargs=None, task_kwargs=None):
    +        return cls(storage=aria.application_model_storage(**(storage_kwargs or {})),
    +                   task_kwargs=(task_kwargs or {}))
    +
    +    @property
    +    @contextmanager
    +    def track_changes(self):
    --- End diff --
    
    persist_changes


---
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