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 2021/04/05 00:45:07 UTC

[GitHub] [airflow] ziliangpeng opened a new pull request #15195: fix dag sort in dag stats

ziliangpeng opened a new pull request #15195:
URL: https://github.com/apache/airflow/pull/15195


   Fix a bug in stat printer in dag_processing to correctly sort dag list by last runtime.
   
   


-- 
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] [airflow] github-actions[bot] commented on pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#issuecomment-890259931


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


-- 
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] ziliangpeng commented on pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
ziliangpeng commented on pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#issuecomment-850787440


   @dimberman @uranusjr It doesn't seem easy to add a unit test without some major refactoring of the code structure, which expanded the scope of the PR. 
   
   Can adding unit test be a different task, and achieved by another PR?


-- 
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] [airflow] ziliangpeng commented on a change in pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
ziliangpeng commented on a change in pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#discussion_r641903896



##########
File path: airflow/utils/dag_processing.py
##########
@@ -834,7 +834,7 @@ def _log_file_processing_stats(self, known_file_paths):
             rows.append((file_path, processor_pid, runtime, num_dags, num_errors, last_runtime, last_run))
 
         # Sort by longest last runtime. (Can't sort None values in python3)

Review comment:
       The comment and the code was not consistent, as you can see from the code above
   ```
   rows.append((file_path, processor_pid, runtime, num_dags, num_errors, last_runtime, last_run))
   ```
   index (5) is last_runtime. I'm just making the code and comment consistent.
   
   It was probably that when more fields were added into the row, and sort field was not updated.




-- 
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] [airflow] boring-cyborg[bot] commented on pull request #15195: fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#issuecomment-813127544


   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, pylint and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/master/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/master/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/master/BREEZE.rst) for testing locally, itโ€™s a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better ๐Ÿš€.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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] [airflow] uranusjr commented on pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#issuecomment-850802177


   If you can refactor this to something like
   
   ```python
   Row = namedtuple("Row", "file_path processor_pid runtime num_dags num_errors last_runtime last_run")
   
   rows = []
   for file_path in known_file_paths:
       ...
       row = Row(
           file_path=file_path,
           processor_pid=processor_pid,
           runtime=runtime,
           num_dags=num_dags,
           num_errors=num_errors,
           last_runtime=last_runtime,
           last_run=last_run,
       )
       rows.append(row)
   rows = sorted(rows, lambda row: row.last_runtime or 0.0)
   ```
   
   Then I think this is fine without a unit test (since the logic is obvious enough).


-- 
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] [airflow] dimberman commented on pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
dimberman commented on pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#issuecomment-813535835


   @ziliangpeng can you add a test?


-- 
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] [airflow] uranusjr commented on pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#issuecomment-814876567


   This may be a good chance to refactor the entire block to use namedtuple as well, to prevent future breakage.


-- 
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] [airflow] github-actions[bot] closed pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #15195:
URL: https://github.com/apache/airflow/pull/15195


   


-- 
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] jhtimmins commented on a change in pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
jhtimmins commented on a change in pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#discussion_r612088046



##########
File path: airflow/utils/dag_processing.py
##########
@@ -834,7 +834,7 @@ def _log_file_processing_stats(self, known_file_paths):
             rows.append((file_path, processor_pid, runtime, num_dags, num_errors, last_runtime, last_run))
 
         # Sort by longest last runtime. (Can't sort None values in python3)

Review comment:
       This seems to suggest that it's sorting the results by the length of each DAG's last runtime. Is your change sorting by the time of the last runtime? Or was it not sorting in the way the comment suggests and you're just fixing it?
   
   If it's the former, can you update the comment to reflect the new sort order?




-- 
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] [airflow] github-actions[bot] commented on pull request #15195: Fix dag sort in dag stats

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #15195:
URL: https://github.com/apache/airflow/pull/15195#issuecomment-850733106


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


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