You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@liminal.apache.org by GitBox <gi...@apache.org> on 2020/12/14 12:46:48 UTC

[GitHub] [incubator-liminal] aviemzur commented on a change in pull request #10: [LIMINAL-5] change prints to log

aviemzur commented on a change in pull request #10:
URL: https://github.com/apache/incubator-liminal/pull/10#discussion_r542323957



##########
File path: examples/liminal-getting-started/helloworld/hello_world.py
##########
@@ -16,14 +16,8 @@
 # specific language governing permissions and limitations
 # under the License.
 import json
-import os

Review comment:
       Why were these changes made to `hello_world.py`?

##########
File path: liminal/logging/logging_setup.py
##########
@@ -0,0 +1,34 @@
+#
+# 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 liminal.core import environment
+LIMINAL = 'liminal'

Review comment:
       make sure file passes PEP8
   If you use an IDE like PyCharm / IntelliJ it can help you format the file

##########
File path: liminal/logging/logging_setup.py
##########
@@ -0,0 +1,34 @@
+#
+# 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 liminal.core import environment
+LIMINAL = 'liminal'
+LOGS_DIR = 'logs'
+
+def logging_initialization():
+    # TBD - rotating file handler
+    # TBD - log in JSON format
+    root_logger = logging.getLogger()
+    log_formatter = logging.Formatter("%(asctime)s [%(threadName)s] [%(levelname)s]  %(message)s")
+    file_handler = logging.FileHandler("{0}/{1}/{2}.log".format(environment.get_liminal_home(), LOGS_DIR, LIMINAL))
+    file_handler.setFormatter(log_formatter)
+    root_logger.addHandler(file_handler)
+    root_logger.setLevel(logging.DEBUG)

Review comment:
       Please change log level to INFO

##########
File path: scripts/liminal
##########
@@ -33,7 +33,9 @@ from liminal.core import environment
 from liminal.core.util import files_util
 from liminal.kubernetes import volume_util
 from liminal.runners.airflow import dag
-
+from liminal.logging.logging_setup import logging_initialization
+logging_initialization()

Review comment:
       Please move line to after imports

##########
File path: liminal/logging/logging_setup.py
##########
@@ -0,0 +1,34 @@
+#
+# 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 liminal.core import environment
+LIMINAL = 'liminal'
+LOGS_DIR = 'logs'
+
+def logging_initialization():
+    # TBD - rotating file handler

Review comment:
       I see these are still TBD
   Currently I'm not seeing the log lines in sysout or in logs file
   I think for now let's just focus on sysout and not log to file

##########
File path: liminal/logging/logging_setup.py
##########
@@ -0,0 +1,34 @@
+#
+# 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 liminal.core import environment
+LIMINAL = 'liminal'
+LOGS_DIR = 'logs'
+
+def logging_initialization():
+    # TBD - rotating file handler
+    # TBD - log in JSON format
+    root_logger = logging.getLogger()
+    log_formatter = logging.Formatter("%(asctime)s [%(threadName)s] [%(levelname)s]  %(message)s")

Review comment:
       Please include filename and line number in the format




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