You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mxmrlv <gi...@git.apache.org> on 2017/02/13 17:10:02 UTC

[GitHub] incubator-ariatosca pull request #69: Aria 106 create sqla logging handler

GitHub user mxmrlv opened a pull request:

    https://github.com/apache/incubator-ariatosca/pull/69

    Aria 106 create sqla logging handler

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/incubator-ariatosca ARIA-106-Create-sqla-logging-handler

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-ariatosca/pull/69.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #69
    
----
commit d868713c4636bcc7e811564f2bcad7b321824fca
Author: mxmrlv <mx...@gmail.com>
Date:   2017-02-13T10:28:27Z

    wip

commit 2286b0ddcd63e1175bd1119fc0a4d69665d0a643
Author: mxmrlv <mx...@gmail.com>
Date:   2017-02-13T11:35:25Z

    added basic logging mechanism for ops and wf

commit 6bff90672b0781fb425beffcbda950dfbecc37a7
Author: mxmrlv <mx...@gmail.com>
Date:   2017-02-13T11:50:05Z

    wip

----


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102244019
  
    --- Diff: aria/orchestrator/context/operation.py ---
    @@ -126,6 +135,12 @@ class RelationshipOperationContext(BaseOperationContext):
         """
         Context for relationship based operations.
         """
    +
    +    @property
    +    def logging_id(self):
    +        return '{0}:{1}'.format(self.source_node.name or self.source_node.id,
    --- End diff --
    
    ->


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102487809
  
    --- Diff: tests/orchestrator/context/test_operation.py ---
    @@ -203,15 +229,76 @@ def basic_workflow(graph, **_):
             graph.add_tasks(api.task.OperationTask.node(
                 name=op, instance=node, inputs=inputs))
     
    -    execute(workflow_func=basic_workflow, workflow_context=ctx, executor=executor)
    +    execute(workflow_func=basic_workflow, workflow_context=ctx, executor=thread_executor)
         expected_file = tmpdir.join('workdir', 'plugins', str(ctx.service_instance.id),
                                     plugin_name,
                                     filename)
         assert expected_file.read() == content
     
     
    +def test_operation_logging(ctx, executor):
    --- End diff --
    
    test rel logging


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102521783
  
    --- Diff: aria/.pylintrc ---
    @@ -77,7 +77,7 @@ confidence=
     # --enable=similarities". If you want to run only the classes checker, but have
    --- End diff --
    
    1. https://issues.apache.org/jira/browse/ARIA-112
    2. https://issues.apache.org/jira/browse/ARIA-113


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102236324
  
    --- Diff: aria/orchestrator/context/common.py ---
    @@ -15,19 +15,33 @@
     """
     A common context for both workflow and operation
     """
    +from contextlib import contextmanager
    +from functools import partial
     from uuid import uuid4
     
    +import logging
    --- End diff --
    
    move up


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102486230
  
    --- Diff: tests/orchestrator/context/test_operation.py ---
    @@ -38,30 +43,51 @@
     @pytest.fixture
     def ctx(tmpdir):
         context = mock.context.simple(
    -        str(tmpdir.join('workdir')),
    -        inmemory=True,
    +        str(tmpdir),
             context_kwargs=dict(workdir=str(tmpdir.join('workdir')))
         )
         yield context
         storage.release_sqlite_storage(context.model)
     
     
    +tmp_file = os.path.join(tempfile.gettempdir(), 'op_testing_const_file_name')
    --- End diff --
    
    move up


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102482961
  
    --- Diff: aria/.pylintrc ---
    @@ -77,7 +77,7 @@ confidence=
     # --enable=similarities". If you want to run only the classes checker, but have
     # no Warning level messages displayed, use"--disable=all --enable=classes
     # --disable=W"
    -disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,redefined-builtin,logging-format-interpolation,import-error,redefined-variable-type,broad-except,protected-access,global-statement
    --- End diff --
    
    add in tests conf too


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102479658
  
    --- Diff: aria/orchestrator/workflows/executor/base.py ---
    @@ -39,14 +39,15 @@ def close(self):
             """
             pass
     
    -    @staticmethod
    -    def _task_started(task):
    --- End diff --
    
    embarrasing


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102475359
  
    --- Diff: aria/logger.py ---
    @@ -152,15 +152,14 @@ def __init__(self, session, engine, **kwargs):
             # Cyclic dependency
             from aria.storage.modeling.model import Log
             self._cls = Log
    +        # This is needed since the engine and session are entirely new
    +        self._cls.__table__.create(bind=self._engine, checkfirst=True)
    --- End diff --
    
    check if any self._engine syntax exists (at the very least move to the instantiation func)


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102484206
  
    --- Diff: aria/.pylintrc ---
    @@ -77,7 +77,7 @@ confidence=
     # --enable=similarities". If you want to run only the classes checker, but have
    --- End diff --
    
    meta comments:
    1) create JIRA issue for supporting custom workflow logs i.e. during execution time (but not graph building)
    2) decide whether to support passing custom handlers to workflow as well, right now only operation is supported - possibly add jira issue on this as well, allowing for workflow logger to pass onto operations


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102241050
  
    --- Diff: aria/orchestrator/workflows/core/task.py ---
    @@ -151,6 +150,14 @@ def __init__(self, api_task, *args, **kwargs):
             self._task_id = operation_task.id
             self._update_fields = None
     
    +    @property
    +    def self_logging(self):
    +        return self._ctx.self_logging
    +
    +    @property
    --- End diff --
    
    remove


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102243862
  
    --- Diff: aria/orchestrator/context/workflow.py ---
    @@ -65,6 +65,10 @@ def _create_execution(self):
             return execution.id
     
         @property
    +    def logging_id(self):
    +        return self._workflow_name
    --- End diff --
    
    remove


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102474225
  
    --- Diff: aria/__init__.py ---
    @@ -35,6 +30,17 @@
         orchestrator,
         cli
     )
    +
    +if sys.version_info < (2, 7):
    +    from .utils.imports import iter_modules
    --- End diff --
    
    add the "why"


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102239410
  
    --- Diff: aria/storage/modeling/orchestrator_elements.py ---
    @@ -466,3 +466,18 @@ def abort(message=None):
         @staticmethod
         def retry(message=None, retry_interval=None):
             raise TaskRetryException(message, retry_interval=retry_interval)
    +
    +
    +class LogBase(ModelMixin):
    +    __tablename__ = 'log'
    +
    +    logger = Column(String)
    --- End diff --
    
    ?



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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102237759
  
    --- Diff: aria/orchestrator/context/common.py ---
    @@ -44,12 +58,35 @@ def __init__(
             self._service_instance_id = service_instance_id
             self._workdir = workdir
     
    +    def _get_sqla_handler(self):
    +        api_kwargs = self._model._initiator(**self._model._initiator_kwargs)
    --- End diff --
    
    if _initiator is missing


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102239347
  
    --- Diff: aria/storage/modeling/orchestrator_elements.py ---
    @@ -466,3 +466,18 @@ def abort(message=None):
         @staticmethod
         def retry(message=None, retry_interval=None):
             raise TaskRetryException(message, retry_interval=retry_interval)
    +
    +
    +class LogBase(ModelMixin):
    +    __tablename__ = 'log'
    +
    +    logger = Column(String)
    +    level = Column(String)
    +    msg = Column(String)
    +    created_at = Column(DateTime, index=True)
    +    prefix = Column(String)
    +    description = Column(String)
    --- End diff --
    
    remove


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-ariatosca/pull/69


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102520468
  
    --- Diff: aria/.pylintrc ---
    @@ -77,7 +77,7 @@ confidence=
     # --enable=similarities". If you want to run only the classes checker, but have
     # no Warning level messages displayed, use"--disable=all --enable=classes
     # --disable=W"
    -disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,redefined-builtin,logging-format-interpolation,import-error,redefined-variable-type,broad-except,protected-access,global-statement
    --- End diff --
    
    added


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102239149
  
    --- Diff: aria/storage/modeling/orchestrator_elements.py ---
    @@ -466,3 +466,18 @@ def abort(message=None):
         @staticmethod
         def retry(message=None, retry_interval=None):
             raise TaskRetryException(message, retry_interval=retry_interval)
    +
    +
    +class LogBase(ModelMixin):
    +    __tablename__ = 'log'
    +
    +    logger = Column(String)
    +    level = Column(String)
    +    msg = Column(String)
    +    created_at = Column(DateTime, index=True)
    +    prefix = Column(String)
    --- End diff --
    
    actor


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102238704
  
    --- Diff: aria/storage/modeling/orchestrator_elements.py ---
    @@ -466,3 +466,18 @@ def abort(message=None):
         @staticmethod
         def retry(message=None, retry_interval=None):
             raise TaskRetryException(message, retry_interval=retry_interval)
    +
    +
    +class LogBase(ModelMixin):
    +    __tablename__ = 'log'
    +
    +    logger = Column(String)
    --- End diff --
    
    logger_name


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102234412
  
    --- Diff: aria/logger.py ---
    @@ -135,5 +142,37 @@ def create_file_log_handler(
         return rotating_file
     
     
    +class _SQLAlchemyHandler(logging.Handler):
    +
    +    def __init__(self, session, engine, **kwargs):
    +        logging.Handler.__init__(self, **kwargs)
    +        self._session = session
    +        self._engine = engine
    +
    +        # Cyclic dependency
    +        from aria.storage.modeling.model import Log
    +        self._cls = Log
    +
    +    def emit(self, record):
    +        # pylint fails to recognize that this class does indeed have __table__
    +        self._cls.__table__.create(bind=self._engine, checkfirst=True)                              # pylint: disable=no-member
    --- End diff --
    
    move no-member to rules (for code and tests).
    
    Check if indeed recreation is necessary 


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

[GitHub] incubator-ariatosca pull request #69: ARIA-106-Create-sqla-logging-handler

Posted by mxmrlv <gi...@git.apache.org>.
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/69#discussion_r102480360
  
    --- Diff: aria/utils/imports.py ---
    @@ -76,3 +77,25 @@ def load_attribute(attribute_path):
         except AttributeError:
             # TODO: handle
             raise
    +
    +
    +class _SafeModuleImporter(object):
    --- End diff --
    
    remove class


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