You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/10/17 07:32:35 UTC

[GitHub] [airflow] uranusjr opened a new pull request, #27085: Clean up some more warnings in tests

uranusjr opened a new pull request, #27085:
URL: https://github.com/apache/airflow/pull/27085

   Picking them up bit by bit while I work on other things...


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] uranusjr merged pull request #27085: Clean up some more warnings in tests

Posted by GitBox <gi...@apache.org>.
uranusjr merged PR #27085:
URL: https://github.com/apache/airflow/pull/27085


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] tirkarthi commented on pull request #27085: Clean up some more warnings in tests

Posted by GitBox <gi...@apache.org>.
tirkarthi commented on PR #27085:
URL: https://github.com/apache/airflow/pull/27085#issuecomment-1280766897

   I wrote a small script using ast module that might be helpful with `create_dagrun` related deprecation warnings.
   
   ```python
   import ast
   import sys
   
   
   class Visitor(ast.NodeVisitor):
       def __init__(self, code, filename):
           self.code = code
           self.filename = filename
   
       def visit_Call(self, node):
           if (
               getattr(node.func, "attr", None) == "create_dagrun"
               and any(keyword.arg == "execution_date" for keyword in node.keywords)
               and not any(keyword.arg == "data_interval" for keyword in node.keywords)
           ):
               if node.lineno != node.end_lineno:
                   line = "\n".join(
                       self.code.splitlines()[node.lineno - 1 : node.end_lineno - 1]
                   )
               else:
                   line = self.code.splitlines()[node.lineno - 1]
               print(self.filename, node.lineno, line)
           self.generic_visit(node)
   
   
   def main(filename):
       with open(filename) as f:
           code = f.read()
           Visitor(code=code, filename=filename).visit(ast.parse(code))
   
   
   if __name__ == "__main__":
       main(sys.argv[1])
   ```
   
   ```
   find tests/api/ -iname '*py' | xargs -I{} python ../airflow_create_dagrun_warning.py {} 
   tests/api/common/test_mark_tasks.py 542         return self.dag1.create_dagrun(
               run_type=DagRunType.MANUAL, state=state, start_date=date, execution_date=date
   tests/api/common/test_mark_tasks.py 747         self.dag2.create_dagrun(
               run_type=DagRunType.MANUAL,
               state=State.FAILED,
               execution_date=self.execution_dates[0],
               session=session,
   tests/api/common/test_mark_tasks.py 753         dr2 = self.dag2.create_dagrun(
               run_type=DagRunType.MANUAL,
               state=State.FAILED,
               execution_date=self.execution_dates[1],
               session=session,
   tests/api/common/test_mark_tasks.py 759         self.dag2.create_dagrun(
               run_type=DagRunType.MANUAL,
               state=State.RUNNING,
               execution_date=self.execution_dates[2],
               session=session,
   ```


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on pull request #27085: Clean up some more warnings in tests

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #27085:
URL: https://github.com/apache/airflow/pull/27085#issuecomment-1289471099

   :heart: 


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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