Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify models/dag.py to let it pass pylint check #16584

Closed
wants to merge 1 commit into from

Conversation

buxizhizhoum
Copy link
Contributor

Modified the airflow/models/dag.py model to let it pass static code check

@buxizhizhoum
Copy link
Contributor Author

buxizhizhoum commented Jun 23, 2021

@ashb Could you have a look on this?

Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function docstring should be complete sentences, so please capitalise the first letter. The style is pretty inconsistent here.

airflow/models/dag.py Show resolved Hide resolved
# self.log.debug(e)
# d['is_picklable'] = False
# d['stacktrace'] = traceback.format_exc()
# return d
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I searched the project, it seems that this method is not used already, Or may be I am wrong?

Copy link
Member

@uranusjr uranusjr Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might as well be right (there are a lot of dead code in Airflow). But we can’t just remove it due to backward compatibility. Maybe add a DeprecationWarning (to plan for a removal) and ignore the entire block?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better than what I did, thanks for the advice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have placed a DeprecationWarning to this method, and applied some change to suppress pylint error.

@@ -2122,7 +2165,7 @@ class DagTag(Base):
dag_id = Column(String(ID_LEN), ForeignKey('dag.dag_id'), primary_key=True)

def __repr__(self):
return self.name
return f"<DagTag: {self.name}>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn’t seem related.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will rollback this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change has been rolled back, the original return self.name triggers an pylint error(repr does not return str (invalid-repr-returned)), and I change it a little to suppress it.

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice (remove the unrelated change pls). 3 more to go. But those are the difficult ones due to cyclic dependencies to remove. The configuration one is particularly guilty here.

@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Jun 23, 2021
self._full_filepath = value

@property
def concurrency(self) -> int:
"""Max active tasks limit of a dag"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find these type of DAG comments less helpful than no doc at all.

I'd rather we ignored the warning on these ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed less helpful doc strings including this one, thanks for your advice:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashb Could you help to have a look again?

@potiuk
Copy link
Member

potiuk commented Jun 24, 2021

Some static checks/docs/pylint still fail

@buxizhizhoum
Copy link
Contributor Author

Some static checks/docs/pylint still fail
@potiuk Sorry for disturbing, I have fixed them, could you please review it again?

@potiuk
Copy link
Member

potiuk commented Jun 25, 2021

Still some errors.

I HEARTILY recommend installing pre-commits locally and running them for every commit.

@potiuk
Copy link
Member

potiuk commented Jun 25, 2021

(and runing docs build locally is also fast now)

@buxizhizhoum
Copy link
Contributor Author

Still some errors.

I HEARTILY recommend installing pre-commits locally and running them for every commit.

my bad, I will fix as soon as possible.

@potiuk
Copy link
Member

potiuk commented Jun 28, 2021

Btw. We are getting rid of puking today (see the devlist) so this change is really obsolete.

@potiuk
Copy link
Member

potiuk commented Jun 28, 2021

shall we abandon this in the light of #16682 ?

@buxizhizhoum
Copy link
Contributor Author

shall we abandon this in the light of #16682 ?

sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-tools full tests needed We need to run full set of tests for this PR to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants