potiuk commented on a change in pull request #7191: [AIRFLOW-4030] second 
attempt to add singularity to airflow
URL: https://github.com/apache/airflow/pull/7191#discussion_r368585955
 
 

 ##########
 File path: tests/contrib/operators/test_singularity_operator.py
 ##########
 @@ -0,0 +1,180 @@
+# -*- coding: utf-8 -*-
+#
+# 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 unittest
+import six
+
+from parameterized import parameterized
+from spython.instance import Instance
+from airflow import AirflowException
+
+try:
+    from airflow.contrib.operators.singularity_operator import 
SingularityOperator
+except ImportError:
+    pass
 
 Review comment:
   Also in case of your problems in the latest build - just read the output 
messages in the failed "static checks". I think the messages there are pretty 
clear, but maybe you need some more guidance here. 
   
   You can read more of the pre-commit checks and how we are using them in 
https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst#pre-commit-hooks
  - there is a list of pre-commit checks there and explanation what is the 
expectation.
   
   But to additionally describe it here and give you additional  guidance - my 
observations for the current errors you have:
   
   - The end-of-file/isort you can have pre-commit fixing it for you locally 
(and you will just have to commit it (end-of-file and isort for example). We 
have the requirements for isort-order of imports (isort is the tool that sorts 
them automatically) 
   
   - In other cases you need to fix it because there is - sometimes potential - 
problem in the code (for example in pylint, or the checks for proper sorting of 
dependencies in setup.py. 
   
   - In case of the sorting error - the dependencies in setup.py are 
alphabetically sorted so you should add your deps in sorted order.
   
   - In case of pylint errors - you seem to have too many arguments in one of 
the operators - you can solve it either by decreasing the number of operators 
or by adding appropriate pylint disable. You can see how to do it in our docs - 
there is explanation when and how you should manually disable the checks and 
explanation how to do it: 
https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst#pylint-static-code-checks
 
   
   - The other "test related" pylint errors - that's a clear programming error 
that pylint detected - there is no "compat" in module "tests" in your import 
(we dropped compat in master as we dropped python 2 support) and 
SingularityOperator is not imported it seems.
   
   > let's talk about commands to run that (outside of the much more complex 
logic added by the pre-commit command).
   
   It is super easy: You can run those pre-commits manually (that's the power 
of pre-commit framework.
   
   for example you can run:
   
   `pre-commit run end-of-file-fixer`
   
   for the changes you have locally added, or even 
   
   `pre-commit run end-of-file-fixer --all-files'
   
   And it will run the very same pre-commit checks as in Travis for all files. 
So you have easy way to reproduce it locally.
   
   This is explained in detail in "Using pre-commit hooks" - including 
examples: 
https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst#using-pre-commit-hooks

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to