You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kibble.apache.org by GitBox <gi...@apache.org> on 2021/05/22 11:49:15 UTC

[GitHub] [kibble] turbaszek opened a new pull request #8: Add Github issues and PRs scanner

turbaszek opened a new pull request #8:
URL: https://github.com/apache/kibble/pull/8


   In this PR I tried to build some basic tooling around scanning data sources. Currently the data is only collected and not persisted anywhere. That's still something I plan to do in this PR.
   
   Although I decided to use old approach with configuration in yaml file it should be treated only as temporary solution before we have a database. 
   
   Why didn't I use known PyGithub? It's LGPL.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] turbaszek commented on a change in pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #8:
URL: https://github.com/apache/kibble/pull/8#discussion_r650214549



##########
File path: docs/architecture.rst
##########
@@ -0,0 +1,126 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, 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.
+
+Apache Kibble Overview
+======================

Review comment:
       @sharanf @Humbedooh @kaxil @michalslowikowski00 I added some docs/notes about current status and how things are. Let me know what do you think




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] turbaszek edited a comment on pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
turbaszek edited a comment on pull request #8:
URL: https://github.com/apache/kibble/pull/8#issuecomment-851057538


   @kaxil @sharanf @Humbedooh @michalslowikowski00 happy to get your opinion.
   
   As suggested on the dev list I introduced concept of `DataSource` and `DataType`. Those for now can be configured yaml configuration file:
   ```yaml
   data_sources:
      - name: github_kibble
        class: kibble.data_sources.github.GithubDataSource
        config:
          repo_owner: apache
          repo_name: kibble
          enabled_data_types:
            - pr_issues
   ```
   
   This form allow users to specify any external data sources as long as the class path points to importable object. 
   
   The role of `DataSource` is to provide authentication methods for the external service represented by it. `DataType` represent single type of information we can get from this source, in case of this PR those are Github issues (which include also PRs).  Role of `DataType` is to define :
   - how to process the raw data from external source and how to persist them into database (to be done)
   - how to read the data from database including aggregation, filters etc.
   
   In general this is rough idea I have in m mind:
   ![Kibble-2](https://user-images.githubusercontent.com/9528307/120119311-4eba8080-c197-11eb-9e81-acce6e650c10.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] turbaszek commented on a change in pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #8:
URL: https://github.com/apache/kibble/pull/8#discussion_r641906748



##########
File path: kibble/scanners/base.py
##########
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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 logging
+from typing import Any
+
+
+class BaseScanner:
+    """Abstract, base class for all scanners"""
+
+    # pylint: disable=too-few-public-methods
+    def __init__(self, **kwargs):
+        self.log = logging.getLogger(__name__)
+
+    def _persist(self, payload: Any):  # pylint: disable=no-self-use
+        """Persists data to database. Should be implemented per scanner."""

Review comment:
       > One scanner, one database/table?
   
   I assume there will be only one database with multiple collections / document types. Need to evaluate ES vs some  other nosql db. 
   
   But general idea here is that each data type provides information how to persist it and how to read it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] turbaszek commented on a change in pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #8:
URL: https://github.com/apache/kibble/pull/8#discussion_r641906748



##########
File path: kibble/scanners/base.py
##########
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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 logging
+from typing import Any
+
+
+class BaseScanner:
+    """Abstract, base class for all scanners"""
+
+    # pylint: disable=too-few-public-methods
+    def __init__(self, **kwargs):
+        self.log = logging.getLogger(__name__)
+
+    def _persist(self, payload: Any):  # pylint: disable=no-self-use
+        """Persists data to database. Should be implemented per scanner."""

Review comment:
       > One scanner, one database/table?
   
   I assume there will be only one database with multiple collections / document types. Need to evaluate ES vs some  other nosql db




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] sharanf commented on pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
sharanf commented on pull request #8:
URL: https://github.com/apache/kibble/pull/8#issuecomment-851610895


   > @kaxil @sharanf @Humbedooh @michalslowikowski00 happy to get your opinion.
   > 
   > As suggested on the dev list I introduced concept of `DataSource` and `DataType`. Those for now can be configured yaml configuration file:
   > 
   > ```yaml
   > data_sources:
   >    - name: github_kibble
   >      class: kibble.data_sources.github.GithubDataSource
   >      config:
   >        repo_owner: apache
   >        repo_name: kibble
   >        enabled_data_types:
   >          - pr_issues
   > ```
   > 
   > This form allow users to specify any external data sources as long as the class path points to importable object.
   > 
   > The role of `DataSource` is to provide authentication methods for the external service represented by it. `DataType` represent single type of information we can get from this source, in case of this PR those are Github issues (which include also PRs). Role of `DataType` is to define :
   > 
   >     * how to process the raw data from external source and how to persist them into database (to be done)
   > 
   >     * how to read the data from database including aggregation, filters etc.
   > 
   > 
   > In general this is rough idea I have in m mind:
   > ![Kibble-2](https://user-images.githubusercontent.com/9528307/120119311-4eba8080-c197-11eb-9e81-acce6e650c10.png)
   
   @turbaszek Thanks for working on this.  My initial thought is that this looks a lot more granular than what we have in place now - which is good as we have sometimes missed at been able to get to the right level of granularity. For Github the datatypes seem fairly organised and can pretty much already allocated - how do you see this working for example for our project mailing lists? Would each list the be a datasource and the conversations the datatype?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] turbaszek commented on pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #8:
URL: https://github.com/apache/kibble/pull/8#issuecomment-851616956


   > how do you see this working for example for our project mailing lists? Would each list the be a datasource and the conversations the datatype?
   
   That's a very good question @sharanf!
   
   I would lean to what you've written. Datasource does not only represent an "external service" entity but "account/organization within an external service". So, in case of mailing list each Apache project would required configuring their own data source. 
   
   For example:
   ```yaml
   data_sources:
      - name: asf_mails_kibble
        class: kibble.data_sources.pony_mail.PonyMailDataSource
        config:
          project_name: kibble
          enabled_data_types:
            - mails
      - name: asf_mails_kafka
        class: kibble.data_sources.pony_mail.PonyMailDataSource
        config:
          project_name: kafka
          enabled_data_types:
            - mails
      - name: asf_mails_pulsar
        class: kibble.data_sources.pony_mail.PonyMailDataSource
        config:
          project_name: pulsar
          enabled_data_types:
            - mails
   ```
   
   While there's a bit of duplication in configuration it allow more granularity. In case of ASF the config will be big and repeatable but for smaller Kibble deployments it would be smaller and more configuration maybe an advantage.
   
   Additionally this additional granularity is useful in case of sources that need authorisation. In such cases we may want to store the credentials in different way or use different auth methods.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] turbaszek commented on pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #8:
URL: https://github.com/apache/kibble/pull/8#issuecomment-864088838


   @kaxil @Humbedooh @sharanf please let me know if we should proceed and merge (once I fix tests). I would like to make it move 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] sharanf commented on a change in pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
sharanf commented on a change in pull request #8:
URL: https://github.com/apache/kibble/pull/8#discussion_r650543429



##########
File path: docs/architecture.rst
##########
@@ -0,0 +1,126 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, 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.
+
+Apache Kibble Overview
+======================

Review comment:
       Thanks Tomek! This is good work. I have added some minor text changes.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] michalslowikowski00 commented on a change in pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
michalslowikowski00 commented on a change in pull request #8:
URL: https://github.com/apache/kibble/pull/8#discussion_r638217424



##########
File path: kibble/scanners/base.py
##########
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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 logging
+from typing import Any
+
+
+class BaseScanner:
+    """Abstract, base class for all scanners"""
+
+    # pylint: disable=too-few-public-methods
+    def __init__(self, **kwargs):
+        self.log = logging.getLogger(__name__)
+
+    def _persist(self, payload: Any):  # pylint: disable=no-self-use
+        """Persists data to database. Should be implemented per scanner."""

Review comment:
       One scanner, one database/table?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] Humbedooh commented on a change in pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
Humbedooh commented on a change in pull request #8:
URL: https://github.com/apache/kibble/pull/8#discussion_r643063549



##########
File path: kibble/scanners/base.py
##########
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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 logging
+from typing import Any
+
+
+class BaseScanner:
+    """Abstract, base class for all scanners"""
+
+    # pylint: disable=too-few-public-methods
+    def __init__(self, **kwargs):
+        self.log = logging.getLogger(__name__)
+
+    def _persist(self, payload: Any):  # pylint: disable=no-self-use
+        """Persists data to database. Should be implemented per scanner."""

Review comment:
       as of current ES versions, you can't have different document types in the same DB.
   So it would have to be one document type per index, which is what we also did with Kibble 1, for instance you have kibble_mail, kibble_code_commit, kibble_issue etc - one per general data type. You can do more generalized queries across indices, but usually we just deal with one type at a time, so having multiple indices is not an issue...




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] turbaszek commented on pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #8:
URL: https://github.com/apache/kibble/pull/8#issuecomment-851057538


   @kaxil @sharanf @Humbedooh @michalslowikowski00 happy to get your opinion.
   
   As suggested on the dev list I introduced concept of `DataSource` and `DataType`. Those for now can be configured yaml configuration file:
   ```yaml
   data_sources:
      - name: github_kibble
        class: kibble.data_sources.github.GithubDataSource
        config:
          repo_owner: apache
          repo_name: kibble
          enabled_data_types:
            - pr_issues
   ```
   
   This form allow users to specify any external data sources as long as the class path points to importable object. 
   
   The role of `DataSource` is to provide authentication methods for the external service represented by it. `DataType` represent single type of information we can get from this source, in case of this PR those are Github issues (which include also PRs).  Role of `DataType` is to define :
   - how to process the raw data from external source and how to persist them into database (to be done)
   - how to read the data from database including aggregation, filters etc.
   
   In general this is rough idea I have in m mind:
   ![Kibble](https://user-images.githubusercontent.com/9528307/120119256-ff745000-c196-11eb-803a-ae39f1a3d345.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] sharanf commented on pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
sharanf commented on pull request #8:
URL: https://github.com/apache/kibble/pull/8#issuecomment-864596293


   > @kaxil @Humbedooh @sharanf please let me know if we should proceed and merge (once I fix tests). I would like to make it move
   
   @turbaszek From my side I am happy to keep things moving so have no problems with starting to merge your new code once the tests are fixed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kibble] kaxil commented on a change in pull request #8: Add Github issues and PRs scanner

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #8:
URL: https://github.com/apache/kibble/pull/8#discussion_r637394461



##########
File path: kibble/configuration/yaml_config.py
##########
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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 os
+from typing import Dict
+
+import yaml
+
+KIBBLE_YAML = "kibble.yaml"
+
+
+def parse_kibble_yaml() -> Dict:
+    """Reads kibble.yaml config file"""
+    kibble_base_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)
+    config_path = os.path.join(kibble_base_path, KIBBLE_YAML)

Review comment:
       Should we replace this with [`Pathlib`](https://docs.python.org/3/library/pathlib.html#basic-use) as this is now preferred in Python world over os lib




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org