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 2020/07/05 20:33:21 UTC
[GitHub] [airflow] kaxil opened a new pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
kaxil opened a new pull request #9674:
URL: https://github.com/apache/airflow/pull/9674
Make airflow/models/taskinstance.py Pylint Compatible
---
Make sure to mark the boxes below before creating PR: [x]
- [x] Description above provides context of the change
- [x] Unit tests coverage for changes (not needed for documentation changes)
- [x] Target Github ISSUE in description if exists
- [x] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
- [x] Relevant documentation is updated including usage instructions.
- [x] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
---
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
----------------------------------------------------------------
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] kaxil merged pull request #9674: Some Pylint fixes in airflow/models/taskinstance.py
Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #9674:
URL: https://github.com/apache/airflow/pull/9674
----------------------------------------------------------------
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] potiuk commented on a change in pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#discussion_r449916739
##########
File path: airflow/models/taskinstance.py
##########
@@ -483,6 +502,8 @@ def refresh_from_db(self, session=None, lock_for_update=False) -> None:
else:
self.state = None
+ self.log.debug("Refreshed TaskInstance %s", self)
Review comment:
👍
##########
File path: airflow/models/taskinstance.py
##########
@@ -522,6 +548,17 @@ def key(self) -> TaskInstanceKeyType:
@provide_session
def set_state(self, state, session=None, commit=True):
+ """
+ Set TaskInstance state
Review comment:
❤️
##########
File path: airflow/models/taskinstance.py
##########
@@ -972,7 +1022,7 @@ def _run_raw_task(
context = {} # type: Dict
actual_start_date = timezone.utcnow()
Stats.incr('ti.start.{}.{}'.format(task.dag_id, task.task_id))
- try:
+ try: # pylint: disable=too-many-nested-blocks
Review comment:
Happy to do that if it's a problem :)
##########
File path: airflow/models/taskinstance.py
##########
@@ -972,7 +1022,7 @@ def _run_raw_task(
context = {} # type: Dict
actual_start_date = timezone.utcnow()
Stats.incr('ti.start.{}.{}'.format(task.dag_id, task.task_id))
- try:
+ try: # pylint: disable=too-many-nested-blocks
Review comment:
should we rather split it and extract one ore even few methodsf? I think it's a very clear example of fairly complex code that can be simiplified by extracting methods and naming them properly
----------------------------------------------------------------
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] potiuk commented on a change in pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#discussion_r449916627
##########
File path: airflow/models/taskinstance.py
##########
@@ -181,6 +181,7 @@ class TaskInstance(Base, LoggingMixin):
)
def __init__(self, task, execution_date: datetime, state: Optional[str] = None):
+ super().__init__()
Review comment:
I am not sure. Will it initialize both Base and Mixin :)? Just checking.
----------------------------------------------------------------
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] turbaszek commented on pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#issuecomment-654146963
@kaxil I'm ok with merging this PR without removing this file from todo list (I think we already did such things few times) so the cyclic-imports can be addressed separately.
----------------------------------------------------------------
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] kaxil commented on pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#issuecomment-654122224
Or if you would want to address cyclic dependencies as separate PR, I can undo some of the changes in rhis PR, let me know what you'd prefer @turbaszek @potiuk
----------------------------------------------------------------
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] potiuk commented on a change in pull request #9674: Some Pylint fixes in airflow/models/taskinstance.py
Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#discussion_r450159511
##########
File path: airflow/models/taskinstance.py
##########
@@ -1114,8 +1083,108 @@ def signal_handler(signum, frame):
session.merge(self)
session.commit()
+ def _prepare_and_execute_task_with_callbacks(self, context, session, task):
Review comment:
: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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] kaxil commented on a change in pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#discussion_r449922077
##########
File path: airflow/models/taskinstance.py
##########
@@ -972,7 +1022,7 @@ def _run_raw_task(
context = {} # type: Dict
actual_start_date = timezone.utcnow()
Stats.incr('ti.start.{}.{}'.format(task.dag_id, task.task_id))
- try:
+ try: # pylint: disable=too-many-nested-blocks
Review comment:
You are right, we should :)
will do
----------------------------------------------------------------
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] potiuk commented on pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#issuecomment-654088827
> I think this PR needs a broader scope due to cyclic-imports. Both me and @potiuk have already tried to tackle with that so we can help
Oh yeah!
----------------------------------------------------------------
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] kaxil commented on pull request #9674: Some Pylint fixes in airflow/models/taskinstance.py
Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#issuecomment-654151038
> @kaxil I'm ok with merging this PR without removing this file from todo list (I think we already did such things few times) so the cyclic-imports can be addressed separately.
Updated the 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] kaxil commented on pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#issuecomment-654119867
> I think this PR needs a broader scope due to cyclic-imports. Both me and @potiuk have already tried to tackle with that so we can help
Yes please, feel free to edit push commits to this 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] turbaszek commented on a change in pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#discussion_r450053390
##########
File path: airflow/models/taskinstance.py
##########
@@ -181,6 +181,7 @@ class TaskInstance(Base, LoggingMixin):
)
def __init__(self, task, execution_date: datetime, state: Optional[str] = None):
+ super().__init__()
Review comment:
As far as I understand - no -> https://stackoverflow.com/a/16310777/9713409
But it's not a problem here because we nearly never initialize the `LoggingMixin`, I think the constructor in it is part of backward compatibility
----------------------------------------------------------------
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] turbaszek commented on pull request #9674: Make airflow/models/taskinstance.py Pylint Compatible
Posted by GitBox <gi...@apache.org>.
turbaszek commented on pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#issuecomment-654087835
I think this PR needs a broader scope due to cyclic-imports. Both me and @potiuk have already tried to tackle with that so we can help 😄
----------------------------------------------------------------
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] potiuk commented on pull request #9674: Some Pylint fixes in airflow/models/taskinstance.py
Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #9674:
URL: https://github.com/apache/airflow/pull/9674#issuecomment-654177568
Yep. fine for me.
----------------------------------------------------------------
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